Skip to content

Commit 4973f1b

Browse files
committed
update setup to enable readthedoc build
1 parent 1199b44 commit 4973f1b

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

setup.py

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#!/usr/bin/env python
21
# -*- coding: utf-8 -*-
32

43
"""
@@ -128,20 +127,40 @@
128127
Full list can be found at: https://pypi.python.org/pypi?%3Aaction=list_classifiers
129128
"""
130129

131-
# Read requirements.txt, ignore comments
132-
try:
133-
REQUIRES = list()
134-
f = open("requirements.txt", "rb")
130+
131+
def read_requirements_file(path):
132+
"""
133+
Read requirements.txt, ignore comments
134+
"""
135+
requires = list()
136+
f = open(path, "rb")
135137
for line in f.read().decode("utf-8").split("\n"):
136138
line = line.strip()
137139
if "#" in line:
138140
line = line[:line.find("#")].strip()
139141
if line:
140-
REQUIRES.append(line)
142+
requires.append(line)
143+
return requires
144+
145+
146+
try:
147+
REQUIRES = read_requirements_file("requirements.txt")
141148
except:
142149
print("'requirements.txt' not found!")
143150
REQUIRES = list()
144151

152+
EXTRA_REQUIRE = dict()
153+
154+
try:
155+
EXTRA_REQUIRE["tests"] = read_requirements_file("requirements-test.txt")
156+
except:
157+
print("'requirements-test.txt' not found!")
158+
159+
try:
160+
EXTRA_REQUIRE["docs"] = read_requirements_file("requirements-doc.txt")
161+
except:
162+
print("'requirements-test.txt' not found!")
163+
145164
setup(
146165
name=PKG_NAME,
147166
description=SHORT_DESCRIPTION,
@@ -161,6 +180,7 @@
161180
platforms=PLATFORMS,
162181
license=LICENSE,
163182
install_requires=REQUIRES,
183+
extras_require=EXTRA_REQUIRE,
164184
)
165185

166186
"""
@@ -192,8 +212,8 @@
192212
"Intended Audience :: System Administrators",
193213
"Intended Audience :: Telecommunications Industry",
194214
195-
"License :: OSI Approved :: BSD License",
196215
"License :: OSI Approved :: MIT License",
216+
"License :: OSI Approved :: BSD License",
197217
"License :: OSI Approved :: Apache Software License",
198218
"License :: OSI Approved :: GNU General Public License (GPL)",
199219
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
@@ -213,6 +233,7 @@
213233
"Programming Language :: Python :: 3.4",
214234
"Programming Language :: Python :: 3.5",
215235
"Programming Language :: Python :: 3.6",
236+
"Programming Language :: Python :: 3.7",
216237
"Programming Language :: Python :: 3 :: Only",
217238
]
218-
"""
239+
"""

0 commit comments

Comments
 (0)