diff options
author | Mathew Robinson <chasinglogic@gmail.com> | 2017-12-07 17:07:37 -0500 |
---|---|---|
committer | Mathew Robinson <chasinglogic@gmail.com> | 2017-12-11 09:48:54 -0500 |
commit | ecb76e06cd0166250626afc50b1d76a75b39482b (patch) | |
tree | 7b6ca84138849f6d170cb5e5328ce1af2e7d57c5 /src | |
parent | 64e3571e79872d3055d9dcc65d5488bb33fe5d58 (diff) | |
download | mongo-ecb76e06cd0166250626afc50b1d76a75b39482b.tar.gz |
SERVER-32211 Set the python interpreter based on target platform
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/SConscript | 7 | ||||
-rwxr-xr-x | src/mongo/installer/compass/install_compass.in | 41 |
2 files changed, 31 insertions, 17 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index e916f289438..753e4e81ed4 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -637,9 +637,14 @@ if env.TargetOSIs('windows'): # On windows the .in needs to be explicitly added to the file. compass_script = "Install-Compass.ps1.in" +compass_python_interpreter = '/usr/bin/env python2' +if env.TargetOSIs('darwin'): + compass_python_interpreter = '/usr/bin/env python' + compass_installer = env.Substfile('#/src/mongo/installer/compass/' + compass_script, SUBST_DICT=[ - ('@compass_type@', compass_type) + ('@compass_type@', compass_type), + ('@python_interpreter@', compass_python_interpreter), ]) distBinaries.append(compass_installer) diff --git a/src/mongo/installer/compass/install_compass.in b/src/mongo/installer/compass/install_compass.in index 41b94ed7651..b29942c5bd5 100755 --- a/src/mongo/installer/compass/install_compass.in +++ b/src/mongo/installer/compass/install_compass.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!@python_interpreter@ # This script downloads the latest version of Compass and installs it on # non-windows platforms. @@ -64,21 +64,30 @@ def download_pkg(link, pkg_format=''): def install_mac(dmg): """Use CLI tools to mount the dmg and extract all .apps into Applications.""" tmp = tempfile.mkdtemp() - subprocess.check_call(['hdiutil', 'attach', '-mountpoint', tmp, dmg]) - try: - apps = [f for f in os.listdir(tmp) if f.endswith('.app')] - for app in apps: - if path.isdir('/Applications/' + app): - print 'Old version found removing...' - shutil.rmtree('/Applications/' + app) - print 'Copying %s to /Applications' % app - shutil.copytree(path.join(tmp, app), '/Applications/' + app) - # We don't really care about what errors come up here. Just log the failure - # and use the finally to make sure we always unmount the dmg. - except Exception as exception: - print exception - finally: - subprocess.check_call(['hdiutil', 'detach', tmp]) + with open(os.devnull, 'w') as fnull: + subprocess.check_call(['hdiutil', 'attach', '-nobrowse', '-noautoopen', + '-mountpoint', tmp, dmg], stdout=fnull, stderr=fnull) + try: + apps = [f for f in os.listdir(tmp) if f.endswith('.app')] + for app in apps: + if path.isdir('/Applications/' + app): + print 'Old version found removing...' + shutil.rmtree('/Applications/' + app) + print 'Copying %s to /Applications' % app + shutil.copytree(path.join(tmp, app), '/Applications/' + app) + # We don't really care about what errors come up here. Just log the failure + # and use the finally to make sure we always unmount the dmg. + except Exception as exception: + print exception + finally: + subprocess.check_call(['hdiutil', 'detach', tmp], stdout=fnull, stderr=fnull) + + if path.isdir('/Applications/MongoDB Compass.app'): + subprocess.check_call(['open', '/Applications/MongoDB Compass.app']) + return + if path.isdir('/Applications/MongoDB Compass Community.app'): + subprocess.check_call(['open', '/Applications/MongoDB Compass Community.app']) + return def install_linux(pkg_format, pkg_file): |