diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0c5b7a08ced5..fd6eac7ce279 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -240,9 +240,13 @@ jobs: cat mplsetup.cfg - # All dependencies must have been pre-installed, so that the minver - # constraints are held. - python -m pip install --no-deps -ve . + if [[ "${{ matrix.name-suffix }}" == '(Minimum Versions)' ]]; then + # Minimum versions run does not use build isolation so that it + # builds against the pre-installed minver dependencies. + python -m pip install --no-deps --no-build-isolation -ve . + else + python -m pip install --no-deps -ve . + fi if [[ "${{ runner.os }}" != 'macOS' ]]; then unset CPPFLAGS diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000000..ef70e1893299 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,7 @@ +[build-system] +build-backend = "setuptools.build_meta" +requires = [ + "certifi>=2020.06.20", + "numpy>=1.19", + "setuptools_scm>=7", +] diff --git a/setup.py b/setup.py index d1f1de7078ff..a460718684a8 100644 --- a/setup.py +++ b/setup.py @@ -34,6 +34,9 @@ import setuptools.command.build_py import setuptools.command.sdist +# sys.path modified to find setupext.py during pyproject.toml builds. +sys.path.append(str(Path(__file__).resolve().parent)) + import setupext from setupext import print_raw, print_status @@ -68,6 +71,12 @@ def has_flag(self, flagname): class BuildExtraLibraries(setuptools.command.build_ext.build_ext): def finalize_options(self): + # If coverage is enabled then need to keep the .o and .gcno files in a + # non-temporary directory otherwise coverage info not collected. + cppflags = os.getenv('CPPFLAGS') + if cppflags and '--coverage' in cppflags: + self.build_temp = 'build' + self.distribution.ext_modules[:] = [ ext for package in good_packages @@ -208,8 +217,9 @@ def update_matplotlibrc(path): class BuildPy(setuptools.command.build_py.build_py): def run(self): super().run() - update_matplotlibrc( - Path(self.build_lib, "matplotlib/mpl-data/matplotlibrc")) + if not self.editable_mode: + update_matplotlibrc( + Path(self.build_lib, "matplotlib/mpl-data/matplotlibrc")) class Sdist(setuptools.command.sdist.sdist): @@ -300,11 +310,6 @@ def make_release_tree(self, base_dir, files): package_data=package_data, python_requires='>={}'.format('.'.join(str(n) for n in py_min_version)), - setup_requires=[ - "certifi>=2020.06.20", - "numpy>=1.19", - "setuptools_scm>=7", - ], install_requires=[ "contourpy>=1.0.1", "cycler>=0.10",