forked from MechanicalSoup/MechanicalSoup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
80 lines (61 loc) · 2.73 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
import re
import sys
from codecs import open # To use a consistent encoding
from os import path
from setuptools import setup # Always prefer setuptools over distutils
def requirements_from_file(filename):
"""Parses a pip requirements file into a list."""
return [line.strip() for line in open(filename, 'r')
if line.strip() and not line.strip().startswith('--')]
def read(fname, URL, URLImage):
"""Read the content of a file."""
readme = open(path.join(path.dirname(__file__), fname)).read()
if hasattr(readme, 'decode'):
# In Python 3, turn bytes into str.
readme = readme.decode('utf8')
# turn relative links into absolute ones
readme = re.sub(r'`<([^>]*)>`__',
r'`\1 <' URL r"/blob/master/\1>`__",
readme)
readme = re.sub(r"\.\. image:: /", ".. image:: " URLImage "/", readme)
return readme
here = path.abspath(path.dirname(__file__))
about = {}
with open(path.join(here, 'mechanicalsoup', '__version__.py'),
'r', 'utf-8') as f:
exec(f.read(), about)
# Don't install pytest-runner on every setup.py run, just for tests.
# See https://pypi.org/project/pytest-runner/#conditional-requirement
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []
setup(
name=about['__title__'],
# useful: python setup.py sdist bdist_wheel upload
version=about['__version__'],
description=about['__description__'],
long_description=read('README.rst', about['__github_url__'], about[
'__github_assets_absoluteURL__']),
url=about['__url__'],
license=about['__license__'],
python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*',
classifiers=[
'License :: OSI Approved :: MIT License',
# Specify the Python versions you support here. In particular, ensure
# that you indicate whether you support Python 2, Python 3 or both.
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
packages=['mechanicalsoup'],
# List run-time dependencies here. These will be installed by pip
# when your project is installed. For an analysis of
# "install_requires" vs pip's requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=requirements_from_file('requirements.txt'),
setup_requires=pytest_runner,
tests_require=requirements_from_file('tests/requirements.txt'),
)