Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions xcengine/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,17 +275,21 @@ def build(
)
with open(self.build_dir / "environment.yml", "w") as fh:
fh.write(yaml.safe_dump(env_def))
build_includes_path = self.build_dir / "build-includes"
build_includes_path = (self.build_dir / "build-includes").resolve()
LOGGER.info(f"Build includes path: {build_includes_path}")
build_includes_path.mkdir()
nb_dir = pathlib.Path(self.notebook).parent
nb_dir = pathlib.Path(self.notebook).resolve().parent
LOGGER.info(f"Notebook directory: {nb_dir}")
if self.build_includes:
for pathspec in self.build_includes:
path = (nb_dir / pathlib.Path(pathspec)).resolve()
LOGGER.info(f"Copying build include: {path}")
if path.is_dir():
if path in build_includes_path.parents:
raise RuntimeError(
f"{build_includes_path} is inside {path} -- "
f"Build includes staging directory "
f"{build_includes_path} is inside build include "
f"source directory {path} -- "
"aborting build to avoid infinite recursive copy."
)
shutil.copytree(path, build_includes_path / path.name)
Expand All @@ -297,10 +301,13 @@ def build(
)
rti_dir = self.build_dir / "runtime-includes"
if self.include_directory:
rti_dir = (self.build_dir / "runtime-includes").resolve()
LOGGER.info(f"Run-time includes directory: {rti_dir}")
if nb_dir in rti_dir.parents:
raise RuntimeError(
"Build directory is inside notebook directory -- "
"aborting build to avoid infinite recursive copy."
f"Run-time include staging directory {rti_dir} "
f"is inside notebook directory {nb_dir} "
"-- aborting build to avoid infinite recursive copy."
)
shutil.copytree(nb_dir, rti_dir, symlinks=True)
else:
Expand Down
Loading