From f58dc9a7b7276bfd6558059052bb2d3679ddb536 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Wed, 11 May 2022 16:50:27 -0400 Subject: [PATCH] refactor: use flit as a backend Signed-off-by: Henry Schreiner --- pyproject.toml | 41 ++++++++++++++++++++++++++++-- setup.cfg | 3 --- setup.py | 69 -------------------------------------------------- 3 files changed, 39 insertions(+), 74 deletions(-) delete mode 100644 setup.cfg delete mode 100644 setup.py diff --git a/pyproject.toml b/pyproject.toml index cb37b725d..7358d3366 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,40 @@ [build-system] -requires = ['setuptools >= 40.8.0', 'wheel'] -build-backend = 'setuptools.build_meta' +requires = ["flit_core >=3.2"] +build-backend = "flit_core.buildapi" + +[project] +name = "packaging" +description = "Core utilities for Python packages" +version = "21.4.dev0" +readme = "README.rst" +requires-python = ">=3.7" +authors = [{name = "Donald Stufft", email = "donald@stufft.io"}] +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 :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", +] +urls.Source = "https://github.com/pypa/packaging" +dependencies = [ + "pyparsing>=2.0.2,!=3.0.5", +] + + +[tool.flit.sdist] +include = ["LICENSE*", "tests/", "docs/", ".coveragerc", ".flake8", "mypy.ini", ".pre-commit-config.yaml"] +exclude = ["docs/_build", "tests/manylinux/build-hello-world.sh", "tests/musllinux/build.sh", "tests/hello-world.c"] + + +[tool.isort] +profile = "black" +combine_as_imports = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index c97a4e440..000000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[isort] -profile = black -combine_as_imports = true diff --git a/setup.py b/setup.py deleted file mode 100644 index 82ef248e4..000000000 --- a/setup.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/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. - -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=">=3.7", - install_requires=["pyparsing>=2.0.2,!=3.0.5"], # 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 :: 3", - "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - ], - packages=["packaging"], - package_data={"packaging": ["py.typed"]}, -)