From 00281bbad79f43bfd9e7b8f07c8fb48eed09d724 Mon Sep 17 00:00:00 2001 From: "Billy K. Poon" Date: Sat, 1 Oct 2022 01:30:53 -0700 Subject: [PATCH] libtbx: fix binary and source installers when /usr/bin/python is not available - Change default to /usr/bin/python3 if /usr/bin/python is not available - Change calls to "python" or "/usr/bin/python" to sys.executable - Fixes #788 --- libtbx/auto_build/create_installer.py | 3 +++ libtbx/auto_build/install_distribution.py | 8 ++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/libtbx/auto_build/create_installer.py b/libtbx/auto_build/create_installer.py index 8aae338258..854e44e7af 100644 --- a/libtbx/auto_build/create_installer.py +++ b/libtbx/auto_build/create_installer.py @@ -35,6 +35,9 @@ #!/bin/bash if [ -z "$PYTHON_EXE" ]; then PYTHON_EXE='/usr/bin/python' + if [ ! -f $PYTHON_EXE ]; then + PYTHON_EXE='/usr/bin/python3' + fi if [ -f "/usr/bin/python2.7" ]; then PYTHON_EXE='/usr/bin/python2.7' elif [ -f "/usr/bin/python2.6" ]; then diff --git a/libtbx/auto_build/install_distribution.py b/libtbx/auto_build/install_distribution.py index 2ea55e47b3..717de9df4a 100644 --- a/libtbx/auto_build/install_distribution.py +++ b/libtbx/auto_build/install_distribution.py @@ -329,10 +329,10 @@ def install_from_binary(self): tarball.close() cwd = os.getcwd() os.chdir(dest_dir) - unpack_cmd = os.path.join('.', 'bin', 'conda-unpack') + unpack_cmd = [sys.executable, os.path.join('.', 'bin', 'conda-unpack')] if sys.platform == 'win32': - unpack_cmd = os.path.join('.', 'Scripts', 'conda-unpack.exe') - subprocess.check_call([unpack_cmd]) + unpack_cmd = [os.path.join('.', 'Scripts', 'conda-unpack.exe')] + subprocess.check_call(unpack_cmd) os.chdir(cwd) # Reconfigure @@ -354,7 +354,7 @@ def install_from_binary(self): def install_from_source(self): log = self.out # open(os.path.join(self.tmp_dir, "source.log"), "w") cmd = [ - 'python', + sys.executable, os.path.join('modules', 'cctbx_project', 'libtbx', 'auto_build', 'bootstrap.py'), 'base', 'build',