forked from deanmalmgren/textract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
67 lines (56 loc) · 2.08 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
65
66
67
import glob
import os
from setuptools import setup
import textract
# get all of the scripts
scripts = glob.glob("bin/*")
# read in the description from README
with open("README.rst") as stream:
long_description = stream.read()
github_url = 'https://github.com/deanmalmgren/textract'
def parse_requirements(requirements_filename):
"""read in the dependencies from the requirements files
"""
dependencies, dependency_links = [], []
requirements_dir = os.path.dirname(requirements_filename)
with open(requirements_filename, 'r') as stream:
for line in stream:
line = line.strip()
if line.startswith("-r"):
filename = os.path.join(requirements_dir, line[2:].strip())
_dependencies, _dependency_links = parse_requirements(filename)
dependencies.extend(_dependencies)
dependency_links.extend(_dependency_links)
elif line.startswith("http"):
dependency_links.append(line)
else:
package = line.split('#')[0]
# Ebooklib is licensed under the AGPL, so it won't be installed unless
# explictly required through the corresponding feature
if package and not package.startswith("EbookLib"):
dependencies.append(package)
return dependencies, dependency_links
requirements_filename = os.path.join("requirements", "python")
dependencies, dependency_links = parse_requirements(requirements_filename)
setup(
name=textract.__name__,
version="1.6.1",
description="extract text from any document. no muss. no fuss.",
long_description=long_description,
url=github_url,
download_url="%s/archives/master" % github_url,
author='Dean Malmgren',
author_email='[email protected]',
license='MIT',
scripts=scripts,
packages=[
'textract',
'textract.parsers',
],
install_requires=dependencies,
dependency_links=dependency_links,
extras_require={
'EbookLib': ["EbookLib"]
},
zip_safe=False,
)