Fixed _packages_from_json

This commit is contained in:
romainx
2020-03-12 22:02:44 +01:00
parent fbea8a6f12
commit 18bf282a2b
3 changed files with 18 additions and 6 deletions

View File

@@ -94,3 +94,5 @@ tx-en: ## rebuild en locale strings and push to master (req: GH_TOKEN)
test/%: ## run tests against a stack (only common tests or common tests + specific tests) test/%: ## run tests against a stack (only common tests or common tests + specific tests)
@if [ ! -d "$(notdir $@)/test" ]; then TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest -m "not info" test; \ @if [ ! -d "$(notdir $@)/test" ]; then TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest -m "not info" test; \
else TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest -m "not info" test $(notdir $@)/test; fi else TEST_IMAGE="$(OWNER)/$(notdir $@)" pytest -m "not info" test $(notdir $@)/test; fi
test-all: $(foreach I,$(ALL_IMAGES),test/$(I)) ## test all stacks

View File

@@ -88,10 +88,21 @@ class CondaPackageHelper:
def _packages_from_json(env_export): def _packages_from_json(env_export):
"""Extract packages and versions from the lines returned by the list of specifications""" """Extract packages and versions from the lines returned by the list of specifications"""
dependencies = json.loads(env_export).get("dependencies") dependencies = json.loads(env_export).get("dependencies")
# FIXME: # shall be able to parse conda-forge::blas[build=openblas] without considering openblas as the version packages_dict = dict()
packages_list = map(lambda x: x.split("=", 1), dependencies) for split in map(lambda x: x.split("=", 1), dependencies):
# TODO: could be improved # default values
return {package[0]: set(package[1:]) for package in packages_list} package = split[0]
version = set()
# cheking if it's a proper version by testing if the first char is a digit
if len(split) > 1:
if split[1][0].isdigit():
# package + version case
version = set(split[1:])
else:
# The split was incorrect and the package shall not be splitted
package = f"{split[0]}={split[1]}"
packages_dict[package] = version
return packages_dict
def available_packages(self): def available_packages(self):
"""Return the available packages""" """Return the available packages"""

View File

@@ -63,8 +63,7 @@ EXCLUDED_PACKAGES = [
"tini", "tini",
"python", "python",
"hdf5", "hdf5",
# FIXME: shall be parsed as conda-forge::blas[build=openblas] "conda-forge::blas[build=openblas]",
"conda-forge::blas[build",
"protobuf", "protobuf",
"r-irkernel", "r-irkernel",
"unixodbc", "unixodbc",