diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2015-12-22 08:25:52 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2015-12-22 08:25:52 -0800 |
commit | b1d40efd99a08b9a3fc117a375f6c0d1ef3b32a8 (patch) | |
tree | 372b0069f7f624cf5386edc3ecb101c53eb2b298 | |
parent | 5bcec9289e1f8e7bc06adf228c08d61c677f3d8a (diff) | |
parent | fe0fdf60b46716fa20318c627ea80ff4e3398263 (diff) | |
download | spack-b1d40efd99a08b9a3fc117a375f6c0d1ef3b32a8.tar.gz spack-b1d40efd99a08b9a3fc117a375f6c0d1ef3b32a8.tar.bz2 spack-b1d40efd99a08b9a3fc117a375f6c0d1ef3b32a8.tar.xz spack-b1d40efd99a08b9a3fc117a375f6c0d1ef3b32a8.zip |
Merge pull request #261 from LLNL/features/prefer-versions-in-packages
Add ability to prefer particular versions in packages.
-rw-r--r-- | lib/spack/spack/concretize.py | 11 | ||||
-rw-r--r-- | var/spack/packages/python/package.py | 2 |
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/spack/spack/concretize.py b/lib/spack/spack/concretize.py index d9419da784..85cdb202d5 100644 --- a/lib/spack/spack/concretize.py +++ b/lib/spack/spack/concretize.py @@ -40,7 +40,6 @@ import spack.error from spack.version import * - class DefaultConcretizer(object): """This class doesn't have any state, it just provides some methods for concretization. You can subclass it to override just some of the @@ -68,9 +67,17 @@ class DefaultConcretizer(object): # If there are known available versions, return the most recent # version that satisfies the spec pkg = spec.package + + # Key function to sort versions first by whether they were + # marked `preferred=True`, then by most recent. + def preferred_key(v): + prefer = pkg.versions[v].get('preferred', False) + return (prefer, v) + valid_versions = sorted( [v for v in pkg.versions - if any(v.satisfies(sv) for sv in spec.versions)]) + if any(v.satisfies(sv) for sv in spec.versions)], + key=preferred_key) if valid_versions: spec.versions = ver([valid_versions[-1]]) diff --git a/var/spack/packages/python/package.py b/var/spack/packages/python/package.py index 30e6ef6bb8..0da7f4ce89 100644 --- a/var/spack/packages/python/package.py +++ b/var/spack/packages/python/package.py @@ -17,7 +17,7 @@ class Python(Package): version('2.7.8', 'd235bdfa75b8396942e360a70487ee00') version('2.7.10', 'c685ef0b8e9f27b5e3db5db12b268ac6') - version('2.7.11', '1dbcc848b4cd8399a8199d000f9f823c') + version('2.7.11', '1dbcc848b4cd8399a8199d000f9f823c', preferred=True) version('3.5.0', 'd149d2812f10cbe04c042232e7964171') version('3.5.1', 'e9ea6f2623fffcdd871b7b19113fde80') |