| 1 |
#!/usr/bin/env python |
| 2 |
# This file is dual licensed under the terms of the Apache License, Version |
| 3 |
# 2.0, and the BSD License. See the LICENSE file in the root of this repository |
| 4 |
# for complete details. |
| 5 |
|
| 6 |
import os |
| 7 |
import re |
| 8 |
|
| 9 |
# While I generally consider it an antipattern to try and support both |
| 10 |
# setuptools and distutils with a single setup.py, in this specific instance |
| 11 |
# where packaging is a dependency of setuptools, it can create a circular |
| 12 |
# dependency when projects attempt to unbundle stuff from setuptools and pip. |
| 13 |
# Though we don't really support that, it makes things easier if we do this and |
| 14 |
# should hopefully cause less issues for end users. |
| 15 |
try: |
| 16 |
from setuptools import setup |
| 17 |
except ImportError: |
| 18 |
from distutils.core import setup |
| 19 |
|
| 20 |
|
| 21 |
base_dir = os.path.dirname(__file__) |
| 22 |
|
| 23 |
about = {} |
| 24 |
with open(os.path.join(base_dir, "packaging", "__about__.py")) as f: |
| 25 |
exec(f.read(), about) |
| 26 |
|
| 27 |
with open(os.path.join(base_dir, "README.rst")) as f: |
| 28 |
long_description = f.read() |
| 29 |
|
| 30 |
with open(os.path.join(base_dir, "CHANGELOG.rst")) as f: |
| 31 |
# Remove :issue:`ddd` tags that breaks the description rendering |
| 32 |
changelog = re.sub( |
| 33 |
r":issue:`(\d+)`", |
| 34 |
r"`#\1 <https://github.com/pypa/packaging/issues/\1>`__", |
| 35 |
f.read(), |
| 36 |
) |
| 37 |
long_description = "\n".join([long_description, changelog]) |
| 38 |
|
| 39 |
|
| 40 |
setup( |
| 41 |
name=about["__title__"], |
| 42 |
version=about["__version__"], |
| 43 |
description=about["__summary__"], |
| 44 |
long_description=long_description, |
| 45 |
long_description_content_type="text/x-rst", |
| 46 |
license=about["__license__"], |
| 47 |
url=about["__uri__"], |
| 48 |
author=about["__author__"], |
| 49 |
author_email=about["__email__"], |
| 50 |
python_requires=">=3.6", |
| 51 |
install_requires=["pyparsing>=2.0.2,!=3.0.5"], # 2.0.2 + needed to avoid issue #91 |
| 52 |
classifiers=[ |
| 53 |
"Development Status :: 5 - Production/Stable", |
| 54 |
"Intended Audience :: Developers", |
| 55 |
"License :: OSI Approved :: Apache Software License", |
| 56 |
"License :: OSI Approved :: BSD License", |
| 57 |
"Programming Language :: Python", |
| 58 |
"Programming Language :: Python :: 3", |
| 59 |
"Programming Language :: Python :: 3 :: Only", |
| 60 |
"Programming Language :: Python :: 3.6", |
| 61 |
"Programming Language :: Python :: 3.7", |
| 62 |
"Programming Language :: Python :: 3.8", |
| 63 |
"Programming Language :: Python :: 3.9", |
| 64 |
"Programming Language :: Python :: 3.10", |
| 65 |
"Programming Language :: Python :: Implementation :: CPython", |
| 66 |
"Programming Language :: Python :: Implementation :: PyPy", |
| 67 |
], |
| 68 |
packages=["packaging"], |
| 69 |
package_data={"packaging": ["py.typed"]}, |
| 70 |
) |