Skip to content

Commit bc9d2ac

Browse files
Store lockfile-relative sources in lockfiles, unless on different drives
* Fixes conda#229, relying on what introduced in conda#204 for the input metadata, by explicitly handling only the case of different drives for keeping absolute paths, addressing conda#175.
1 parent 1c3f987 commit bc9d2ac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

conda_lock/conda_lock.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -809,15 +809,15 @@ def create_lockfile_from_spec(
809809
for dep in deps:
810810
locked[(dep.manager, dep.name, dep.platform)] = dep
811811

812-
spec_sources: Dict[str, pathlib.Path] = {}
812+
meta_sources: Dict[str, pathlib.Path] = {}
813813
for source in spec.sources:
814814
try:
815815
path = relative_path(lockfile_path.parent, source)
816816
except ValueError as e:
817817
if "Paths don't have the same drive" not in str(e):
818818
raise e
819819
path = str(source.resolve())
820-
spec_sources[path] = source
820+
meta_sources[path] = source
821821

822822
if MetadataOption.TimeStamp in metadata_choices:
823823
time_metadata = TimeMeta.create()
@@ -842,10 +842,10 @@ def create_lockfile_from_spec(
842842

843843
if metadata_choices & {MetadataOption.InputSha, MetadataOption.InputMd5}:
844844
inputs_metadata: Optional[Dict[str, InputMeta]] = {
845-
relative_path: InputMeta.create(
845+
meta_src: InputMeta.create(
846846
metadata_choices=metadata_choices, src_file=src_file
847847
)
848-
for relative_path, src_file in spec_sources.items()
848+
for meta_src, src_file in meta_sources.items()
849849
}
850850
else:
851851
inputs_metadata = None
@@ -858,7 +858,7 @@ def create_lockfile_from_spec(
858858
content_hash=spec.content_hash(),
859859
channels=[c for c in spec.channels],
860860
platforms=spec.platforms,
861-
sources=[str(source.resolve()) for source in spec.sources],
861+
sources=list(meta_sources.keys()),
862862
git_metadata=git_metadata,
863863
time_metadata=time_metadata,
864864
inputs_metadata=inputs_metadata,

0 commit comments

Comments
 (0)