Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove directories in /bin when ensuring portability #103

Merged
merged 4 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
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
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)
ncoghlan marked this conversation as resolved.
Show resolved Hide resolved
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
Loading