-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
69 lines (53 loc) · 1.98 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
# coding=utf-8
import re
import sys
from os.path import join, dirname
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
with open(join(dirname(__file__), 'README.rst'), 'r', encoding='utf-8') as fd:
long_description = fd.read()
def read_version():
p = join(dirname(__file__), 'serlist', '__init__.py')
with open(p, 'r', encoding='utf-8') as f:
return re.search(r"__version__ = '([^']+)'", f.read()).group(1)
def read_requirements(file):
with open(join(dirname(__file__), 'requirements', file), 'r', encoding='utf-8') as f:
return [l.strip() for l in f]
class PyTest(TestCommand):
def run_tests(self):
import pytest
errno = pytest.main(['tests'])
sys.exit(errno)
tests_require = read_requirements('test.txt')
install_requires = ['lxml>=4.1.0']
def main():
if sys.version_info < (3, 5):
raise RuntimeError("The minimal supported Python version is 3.5")
setup(
name="serlist",
version=read_version(),
url="https://github.com/jadbin/serlist",
description="Search engine results page scraper",
long_description=long_description,
author="jadbin",
author_email="[email protected]",
license="Apache 2",
zip_safe=False,
packages=find_packages(exclude=("tests",)),
include_package_data=True,
python_requires='>=3.5',
install_requires=install_requires,
tests_require=tests_require,
cmdclass={"test": PyTest},
classifiers=[
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Developers",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Topic :: Software Development :: Libraries :: Python Modules"
]
)
if __name__ == "__main__":
main()