From 25d033bc7fb192062e6ffc371bfd559f5fc7c157 Mon Sep 17 00:00:00 2001 From: Neil Mehta Date: Wed, 18 Dec 2024 18:06:55 -0500 Subject: [PATCH 1/4] Remove directories in /bin when ensuring portability --- src/venvstacks/stacks.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/venvstacks/stacks.py b/src/venvstacks/stacks.py index fc58368..40505c9 100755 --- a/src/venvstacks/stacks.py +++ b/src/venvstacks/stacks.py @@ -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 not item.name.lower().startswith("python"): + print(f" Dropping potentially non-portable file {str(item)!r}") + if item.is_dir(): + shutil.rmtree(item) + else: + item.unlink() # Symlinks within the build folder should be relative # Symlinks outside the build folder shouldn't exist build_path = self.build_path From 0ed1b91c52b6a9fa78ed3e7c0189759a7254ee1b Mon Sep 17 00:00:00 2001 From: Neil Mehta Date: Wed, 18 Dec 2024 18:13:37 -0500 Subject: [PATCH 2/4] Don't check if dir starts with python --- src/venvstacks/stacks.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/venvstacks/stacks.py b/src/venvstacks/stacks.py index 40505c9..d70a554 100755 --- a/src/venvstacks/stacks.py +++ b/src/venvstacks/stacks.py @@ -1389,12 +1389,11 @@ 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 item in self.executables_path.iterdir(): - if not item.name.lower().startswith("python"): + if item.is_dir(): + shutil.rmtree(item) + elif not item.name.lower().startswith("python"): print(f" Dropping potentially non-portable file {str(item)!r}") - if item.is_dir(): - shutil.rmtree(item) - else: - item.unlink() + item.unlink() # Symlinks within the build folder should be relative # Symlinks outside the build folder shouldn't exist build_path = self.build_path From 164b0c6b66eb96f585773b74d8055ea4ee54dd3e Mon Sep 17 00:00:00 2001 From: Neil Mehta Date: Mon, 30 Dec 2024 12:36:14 -0500 Subject: [PATCH 3/4] Add print statement, update CHANGELOG --- CHANGELOG.rst | 10 ++++++++++ src/venvstacks/stacks.py | 1 + 2 files changed, 11 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b3d12b0..ac2c053 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,6 +12,16 @@ See the fragment files in the `changelog.d directory`_. .. scriv-insert-here +.. _changelog-0.3.0: + +0.3.0 — 2024-12-31 +================== + +Fixed +----- + +- Remove directories from /bin when building layers + .. _changelog-0.2.1: 0.2.1 — 2024-12-05 diff --git a/src/venvstacks/stacks.py b/src/venvstacks/stacks.py index d70a554..ad9ac5a 100755 --- a/src/venvstacks/stacks.py +++ b/src/venvstacks/stacks.py @@ -1390,6 +1390,7 @@ def _ensure_portability(self) -> None: # so drop them entirely rather than making them portable 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}") From db4b660700a8350cec63887f26dc9fb77a874711 Mon Sep 17 00:00:00 2001 From: Neil Mehta Date: Mon, 30 Dec 2024 12:45:10 -0500 Subject: [PATCH 4/4] Fix changelog --- CHANGELOG.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index ac2c053..46c2843 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,11 +12,6 @@ See the fragment files in the `changelog.d directory`_. .. scriv-insert-here -.. _changelog-0.3.0: - -0.3.0 — 2024-12-31 -================== - Fixed -----