Use PBR's pyproject.toml build-backend support

setup.py is still required as the build_meta entrypoints PBR uses
execute setup.py, but only needs to set the pbr attribute to True
now. Really what this change gets us is control over the version of
SetupTools and PBR that are used, but much of the underlying
machinery doesn't change.

Some gymnastics are required in order to keep working with Python
3.6, due to Pip and SetupTools disagreeing on PEP 660 support with
that interpreter version, but appropriate TODO comments are left as
a reminder to simplify once we no longer care to support those
platforms.

Change-Id: If210b5f5b5b7b9bbcb2538c49fbe7a5f7b8260ed
This commit is contained in:
Clark Boylan 2021-11-04 11:47:07 -07:00 committed by Jeremy Stanley
parent 97c7c51eef
commit fdff6b292a
4 changed files with 23 additions and 8 deletions

View File

@ -32,7 +32,11 @@ def docs(session):
def venv(session):
session.install("-r", "requirements.txt")
session.install("-r", "test-requirements.txt")
session.install("-e", ".")
# TODO: clean this conditional up once Python 3.6 support is dropped
if session.python == "3.6":
session.install(".")
else:
session.install("-e", ".")
session.run(*session.posargs)
@ -41,7 +45,11 @@ def venv(session):
def tests(session):
session.install("-r", "requirements.txt")
session.install("-r", "test-requirements.txt")
session.install("-e", ".")
# TODO: clean this conditional up once Python 3.6 support is dropped
if session.python == "3.6":
session.install(".")
else:
session.install("-e", ".")
session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest")
@ -50,7 +58,11 @@ def tests(session):
def cover(session):
session.install("-r", "requirements.txt")
session.install("-r", "test-requirements.txt")
session.install("-e", ".")
# TODO: clean this conditional up once Python 3.6 support is dropped
if session.python == "3.6":
session.install(".")
else:
session.install("-e", ".")
session.env["PYTHON"] = "coverage run --source bindep --parallel-mode"
session.run("stestr", "run", *session.posargs)
session.run("stestr", "slowest")

3
pyproject.toml Normal file
View File

@ -0,0 +1,3 @@
[build-system]
requires = ["pbr>=6.1.1"]
build-backend = "pbr.build"

View File

@ -42,8 +42,8 @@ classifier =
Topic :: Utilities
python_requires = >=3.6
[files]
packages = bindep
[options]
py_modules = bindep
[pbr]
warnerrors = True

6
setup.py Executable file → Normal file
View File

@ -14,8 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# TODO: Delete this file once PBR gains the ability to act as a build hook
import setuptools
setuptools.setup(
setup_requires=['pbr'],
pbr=True)
setuptools.setup(pbr=True)