summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam J. Stewart <ajstewart426@gmail.com>2020-05-18 09:57:51 -0500
committerGitHub <noreply@github.com>2020-05-18 09:57:51 -0500
commit2d464f69f85f6bc212ee36ab45c096894de7be33 (patch)
tree653bc0b78c62f880e5c22ab09709ea1e025b1af0
parentce8cf5d9b037079ae3fd77fcaf84cf2eafbc9fbd (diff)
downloadspack-2d464f69f85f6bc212ee36ab45c096894de7be33.tar.gz
spack-2d464f69f85f6bc212ee36ab45c096894de7be33.tar.bz2
spack-2d464f69f85f6bc212ee36ab45c096894de7be33.tar.xz
spack-2d464f69f85f6bc212ee36ab45c096894de7be33.zip
PyYAML: fix linking to libyaml (#16682)
-rw-r--r--var/spack/repos/builtin/packages/py-pyyaml/package.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/var/spack/repos/builtin/packages/py-pyyaml/package.py b/var/spack/repos/builtin/packages/py-pyyaml/package.py
index 2b00de2d9b..00b3d848b7 100644
--- a/var/spack/repos/builtin/packages/py-pyyaml/package.py
+++ b/var/spack/repos/builtin/packages/py-pyyaml/package.py
@@ -11,6 +11,9 @@ class PyPyyaml(PythonPackage):
homepage = "https://pyyaml.org/wiki/PyYAML"
url = "https://pypi.io/packages/source/P/PyYAML/PyYAML-5.3.1.tar.gz"
+ git = "https://github.com/yaml/pyyaml.git"
+
+ maintainers = ['adamjstewart']
version('5.3.1', sha256='b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d')
version('5.1.2', sha256='01adf0b6c6f61bd11af6e10ca52b7d4057dd0be0343eb9283c878cf3af56aee4')
@@ -24,6 +27,17 @@ class PyPyyaml(PythonPackage):
depends_on('python@2.7:2.8,3.5:', type=('build', 'run'))
depends_on('libyaml', when='+libyaml')
+ phases = ['build_ext', 'install']
+
+ @property
+ def import_modules(self):
+ modules = ['yaml']
+
+ if '+libyaml' in self.spec:
+ modules.append('yaml.cyaml')
+
+ return modules
+
def setup_py(self, *args, **kwargs):
# Cast from tuple to list
args = list(args)
@@ -34,3 +48,21 @@ class PyPyyaml(PythonPackage):
args.insert(0, '--without-libyaml')
super(PyPyyaml, self).setup_py(*args, **kwargs)
+
+ def build_ext_args(self, spec, prefix):
+ args = []
+
+ if '+libyaml' in spec:
+ args.extend([
+ spec['libyaml'].libs.search_flags,
+ spec['libyaml'].headers.include_flags,
+ ])
+
+ return args
+
+ # Tests need to be re-added since `phases` was overridden
+ run_after('build_ext')(
+ PythonPackage._run_default_build_time_test_callbacks)
+ run_after('install')(
+ PythonPackage._run_default_install_time_test_callbacks)
+ run_after('install')(PythonPackage.sanity_check_prefix)