Merge pull request #3632 from jmchilton/conda_43_fix

[17.01] Fix Conda --offline logic for bug in 4.0,4.1,4.3.
This commit is contained in:
Martin Cech
2017-02-20 12:06:13 -05:00
committed by GitHub
3 changed files with 68 additions and 1 deletions
+45 -1
View File
@@ -82,6 +82,41 @@ class CondaContext(installable.InstallableContext):
ensure_channels = None
self.ensure_channels = ensure_channels
self.ensured_channels = False
self._conda_version = None
self._miniconda_version = None
@property
def conda_version(self):
if self._conda_version is None:
self._guess_conda_version()
return self._conda_version
def _guess_conda_version(self):
conda_meta_path = self._conda_meta_path
# Perhaps we should call "conda info --json" and parse it but for now we are going
# to assume the default.
conda_version = LooseVersion(CONDA_VERSION)
miniconda_version = "3"
if os.path.exists(conda_meta_path):
for package in os.listdir(conda_meta_path):
package_parts = package.split("-")
if len(package_parts) < 3:
continue
package = '-'.join(package_parts[:-2])
version = package_parts[-2]
# build = package_parts[-1]
if package == "conda":
conda_version = LooseVersion(version)
if package == "python" and version.startswith("2"):
miniconda_version = "2"
self._conda_version = conda_version
self._miniconda_version = miniconda_version
@property
def _conda_meta_path(self):
return os.path.join(self.conda_prefix, "conda-meta")
def ensure_channels_configured(self):
if not self.ensured_channels:
@@ -495,7 +530,16 @@ def build_isolated_environment(
export_path
)
export_paths.append(export_path)
create_args = ["--unknown", "--offline"]
create_args = ["--unknown"]
# Works in 3.19, 4.0 - 4.2 - not in 4.3.
# Adjust fix if they fix Conda - xref
# - https://github.com/galaxyproject/galaxy/issues/3635
# - https://github.com/conda/conda/issues/2035
offline_works = conda_context.conda_version < LooseVersion("4.3")
if offline_works:
create_args.extend(["--offline"])
else:
create_args.extend(["--use-index-cache"])
if path is None:
create_args.extend(["--name", tempdir_name])
else:
@@ -0,0 +1,22 @@
<tool id="mulled_example_multi_incomplete" name="mulled_example_multi_incomplete" version="0.1.0">
<command><![CDATA[
bedtools --version > $out_file1 ;
echo "Moo" >> $out_file1 ;
samtools >> $out_file1 2>&1 ;
echo "Cow" >> $out_file1 ;
]]></command>
<requirements>
<requirement type="package" version="1.3.1">samtools</requirement>
<requirement type="package" version="2.26.0">bedtools</requirement>
<!-- Because the Conda resolver will fail to install all three of these together
it will need to build a per-job environment out of just the first two.
-->
<requirement type="package" version="4.5">notarealpackage</requirement>
</requirements>
<inputs>
<param name="input1" type="data" optional="true" />
</inputs>
<outputs>
<data name="out_file1" format="txt" />
</outputs>
</tool>
@@ -128,6 +128,7 @@
<!-- Tools for dependency and container testing. -->
<tool file="legacy_r.xml" />
<tool file="mulled_example_multi_1.xml" />
<tool file="mulled_example_multi_incomplete.xml" />
<tool file="mulled_example_conflict.xml" />
<tool file="simple_constructs.yml" />