Skip to content

Commit

Permalink
libtbx: fix binary and source installers when /usr/bin/python is not …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
bkpoon committed Oct 1, 2022
1 parent 0d7f1cf commit 00281bb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions libtbx/auto_build/create_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions libtbx/auto_build/install_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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',
Expand Down

0 comments on commit 00281bb

Please sign in to comment.