Skip to content

Commit

Permalink
move back to setuptools
Browse files Browse the repository at this point in the history
Closes pypa#363

Signed-off-by: Filipe Laíns <[email protected]>
  • Loading branch information
FFY00 committed Dec 3, 2020
1 parent a6407e3 commit 7dc9d94
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 4 deletions.
21 changes: 21 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
27 changes: 27 additions & 0 deletions packaging/__about__.py
Original file line number Diff line number Diff line change
@@ -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__ = "[email protected]"

__license__ = "BSD-2-Clause or Apache-2.0"
__copyright__ = "2014-2019 %s" % __author__
25 changes: 23 additions & 2 deletions packaging/__init__.py
Original file line number Diff line number Diff line change
@@ -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__",
]
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal=1
73 changes: 73 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/pypa/packaging/issues/\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"]},
)

0 comments on commit 7dc9d94

Please sign in to comment.