From 7dc9d945fe8d726a98fcc6bcf99c5e6895b9cd1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filipe=20La=C3=ADns?= Date: Thu, 3 Dec 2020 20:45:58 +0000 Subject: [PATCH] move back to setuptools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #363 Signed-off-by: Filipe LaĆ­ns --- MANIFEST.in | 21 ++++++++++++ docs/conf.py | 4 +-- packaging/__about__.py | 27 ++++++++++++++++ packaging/__init__.py | 25 +++++++++++++-- setup.cfg | 2 ++ setup.py | 73 ++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 148 insertions(+), 4 deletions(-) create mode 100644 MANIFEST.in create mode 100644 packaging/__about__.py create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..82485c27e --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,21 @@ +include CHANGELOG.rst CONTRIBUTING.rst README.rst +include LICENSE LICENSE.APACHE LICENSE.BSD + +include .coveragerc +include .flake8 +include .pre-commit-config.yaml +include mypy.ini + +recursive-include docs * +recursive-include tests *.py +recursive-include tests hello-world-* + +exclude noxfile.py +exclude .readthedocs.yml +exclude .travis.yml +exclude dev-requirements.txt +exclude tests/build-hello-world.sh +exclude tests/hello-world.c + +prune docs/_build +prune tasks diff --git a/docs/conf.py b/docs/conf.py index 3bd4b13aa..cdd1ac119 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -43,11 +43,11 @@ base_dir = os.path.join(os.path.dirname(__file__), os.pardir) about = {} -with open(os.path.join(base_dir, "packaging", "__init__.py")) as f: +with open(os.path.join(base_dir, "packaging", "__about__.py")) as f: exec(f.read(), about) version = release = about["__version__"] -copyright = "2014-2019 Donald Stufft and individual contributors" +copyright = about["__copyright__"] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. diff --git a/packaging/__about__.py b/packaging/__about__.py new file mode 100644 index 000000000..eec7ebe16 --- /dev/null +++ b/packaging/__about__.py @@ -0,0 +1,27 @@ +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. +from __future__ import absolute_import, division, print_function + +__all__ = [ + "__title__", + "__summary__", + "__uri__", + "__version__", + "__author__", + "__email__", + "__license__", + "__copyright__", +] + +__title__ = "packaging" +__summary__ = "Core utilities for Python packages" +__uri__ = "https://github.com/pypa/packaging" + +__version__ = "20.5.dev0" + +__author__ = "Donald Stufft and individual contributors" +__email__ = "donald@stufft.io" + +__license__ = "BSD-2-Clause or Apache-2.0" +__copyright__ = "2014-2019 %s" % __author__ diff --git a/packaging/__init__.py b/packaging/__init__.py index a6cf516d3..a0cf67df5 100644 --- a/packaging/__init__.py +++ b/packaging/__init__.py @@ -1,5 +1,26 @@ # This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. -"""Core utilities for Python packages""" -__version__ = "20.8.dev0" +from __future__ import absolute_import, division, print_function + +from .__about__ import ( + __author__, + __copyright__, + __email__, + __license__, + __summary__, + __title__, + __uri__, + __version__, +) + +__all__ = [ + "__title__", + "__summary__", + "__uri__", + "__version__", + "__author__", + "__email__", + "__license__", + "__copyright__", +] diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 000000000..3c6e79cf3 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/setup.py b/setup.py new file mode 100644 index 000000000..fd8562067 --- /dev/null +++ b/setup.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python +# This file is dual licensed under the terms of the Apache License, Version +# 2.0, and the BSD License. See the LICENSE file in the root of this repository +# for complete details. +from __future__ import absolute_import, division, print_function + +import os +import re + +# While I generally consider it an antipattern to try and support both +# setuptools and distutils with a single setup.py, in this specific instance +# where packaging is a dependency of setuptools, it can create a circular +# dependency when projects attempt to unbundle stuff from setuptools and pip. +# Though we don't really support that, it makes things easier if we do this and +# should hopefully cause less issues for end users. +try: + from setuptools import setup +except ImportError: + from distutils.core import setup + + +base_dir = os.path.dirname(__file__) + +about = {} +with open(os.path.join(base_dir, "packaging", "__about__.py")) as f: + exec(f.read(), about) + +with open(os.path.join(base_dir, "README.rst")) as f: + long_description = f.read() + +with open(os.path.join(base_dir, "CHANGELOG.rst")) as f: + # Remove :issue:`ddd` tags that breaks the description rendering + changelog = re.sub( + r":issue:`(\d+)`", + r"`#\1 `__", + f.read(), + ) + long_description = "\n".join([long_description, changelog]) + + +setup( + name=about["__title__"], + version=about["__version__"], + description=about["__summary__"], + long_description=long_description, + long_description_content_type="text/x-rst", + license=about["__license__"], + url=about["__uri__"], + author=about["__author__"], + author_email=about["__email__"], + python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", + install_requires=["pyparsing>=2.0.2"], # Needed to avoid issue #91 + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "License :: OSI Approved :: BSD License", + "Programming Language :: Python", + "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.4", + "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + ], + packages=["packaging"], + package_data={"packaging": ["py.typed"]}, +)