Skip to content

Commit

Permalink
libtbx: make python.app optional on macOS
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
bkpoon committed Oct 15, 2024
1 parent 6f35b8c commit 1cfe284
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libtbx/auto_build/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1671,6 +1671,8 @@ def m_get_conda_python(self):
elif self.isPlatformMacOSX():
m_conda_python = os.path.join('python.app', 'Contents',
'MacOS', 'python')
if not os.path.isfile(m_conda_python):
m_conda_python = os.path.join('bin', 'python')
return m_conda_python
# -----------------------------------------------------------------------

Expand Down
4 changes: 3 additions & 1 deletion libtbx/auto_build/conda_build/update_libtbx_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@ def update_libtbx_env(default_dir=None):
env.pythonpath = list()
sys_executable = sys.executable
if sys.platform == 'darwin' and 'python.app' not in sys_executable:
sys_executable = os.path.join(sys_prefix, 'python.app', 'Contents', 'MacOS', 'python')
new_executable = os.path.join(sys_prefix, 'python.app', 'Contents', 'MacOS', 'python')
if os.path.isfile(new_executable):
sys_executable = new_executable
env.python_exe = env.as_relocatable_path(sys_executable)
env.no_bin_python = True
site_packages_path = None
Expand Down
2 changes: 2 additions & 0 deletions libtbx/auto_build/install_conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,8 @@ def get_conda_python(self, conda_env=None, check_file=None):
# use python.app for GUI applications
conda_python = os.path.join(conda_env, 'python.app', 'Contents', 'MacOS',
'python')
if not os.path.isfile(conda_python):
conda_python = os.path.join(conda_env, 'bin', 'python')
else:
conda_python = os.path.join(conda_env, 'bin', 'python')

Expand Down
2 changes: 2 additions & 0 deletions libtbx/auto_build/install_distribution.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def reconfigure(self, log):
if 'darwin' in sys.platform:
base_python = os.path.join(self.base_dir, 'python.app', 'Contents',
'MacOS', 'python')
if not os.path.isfile(base_python):
base_python = os.path.join(self.base_dir, 'bin', 'python')
elif 'win32' in sys.platform:
base_python = os.path.join(self.base_dir, 'python.exe')

Expand Down

0 comments on commit 1cfe284

Please sign in to comment.