Skip to content

Commit

Permalink
Remove directories in /bin when ensuring portability (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
neilmehta24 authored Jan 9, 2025
1 parent 235ce3b commit 036d4e2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ See the fragment files in the `changelog.d directory`_.

.. scriv-insert-here
Fixed
-----

- Remove directories from /bin when building layers

.. _changelog-0.2.1:

0.2.1 — 2024-12-05
Expand Down
11 changes: 7 additions & 4 deletions src/venvstacks/stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1388,10 +1388,13 @@ def _create_new_environment(self, *, lock_only: bool = False) -> None:
def _ensure_portability(self) -> None:
# Wrapper and activation scripts are not used on deployment targets,
# so drop them entirely rather than making them portable
for executable in self.executables_path.iterdir():
if not executable.name.lower().startswith("python"):
print(f" Dropping potentially non-portable file {str(executable)!r}")
executable.unlink()
for item in self.executables_path.iterdir():
if item.is_dir():
print(f" Dropping directory {str(item)!r}")
shutil.rmtree(item)
elif not item.name.lower().startswith("python"):
print(f" Dropping potentially non-portable file {str(item)!r}")
item.unlink()
# Symlinks within the build folder should be relative
# Symlinks outside the build folder shouldn't exist
build_path = self.build_path
Expand Down

0 comments on commit 036d4e2

Please sign in to comment.