-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathsetup.py
executable file
·150 lines (116 loc) · 4.04 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#!/usr/bin/python
import sys
if sys.version_info[:2] < (3, 4):
raise RuntimeError("Python version >= 3.4 required.")
import warnings
if sys.version_info[:2] < (3, 6):
warnings.warn("Python version >= 3.6 required.")
version = '0.1.16dev'
import os.path
from setuptools import setup, find_packages, Command
with open("README.rst") as f:
try:
readme_content = f.read()
except:
readme_content = ""
_HAVE_SPHINX = True
try:
from sphinx.cmd import build as sphinx
except ImportError:
try:
import sphinx
except ImportError:
_HAVE_SPHINX = False
class doc(Command):
description = "Generate or Test Documentation"
user_options = [("test", "t",
"Run Doctests instead of generating documentation")]
boolean_options = ["test"]
def initialize_options(self):
self.test = False
def finalize_options(self):
pass
def run(self):
if not _HAVE_SPHINX:
raise RuntimeError(
"You must install Sphinx to build or test the documentation.")
if self.test:
path = os.path.join(
os.path.abspath('.'), "doc", "_build", "doctest")
mode = "doctest"
else:
path = os.path.join(
os.path.abspath('.'), "doc", "_build", version)
mode = "html"
try:
os.makedirs(path)
except:
pass
sphinx_args = ["-E", "-b", mode, "doc", path]
if hasattr(sphinx, 'build_main'):
status = sphinx.build_main(sphinx_args)
else:
status = sphinx.main(sphinx_args)
if status:
raise RuntimeError("documentation step '%s' failed" % (mode,))
sys.stdout.write("\nDocumentation step '%s' performed, results here:\n"
" %s/\n" % (mode, path))
class test(Command):
description = "Run tests"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
# Installing required packages, running egg_info are
# part of normal operation for setuptools.command.test.test
if self.distribution.install_requires:
self.distribution.fetch_build_eggs(
self.distribution.install_requires)
self.run_command('egg_info')
import unittest
from pdfreader.tests import suite
runner = unittest.TextTestRunner()
result = runner.run(suite())
sys.exit(not result.wasSuccessful())
setup(name="pdfreader",
version=version,
description="Pythonic API for parsing PDF files",
long_description=readme_content,
long_description_content_type='text/x-rst',
author="Maksym Polshcha",
author_email="maxp@sterch.net",
maintainer="Maksym Polshcha",
maintainer_email="maxp@sterch.net",
url="http://github.com/maxpmaxp/pdfreader",
keywords=["pdf", "pdfreader", "pdfparser", "adobe", "parser", "cmap"],
license="MIT Licence",
python_requires=">=3.4",
classifiers=[
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development",
"Topic :: Software Development :: Libraries :: Python Modules",
],
packages=find_packages(exclude=["doc"]),
package_data={'doc': ['doc/*'],
'pdfreader.codecs': ['cmaps/*']},
zip_safe=False,
install_requires=['bitarray>=2.9.2',
'pillow>=7.1.0',
'pycryptodome>=3.19.1',
'python-dateutil>=2.8.1',
'setuptools>=68.2.0'],
entry_points={
'console_scripts':
[],
},
cmdclass={"doc": doc,
"test": test}
)