@@ -85,9 +85,7 @@ def get_miniconda_url(conda_platform, python_version):
8585 raise ValueError ("Unsupported platform %s for conda installation" %
8686 conda_platform )
8787 platform += "-x86_64" if ("64" in conda_platform ) else "-x86"
88- # FIXME: We need to update this our conda tracer to work with conda's newer
89- # than 4.6.14. See gh-443.
90- return "https://repo.continuum.io/miniconda/Miniconda%s-4.6.14-%s.sh" \
88+ return "https://repo.anaconda.com/miniconda/Miniconda%s-latest-%s.sh" \
9189 % (python_version [0 ], platform )
9290
9391
@@ -184,22 +182,22 @@ def install_packages(self, session=None):
184182 # TODO: Determine if we can detect miniconda vs anaconad
185183 miniconda_url = get_miniconda_url (self .platform ,
186184 self .python_version )
187- session .execute_command ("curl %s -o %s/miniconda.sh" %
188- (miniconda_url , tmp_dir ))
185+ session .execute_command (
186+ "curl --fail --silent --show-error --location "
187+ "--output {}/miniconda.sh {}"
188+ .format (tmp_dir , miniconda_url ))
189189 # NOTE: miniconda.sh makes parent directories automatically
190190 session .execute_command ("bash -b %s/miniconda.sh -b -p %s" %
191191 (tmp_dir , self .path ))
192- ## Update root version of conda
193- session .execute_command (
194- "%s/bin/conda install -y conda=%s python=%s" %
195- (self .path , self .conda_version ,
196- self .get_simple_python_version (self .python_version )))
197-
198- # Loop through non-root packages, creating the conda-env config
199- for env in self .environments :
192+ envs = sorted (
193+ self .environments ,
194+ # Create/update the root environment before handling anything
195+ # else.
196+ key = lambda x : "_" if x .name == "root" else "_" + x .name )
197+ for env in envs :
200198 export_contents = self .create_conda_export (env )
201199 with make_tempfile (export_contents ) as local_config :
202- remote_config = os .path .join (tmp_dir , env .name )
200+ remote_config = os .path .join (tmp_dir , env .name + ".yaml" )
203201 session .put (local_config , remote_config )
204202 if not session .isdir (env .path ):
205203 try :
@@ -280,6 +278,7 @@ class CondaTracer(DistributionTracer):
280278
281279 def _init (self ):
282280 self ._get_conda_env_path = PathRoot (self ._is_conda_env_path )
281+ self ._get_conda_dist_path = PathRoot (self ._is_conda_dist_path )
283282
284283 def _get_packagefields_for_files (self , files ):
285284 raise NotImplementedError ("TODO" )
@@ -335,20 +334,27 @@ def _get_conda_pip_package_details(self, env_export, conda_path):
335334
336335 # If there are pip dependencies, they'll be listed under a
337336 # {"pip": [...]} entry.
338- pip_pkgs = []
337+ pip_pkgs = set ()
339338 for dep in dependencies :
340339 if isinstance (dep , dict ) and "pip" in dep :
341340 # Pip packages are recorded in conda exports as "name (loc)",
342341 # "name==version" or "name (loc)==version".
343- pip_pkgs = [ p .split ("=" )[0 ].split (" " )[0 ] for p in dep ["pip" ]]
342+ pip_pkgs = { p .split ("=" )[0 ].split (" " )[0 ] for p in dep ["pip" ]}
344343 break
345344
345+ pip = conda_path + "/bin/pip"
346+ if not self ._session .exists (pip ):
347+ return {}, {}
348+
349+ pkgs_editable = set (piputils .get_pip_packages (
350+ self ._session , pip , restriction = "editable" ))
351+ pip_pkgs .update (pkgs_editable )
352+
346353 if not pip_pkgs :
347354 return {}, {}
348355
349- pip = conda_path + "/bin/pip"
350356 packages , file_to_package_map = piputils .get_package_details (
351- self ._session , pip , pip_pkgs )
357+ self ._session , pip , pip_pkgs , editable_packages = pkgs_editable )
352358 for entry in packages .values ():
353359 entry ["installer" ] = "pip"
354360 return packages , file_to_package_map
@@ -391,6 +397,10 @@ def _get_conda_info(self, conda_path):
391397 def _is_conda_env_path (self , path ):
392398 return self ._session .exists ('%s/conda-meta' % path )
393399
400+ def _is_conda_dist_path (self , path ):
401+ return (self ._session .exists (path + "/envs" )
402+ and self ._is_conda_env_path (path ))
403+
394404 def identify_distributions (self , paths ):
395405 conda_paths = set ()
396406 root_to_envs = defaultdict (list )
@@ -417,8 +427,7 @@ def identify_distributions(self, paths):
417427 # Find the root path for the environment
418428 # TODO: cache/memoize for those paths which have been considered
419429 # since will be asked again below
420- conda_info = self ._get_conda_info (conda_path )
421- root_path = conda_info .get ('root_prefix' )
430+ root_path = self ._get_conda_dist_path (conda_path )
422431 if not root_path :
423432 lgr .warning ("Could not find root path for conda environment %s"
424433 % conda_path )
0 commit comments