-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathsetup.py
60 lines (52 loc) · 1.57 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
import pip
from setuptools import setup, find_packages
from setuptools.command.install import install
package = 'bsdetector'
version = '0.1'
links = [] # for repo urls (dependency_links)
requires = [] # for package names
# new versions of pip requires a session
requirements = pip.req.parse_requirements(
'requirements.txt', session=pip.download.PipSession()
)
for item in requirements:
link = None
if getattr(item, 'url', None): # older pip has url
link = str(item.url)
if getattr(item, 'link', None): # newer pip has link
link = str(item.link)
if link:
link = link.lstrip('git+')
links.append(link)
if item.req:
item_req = str(item.req)
if item_req == 'pattern':
continue
requires.append(item_req) # always the package name
class PostInstallCommand(install):
"""Post-installation for installation mode."""
def run(self):
# PUT YOUR POST-INSTALL SCRIPT HERE or CALL A FUNCTION
import nltk
nltk.download('punkt')
install.run(self)
setup(
name=package,
version=version,
package_dir={'bsdetector': 'bsdetector'},
package_data={'bsdetector': ['*.json', '*.txt']},
packages=find_packages(),
install_requires=requires,
dependency_links=links,
include_package_data=True,
description="Detects biased statements in online media documents",
url='url',
cmdclass={
'install': PostInstallCommand
},
entry_points={
'console_scripts': [
'bsdetector = bsdetector.__main__:main'
]
}
)