-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.py
64 lines (56 loc) · 1.93 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import glob
import os
from setuptools import setup
import django_scrubadub
def fullsplit(path, result=None):
"""
Split a pathname into components (the opposite of os.path.join) in a
platform-neutral way.
"""
if result is None:
result = []
head, tail = os.path.split(path)
if head == '':
return [tail] + result
if head == path:
return result
return fullsplit(head, [tail] + result)
# read in the dependencies from the virtualenv requirements file
dependencies = []
filename = os.path.join("requirements", "python")
with open(filename, 'r') as stream:
for line in stream:
package = line.strip().split('#')[0]
if package:
dependencies.append(package)
# get a list of all the packages and package data to include in scr_dir.
# inspiration from django's and django-flux's setup.py
src_dir = 'django_scrubadub'
packages = []
package_data = {src_dir:[]}
for dirpath, dirnames, filenames in os.walk(src_dir):
for i, dirname in enumerate(dirnames):
if dirname.startswith('.') or dirname == '__pycache__':
del dirnames[i]
if '__init__.py' in filenames:
packages.append('.'.join(fullsplit(dirpath)))
elif filenames:
package_data[src_dir].extend([os.path.join(dirpath, f)
for f in filenames])
github_url='https://github.com/datascopeanalytics/django-scrubadub'
setup(
name='django_scrubadub',
version=django_scrubadub.VERSION,
description="web services API and training interface for removing filth from dirty dirty text",
long_description=open('README.md').read(),
url=github_url,
download_url="%s/archives/master" % github_url,
author='Dean Malmgren',
author_email='dean.malmgren@datascopeanalytics.com',
license='MIT',
install_requires=dependencies,
packages=packages,
package_data=package_data,
include_package_data=True,
zip_safe=False,
)