Skip to content

Commit dcd7ddf

Browse files
committed
Handle crates in subfolders
The Cargo.toml file might contain: ``` [workspace] members = ["components/salsa-macro-rules", "components/salsa-macros"] ``` This means we need to move the 2 subfolders of components and NOT the components folder into the vendor root-directory so they are found. Hence use `basename` for determining the target path which is a no-op when no folder is present.
1 parent 9188602 commit dcd7ddf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

easybuild/easyblocks/generic/cargo.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ def _setup_offline_config(self, git_sources):
374374
tmp_crate_dir = os.path.join(tmp_dir, os.path.basename(crate_dir))
375375
shutil.move(crate_dir, tmp_crate_dir)
376376
for crate in member_dirs:
377-
target_path = os.path.join(self.vendor_dir, crate)
377+
# A member crate might be in a subfolder, e.g. 'components/foo',
378+
# which we need to ignore and make the crate a top-level folder.
379+
target_path = os.path.join(self.vendor_dir, os.path.basename(crate))
378380
if os.path.exists(target_path):
379381
raise EasyBuildError(f'Cannot move {crate} out of {os.path.basename(crate_dir)} '
380382
f'as target path {target_path} exists')

0 commit comments

Comments
 (0)