From a91860caf6a5c310327a5142fe509ee35f6a34b6 Mon Sep 17 00:00:00 2001 From: nicoo Date: Mon, 28 Dec 2020 17:56:04 +0100 Subject: [PATCH 1/6] builder: Replace library pep517 with build Using pep517 through its CLI entrypoint is not recommended. Closes: #197 --- bork/builder.py | 9 ++++----- setup.cfg | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bork/builder.py b/bork/builder.py index 0a14c65..49420c9 100644 --- a/bork/builder.py +++ b/bork/builder.py @@ -4,7 +4,7 @@ # Slight kludge so we can have a function named zipapp(). import zipapp as Zipapp # noqa: N812 -import pep517.build # type: ignore +import build import toml from .filesystem import load_setup_cfg, try_delete @@ -19,10 +19,9 @@ def dist(): """Build the sdist and wheel distributions.""" - # We can use the pep517 library to add separate source and binary build - # functions, but I'm leaving that alone unless someone asks for it. - args = ['--source', '--binary'] - pep517.build.main(pep517.build.parser.parse_args(['.', *args])) + builder = build.ProjectBuilder('.') + builder.build('sdist', './dist/') + builder.build('wheel', './dist/') def _package_name(): diff --git a/setup.cfg b/setup.cfg index c1a2991..aa731b3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,9 +27,9 @@ python_requires = >=3.6 # The importlib_metadata library is required by Twine for Python 3.7 and # earlier, but we pull it in unconditionally so the zipapp is version-agnostic. install_requires = + build==0.1.0 packaging==20.8 toml==0.10.2 - pep517==0.9.1 twine==3.3.0 click==7.1.2 coloredlogs==15.0 From 084f48b2328eb6c9698c20960f1d625b8c6f582d Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 30 Dec 2020 10:59:54 +0100 Subject: [PATCH 2/6] setup.cfg: Make wheel an explicit dependency Otherwise, binary wheel packages cannot be built. --- setup.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.cfg b/setup.cfg index aa731b3..52687f3 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,6 +27,7 @@ python_requires = >=3.6 # The importlib_metadata library is required by Twine for Python 3.7 and # earlier, but we pull it in unconditionally so the zipapp is version-agnostic. install_requires = + wheel==0.36.2 build==0.1.0 packaging==20.8 toml==0.10.2 From 9e3efc15acc2900000e8c198972fac523c2fca85 Mon Sep 17 00:00:00 2001 From: nicoo Date: Wed, 30 Dec 2020 13:14:27 +0100 Subject: [PATCH 3/6] builder.dist: Create the output directory before building This is necessary, as `build` otherwise fails on macOS. --- bork/builder.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bork/builder.py b/bork/builder.py index 49420c9..65819e4 100644 --- a/bork/builder.py +++ b/bork/builder.py @@ -20,6 +20,7 @@ def dist(): """Build the sdist and wheel distributions.""" builder = build.ProjectBuilder('.') + (Path.cwd() / 'dist').mkdir(mode=0o755, exist_ok=True) builder.build('sdist', './dist/') builder.build('wheel', './dist/') From cd95def46ddf9ee68c2f09c1b7c4ab756afc7e21 Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 1 Jan 2021 19:35:41 +0100 Subject: [PATCH 4/6] Require setuptools 42 or later to build Bork Older versions are buggy on macOS; see pypa/build#108 --- .cirrus.yml | 1 + pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index fe78245..066ce18 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -78,6 +78,7 @@ macOS_task: - pyenv install ${PYTHON} - pyenv global ${PYTHON} - pyenv rehash + - pip install -U --upgrade-strategy eager pip 'setuptools>42' - pip install -e .[testing] script: - python3 --version diff --git a/pyproject.toml b/pyproject.toml index 4b12f46..85c52cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] # Specify the required build system. -requires = ["setuptools", "wheel"] +requires = ["setuptools > 42", "wheel"] build-backend = "setuptools.build_meta" [tool.bork] From 45bb8645be283018d21d4f1570927a72c027f08f Mon Sep 17 00:00:00 2001 From: nicoo Date: Fri, 1 Jan 2021 22:19:50 +0100 Subject: [PATCH 5/6] CI: Update pip and setuptools on all platforms before doing anything Obsolete setuptools was the cause of a CI bug on macOS, see previous commit. --- .cirrus.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 066ce18..8c23f3a 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -11,6 +11,7 @@ Lint_task: container: image: python:3.8-slim install_script: + - pip install -U --upgrade-strategy eager pip 'setuptools>42' - pip install . - pip install .[testing] script: @@ -23,6 +24,7 @@ Zipapp_bootstrap_task: image: python:3.7-slim image: python:3.8-slim setup_script: + - pip install -U --upgrade-strategy eager pip 'setuptools>42' - cp -r . /tmp/bork-pristine - cp -r /tmp/bork-pristine /tmp/pass1 - cp -r /tmp/bork-pristine /tmp/pass2 @@ -56,6 +58,7 @@ Linux_task: install_script: - apt-get update - apt-get install -y git + - pip install -U --upgrade-strategy eager pip 'setuptools>42' - pip install . .[testing] script: - python3 --version @@ -95,6 +98,7 @@ FreeBSD_task: - PY=`echo $PYTHON | tr -d '.'` - pkg install -y python${PY} py${PY}-setuptools git - python${PYTHON} -m ensurepip + - python${PYTHON} -m pip install -U --upgrade-strategy eager pip 'setuptools>42' - python${PYTHON} -m pip install -e .[testing_only] script: - python${PYTHON} --version @@ -134,6 +138,7 @@ Release_task: install_script: - apt-get update - apt-get install -y git + - pip install -U --upgrade-strategy eager pip 'setuptools>42' - pip3 install . .[testing] build_script: - bork clean From b471896b1e944bdd3515dcea1a1da876dd260ef6 Mon Sep 17 00:00:00 2001 From: nicoo Date: Sat, 2 Jan 2021 14:34:44 +0100 Subject: [PATCH 6/6] Revert "builder.dist: Create the output directory before building" This reverts commit 9e3efc15acc2900000e8c198972fac523c2fca85. --- bork/builder.py | 1 - 1 file changed, 1 deletion(-) diff --git a/bork/builder.py b/bork/builder.py index 65819e4..49420c9 100644 --- a/bork/builder.py +++ b/bork/builder.py @@ -20,7 +20,6 @@ def dist(): """Build the sdist and wheel distributions.""" builder = build.ProjectBuilder('.') - (Path.cwd() / 'dist').mkdir(mode=0o755, exist_ok=True) builder.build('sdist', './dist/') builder.build('wheel', './dist/')