|
1 | 1 | #!/usr/bin/env python3 |
2 | | -# import semver as package |
3 | | -from os.path import dirname, join |
4 | | -from setuptools import setup |
5 | | -import re |
| 2 | +import setuptools |
6 | 3 |
|
7 | | - |
8 | | -VERSION_MATCH = re.compile(r"__version__ = ['\"]([^'\"]*)['\"]", re.M) |
9 | | - |
10 | | - |
11 | | -def read_file(filename): |
12 | | - """ |
13 | | - Read RST file and return content |
14 | | -
|
15 | | - :param filename: the RST file |
16 | | - :return: content of the RST file |
17 | | - """ |
18 | | - with open(join(dirname(__file__), filename)) as f: |
19 | | - return f.read() |
20 | | - |
21 | | - |
22 | | -def find_meta(meta): |
23 | | - """ |
24 | | - Extract __*meta*__ from META_FILE. |
25 | | - """ |
26 | | - meta_match = re.search( |
27 | | - r"^__{meta}__ = ['\"]([^'\"]*)['\"]".format(meta=meta), META_FILE, re.M |
28 | | - ) |
29 | | - if meta_match: |
30 | | - return meta_match.group(1) |
31 | | - raise RuntimeError("Unable to find __{meta}__ string.".format(meta=meta)) |
32 | | - |
33 | | - |
34 | | -NAME = "semver" |
35 | | -META_FILE = read_file("semver.py") |
36 | | - |
37 | | - |
38 | | -# ----------------------------------------------------------------------------- |
39 | | -setup( |
40 | | - name=NAME, |
41 | | - version=find_meta("version"), |
42 | | - description=find_meta("description").strip(), |
43 | | - long_description=read_file("README.rst"), |
44 | | - long_description_content_type="text/x-rst", |
45 | | - author=find_meta("author"), |
46 | | - author_email=find_meta("author_email"), |
47 | | - url="https://github.com/python-semver/python-semver", |
48 | | - download_url="https://github.com/python-semver/python-semver/downloads", |
49 | | - project_urls={ |
50 | | - "Documentation": "https://python-semver.rtfd.io", |
51 | | - "Releases": "https://github.com/python-semver/python-semver/releases", |
52 | | - "Bug Tracker": "https://github.com/python-semver/python-semver/issues", |
53 | | - }, |
54 | | - py_modules=[NAME], |
55 | | - include_package_data=True, |
56 | | - license="BSD", |
57 | | - classifiers=[ |
58 | | - # See https://pypi.org/pypi?%3Aaction=list_classifiers |
59 | | - "Environment :: Web Environment", |
60 | | - "Intended Audience :: Developers", |
61 | | - "License :: OSI Approved :: BSD License", |
62 | | - "Operating System :: OS Independent", |
63 | | - "Programming Language :: Python", |
64 | | - "Programming Language :: Python :: 3", |
65 | | - "Programming Language :: Python :: 3.6", |
66 | | - "Programming Language :: Python :: 3.7", |
67 | | - "Programming Language :: Python :: 3.8", |
68 | | - "Programming Language :: Python :: 3.9", |
69 | | - # "Programming Language :: Python :: Implementation :: PyPy", |
70 | | - "Topic :: Software Development :: Libraries :: Python Modules", |
71 | | - ], |
72 | | - python_requires=">=3.6.*", |
73 | | - tests_require=["tox", "virtualenv", "wheel"], |
74 | | - entry_points={"console_scripts": ["pysemver = semver:main"]}, |
75 | | -) |
| 4 | +setuptools.setup() # For compatibility with python 3.6 |
0 commit comments