Skip to content

Commit af39f1e

Browse files
authored
Merge pull request #24102 from ianthomas23/simple_pyproject
Simplest pyproject.toml containing build-system only
2 parents b90aba4 + 0e97a90 commit af39f1e

File tree

3 files changed

+26
-10
lines changed

3 files changed

+26
-10
lines changed

.github/workflows/tests.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,13 @@ jobs:
240240
241241
cat mplsetup.cfg
242242
243-
# All dependencies must have been pre-installed, so that the minver
244-
# constraints are held.
245-
python -m pip install --no-deps -ve .
243+
if [[ "${{ matrix.name-suffix }}" == '(Minimum Versions)' ]]; then
244+
# Minimum versions run does not use build isolation so that it
245+
# builds against the pre-installed minver dependencies.
246+
python -m pip install --no-deps --no-build-isolation -ve .
247+
else
248+
python -m pip install --no-deps -ve .
249+
fi
246250
247251
if [[ "${{ runner.os }}" != 'macOS' ]]; then
248252
unset CPPFLAGS

pyproject.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[build-system]
2+
build-backend = "setuptools.build_meta"
3+
requires = [
4+
"certifi>=2020.06.20",
5+
"numpy>=1.19",
6+
"setuptools_scm>=7",
7+
]

setup.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
import setuptools.command.build_py
3535
import setuptools.command.sdist
3636

37+
# sys.path modified to find setupext.py during pyproject.toml builds.
38+
sys.path.append(str(Path(__file__).resolve().parent))
39+
3740
import setupext
3841
from setupext import print_raw, print_status
3942

@@ -68,6 +71,12 @@ def has_flag(self, flagname):
6871

6972
class BuildExtraLibraries(setuptools.command.build_ext.build_ext):
7073
def finalize_options(self):
74+
# If coverage is enabled then need to keep the .o and .gcno files in a
75+
# non-temporary directory otherwise coverage info not collected.
76+
cppflags = os.getenv('CPPFLAGS')
77+
if cppflags and '--coverage' in cppflags:
78+
self.build_temp = 'build'
79+
7180
self.distribution.ext_modules[:] = [
7281
ext
7382
for package in good_packages
@@ -208,8 +217,9 @@ def update_matplotlibrc(path):
208217
class BuildPy(setuptools.command.build_py.build_py):
209218
def run(self):
210219
super().run()
211-
update_matplotlibrc(
212-
Path(self.build_lib, "matplotlib/mpl-data/matplotlibrc"))
220+
if not self.editable_mode:
221+
update_matplotlibrc(
222+
Path(self.build_lib, "matplotlib/mpl-data/matplotlibrc"))
213223

214224

215225
class Sdist(setuptools.command.sdist.sdist):
@@ -300,11 +310,6 @@ def make_release_tree(self, base_dir, files):
300310
package_data=package_data,
301311

302312
python_requires='>={}'.format('.'.join(str(n) for n in py_min_version)),
303-
setup_requires=[
304-
"certifi>=2020.06.20",
305-
"numpy>=1.19",
306-
"setuptools_scm>=7",
307-
],
308313
install_requires=[
309314
"contourpy>=1.0.1",
310315
"cycler>=0.10",

0 commit comments

Comments
 (0)