Skip to content
This repository has been archived by the owner on Jan 31, 2019. It is now read-only.

Commit

Permalink
Simplified the fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelson committed Oct 26, 2015
1 parent e671ef2 commit c823b06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions obvci/conda_tools/from_conda_manifest_core_vn_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,19 +119,24 @@ def special_case_version_matrix(meta, index):
"""
r = conda.resolve.Resolve(index)
requirements = meta.get_value('requirements/run', [])
requirements = meta.get_value('requirements/build', [])
requirement_specs = {MatchSpec(spec).name: MatchSpec(spec)
for spec in requirements}
run_requirements = meta.get_value('requirements/run', [])
run_requirement_specs = {MatchSpec(spec).name: MatchSpec(spec)
for spec in run_requirements}


# Thanks to https://github.com/conda/conda-build/pull/493 we no longer need to
# compute the complex matrix for numpy versions unless a specific version has
# been defined.
np_spec = requirement_specs.get('numpy')
if np_spec and np_spec.spec == 'numpy':
np_run_spec = run_requirement_specs.get('numpy')
if np_spec and np_run_spec and 'x.x' not in np_run_spec.spec:
# A simple spec (just numpy) has been defined, so we can drop it from the
# special cases.
requirement_specs.pop('numpy')

for pkg in requirement_specs:
spec = requirement_specs[pkg]
# We want to bake the version in, but we don't know what it is yet.
Expand Down
3 changes: 2 additions & 1 deletion obvci/tests/unit/conda/test_BakedDistribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_py_xx_version(self):
version: 2
requirements:
build:
- python
- python >=2.7
- numpy
run:
- python x.x
Expand All @@ -71,6 +71,7 @@ def test_py_xx_version(self):

index = {'python-2.7-0.tar.bz2': {'name': 'python', 'version': '2.7', 'build_number': 0}}
self.index.add_pkg('python', '2.7.2')
self.index.add_pkg('python', '2.6.2')
self.index.add_pkg('python', '3.5.0')
self.index.add_pkg('numpy', '1.8.0', depends=['python'])
r = BakedDistribution.compute_matrix(meta, self.index)
Expand Down

0 comments on commit c823b06

Please sign in to comment.