Skip to content

Commit

Permalink
scripts: move files instead of copying them
Browse files Browse the repository at this point in the history
  • Loading branch information
seppzer0 committed Nov 10, 2023
1 parent a3f8c5d commit 0de0ad2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
14 changes: 5 additions & 9 deletions scripts/multi_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ def parse_args() -> None:
return parser.parse_args()


def ucopy(src: Path, dst: Path) -> None:
"""A universal method to copy files into desired destinations.
def rmove(src: Path, dst: Path) -> None:
"""Recusrively move files from one directory to another.
:param src: Source path.
:param dst: Destination path.
:param exceptions: Elements that will not be removed.
"""
# for a directory (it's contents)
if src.is_dir():
Expand All @@ -33,13 +32,10 @@ def ucopy(src: Path, dst: Path) -> None:
if e != src:
src_e = Path(src, e)
dst_e = Path(dst, e)
if src_e.is_dir():
shutil.copytree(src_e, dst_e)
elif src_e.is_file():
shutil.copy(src_e, dst_e)
shutil.move(src_e, dst_e)
# for a single file
elif src.is_file():
shutil.copy(src, dst)
shutil.move(src, dst)


def main(args: argparse.Namespace) -> None:
Expand Down Expand Up @@ -100,7 +96,7 @@ def main(args: argparse.Namespace) -> None:
out = "kernel"
case "assets":
out = "assets"
ucopy(Path(out), Path(dir_shared))
rmove(Path(out), Path(dir_shared))


if __name__ == "__main__":
Expand Down
3 changes: 1 addition & 2 deletions wrapper/engines/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,7 @@ def _build(self) -> None:
msg.note(f"Building the {alias} image..")
os.chdir(self._wdir_local)
# build only if it is not present in local cache
#if self._name_image not in ccmd.launch(f"{self._buildenv} image list --format '{{.Repository}}'", get_output=True):
if 1 == 1:
if self._name_image not in ccmd.launch(f"{self._buildenv} image list --format '{{.Repository}}'", get_output=True):
# force enable Docker Buildkit
if self._buildenv == "docker":
os.environ["DOCKER_BUILDKIT"] = "1"
Expand Down

0 comments on commit 0de0ad2

Please sign in to comment.