-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
74 lines (61 loc) · 1.91 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
import os
import setuptools
from setuptools.command import sdist
import subprocess
import sys
CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.insert(0, CURRENT_DIR)
DOCS_FILENAME = 'docs.md'
class Sdist(sdist.sdist):
'''Generate Markdown documentation '''
def run(self):
docs_filename = os.path.join(CURRENT_DIR, DOCS_FILENAME)
docs_process = subprocess.run(
[
'pdoc',
os.path.join(CURRENT_DIR, 'datastructure.py')
],
capture_output=True,
text=True,
encoding='utf-8'
)
docs_output_str = docs_process.stdout
try:
with open(docs_filename, 'r', encoding='utf-8') as f:
docs_from_file = f.read()
except:
print("! Docs do not exist", file=sys.stderr)
docs_from_file = ''
# only save docs if changed
if docs_from_file != docs_output_str:
with open(docs_filename, 'w', encoding='utf-8') as f:
f.write(docs_output_str)
super().run()
if __name__ == "__main__":
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="datastructure",
version="1.6.0",
author="Boris Chervenkov",
author_email="[email protected]",
description="Easy manipulation of nested data structures",
long_description=long_description,
long_description_content_type="text/markdown",
packages=['.'],
classifiers=[
"Programming Language :: Python :: 3",
"License :: Proprietary",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
extras_require={
'dev': [
'pdoc'
]
},
cmdclass={
'sdist': Sdist,
},
include_package_data=True,
)