diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2024-02-02 18:45:11 +0530 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2024-02-07 12:56:59 +0000 |
commit | bd04c7e6078d5ff6bd97c22d68d4d5b60c0d3bef (patch) | |
tree | 8f19e4dc7f6d13977589df3ff840a060840ece00 | |
parent | f55f5a5fe8f8ef40bab4ec772a9dd0a7529bb142 (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/1347>
-rw-r--r-- | cerbero/bootstrap/build_tools.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cerbero/bootstrap/build_tools.py b/cerbero/bootstrap/build_tools.py index 9c2c628e..8150ab30 100644 --- a/cerbero/bootstrap/build_tools.py +++ b/cerbero/bootstrap/build_tools.py @@ -107,8 +107,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: @@ -127,11 +131,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() |