summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoward Pritchard <hppritcha@gmail.com>2024-05-16 07:18:44 -0700
committerGitHub <noreply@github.com>2024-05-16 16:18:44 +0200
commite6f04d5ef9784799095642c596ca4e7b83484a62 (patch)
tree863e0fdb2b72ce962dad2f25010864a02d47a0fc
parentb8e3ecbf00a8e049267585f1a83c3bab33abeea3 (diff)
downloadspack-e6f04d5ef9784799095642c596ca4e7b83484a62.tar.gz
spack-e6f04d5ef9784799095642c596ca4e7b83484a62.tar.bz2
spack-e6f04d5ef9784799095642c596ca4e7b83484a62.tar.xz
spack-e6f04d5ef9784799095642c596ca4e7b83484a62.zip
py-matplotlib: qualify when to do a post install (#44191)
* py-matplotlib: qualify when to do a post install Older versions of py-matplotlib don't seem to have some of the files that the post install step is trying to install. Looks like the files first appeared in 3.6.0 and later. Signed-off-by: Howard Pritchard <hppritcha@gmail.com> * Change install paths for older matplotlib --------- Signed-off-by: Howard Pritchard <hppritcha@gmail.com> Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
-rw-r--r--var/spack/repos/builtin/packages/py-matplotlib/package.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/var/spack/repos/builtin/packages/py-matplotlib/package.py b/var/spack/repos/builtin/packages/py-matplotlib/package.py
index 033fc6de53..4a773c06b7 100644
--- a/var/spack/repos/builtin/packages/py-matplotlib/package.py
+++ b/var/spack/repos/builtin/packages/py-matplotlib/package.py
@@ -331,16 +331,23 @@ class PyMatplotlib(PythonPackage):
config.write("enable_lto = False\n")
@run_after("install")
+ @on_package_attributes(run_tests=True)
def copy_reference_images(self):
# https://matplotlib.org/devdocs/devel/testing.html#obtain-the-reference-images
install_tree(
join_path("lib", "matplotlib", "tests", "baseline_images"),
join_path(python_platlib, "matplotlib", "tests", "baseline_images"),
)
- for toolkit in ["axes_grid1", "axisartist", "mplot3d"]:
+ if self.spec.satisfies("@3.7:"):
+ for toolkit in ["axes_grid1", "axisartist", "mplot3d"]:
+ install_tree(
+ join_path("lib", "mpl_toolkits", toolkit, "tests", "baseline_images"),
+ join_path(python_platlib, "mpl_toolkits", toolkit, "tests", "baseline_images"),
+ )
+ else:
install_tree(
- join_path("lib", "mpl_toolkits", toolkit, "tests", "baseline_images"),
- join_path(python_platlib, "mpl_toolkits", toolkit, "tests", "baseline_images"),
+ join_path("lib", "mpl_toolkits", "tests", "baseline_images"),
+ join_path(python_platlib, "mpl_toolkits", "tests", "baseline_images"),
)
@run_after("install")
@@ -348,5 +355,8 @@ class PyMatplotlib(PythonPackage):
def install_test(self):
# https://matplotlib.org/devdocs/devel/testing.html#run-the-tests
python("-m", "pytest", "--pyargs", "matplotlib.tests")
- for toolkit in ["axes_grid1", "axisartist", "mplot3d"]:
- python("-m", "pytest", "--pyargs", f"mpl_toolkits.{toolkit}.tests")
+ if self.spec.satisfies("@3.7:"):
+ for toolkit in ["axes_grid1", "axisartist", "mplot3d"]:
+ python("-m", "pytest", "--pyargs", f"mpl_toolkits.{toolkit}.tests")
+ else:
+ python("-m", "pytest", "--pyargs", "mpl_toolkits.tests")