summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2024-02-02 18:45:11 +0530
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2024-02-06 20:01:58 +0000
commitb7a7a65aae00de2a72c0676e3f2691959d741ac6 (patch)
tree8ab47a1b45e23ef3be3494da6a119db763188bf8
parentf47076ec85427c23cd21252279c0ad4ca18ea2c3 (diff)
cerbero: Fix bootstrap venv error after upgrading Python
Unable to symlink '/usr/bin/python3' to 'cerbero.git/build/build-tools/bin/python3' cerbero.git/build/build-tools/bin/python: error while loading shared libraries: libpython3.11.so.1.0: cannot open shared object file: No such file or directory Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/1340>
-rw-r--r--cerbero/bootstrap/build_tools.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/cerbero/bootstrap/build_tools.py b/cerbero/bootstrap/build_tools.py
index 17012760..37931f48 100644
--- a/cerbero/bootstrap/build_tools.py
+++ b/cerbero/bootstrap/build_tools.py
@@ -100,8 +100,12 @@ class BuildTools(BootstrapperBase, Fetch):
self.recipes += self.PLAT_BUILD_TOOLS.get(self.config.platform, [])
def setup_venv(self):
- # Python relies on symlinks to work on macOS.
- # See e.g.
+ # Remove previous venv, which could've used an old version of python
+ # that no longer exists
+ python_glob = os.path.join(self.config.build_tools_prefix, 'bin', 'python*')
+ for f in glob.glob(python_glob):
+ os.remove(f)
+ # Python relies on symlinks to work on macOS. See e.g.
# https://github.com/python-poetry/install.python-poetry.org/issues/24#issuecomment-1226504499
venv.create(self.config.build_tools_prefix, symlinks=self.config.platform != Platform.WINDOWS, with_pip=True)
if self.config.platform == Platform.WINDOWS:
@@ -120,11 +124,7 @@ class BuildTools(BootstrapperBase, Fetch):
shell.new_call([python, '-m', 'pip', 'install', 'setuptools'])
async def start(self, jobs=0):
- python = os.path.join(self.config.build_tools_prefix, 'bin', 'python')
- if self.config.platform == Platform.WINDOWS:
- python += '.exe'
- if not os.path.exists(python):
- self.setup_venv()
+ self.setup_venv()
# Check and these at the last minute because we may have installed them
# in system bootstrap
self.recipes += self.check_build_tools()