Fix conda support for git+http links

This commit is contained in:
allegroai 2021-02-23 12:46:06 +02:00
parent 0caf31719c
commit 2006ab20dd
2 changed files with 7 additions and 5 deletions

View File

@ -505,6 +505,8 @@ class CondaAPI(PackageManager):
reqs.append(m) reqs.append(m)
# if we have a conda list, the rest should be installed with pip, # if we have a conda list, the rest should be installed with pip,
# this means any experiment that was executed with pip environment,
# will be installed using pip
if requirements.get('conda', None) is not None: if requirements.get('conda', None) is not None:
for r in requirements['pip']: for r in requirements['pip']:
try: try:
@ -518,7 +520,7 @@ class CondaAPI(PackageManager):
# skip over local files (we cannot change the version to a local file) # skip over local files (we cannot change the version to a local file)
if m.local_file: if m.local_file:
continue continue
m_name = m.name.lower() m_name = (m.name or '').lower()
if m_name in conda_supported_req_names: if m_name in conda_supported_req_names:
# this package is in the conda list, # this package is in the conda list,
# make sure that if we changed version and we match it in conda # make sure that if we changed version and we match it in conda
@ -555,7 +557,7 @@ class CondaAPI(PackageManager):
# conform conda packages (version/name) # conform conda packages (version/name)
for r in reqs: for r in reqs:
# change _ to - in name but not the prefix _ (as this is conda prefix) # change _ to - in name but not the prefix _ (as this is conda prefix)
if not r.name.startswith('_') and not requirements.get('conda', None): if r.name and not r.name.startswith('_') and not requirements.get('conda', None):
r.name = r.name.replace('_', '-') r.name = r.name.replace('_', '-')
# remove .post from version numbers, it fails ~= version, and change == to ~= # remove .post from version numbers, it fails ~= version, and change == to ~=
if r.specs and r.specs[0]: if r.specs and r.specs[0]:

View File

@ -7,7 +7,7 @@ import re
import subprocess import subprocess
import sys import sys
from contextlib import contextmanager from contextlib import contextmanager
from copy import deepcopy from copy import copy
from distutils.spawn import find_executable from distutils.spawn import find_executable
from itertools import chain, repeat, islice from itertools import chain, repeat, islice
from os.path import devnull from os.path import devnull
@ -276,9 +276,9 @@ class CommandSequence(Executable):
self.commands = [] self.commands = []
for c in commands: for c in commands:
if isinstance(c, CommandSequence): if isinstance(c, CommandSequence):
self.commands.extend(deepcopy(c.commands)) self.commands.extend([copy(p) for p in c.commands])
elif isinstance(c, Argv): elif isinstance(c, Argv):
self.commands.append(deepcopy(c)) self.commands.append(copy(c))
else: else:
self.commands.append(Argv(*c, log=self._log)) self.commands.append(Argv(*c, log=self._log))