diff --git a/deployment/macos/bundle.py b/deployment/macos/bundle.py index 5b7e4c113ea2cfca8b3986b91d46ba72e480a346..01d25441be9c6678576cd25f075f6496c28bbe89 100644 --- a/deployment/macos/bundle.py +++ b/deployment/macos/bundle.py @@ -43,31 +43,43 @@ def _WriteInfoPList(bundle): info_plist.write(INFO_PLIST) info_plist.close() -def _WriteScript(bundle): - script="""#!/bin/sh - if [ -e $HOME/Library/OpenStructure/bin/dng ]; then - $HOME/Library/OpenStructure/bin/dng - else - /Library/OpenStructure/bin/dng - fi - """ +def _WriteScript(bundle, standalone): + if standalone: + script="""#!/bin/sh +if [ -h "$0" ] ; then + SCRIPT_NAME=`readlink "$0"` +else + SCRIPT_NAME="$0" +fi +`dirname "$SCRIPT_NAME"`/../bin/dng + """ + else: + script="""#!/bin/sh +if [ -e $HOME/Library/OpenStructure/bin/dng ]; then + $HOME/Library/OpenStructure/bin/dng +else + /Library/OpenStructure/bin/dng +fi + """ bin_path=os.path.join('%s.app' % bundle, 'Contents/MacOS/dng') bin=open(bin_path, 'w+') bin.write(script) bin.close() os.system('chmod a+x %s' % bin_path) -def _CreateBundleSkeleton(bundle): +def _CreateBundleSkeleton(bundle, standalone): bin_path=os.path.join('%s.app' % bundle, 'Contents/MacOS') if not os.path.exists(bin_path): os.makedirs(bin_path) _WritePkgInfo(bundle) _WriteInfoPList(bundle) - _WriteScript(bundle) + _WriteScript(bundle, standalone) res_dir='%s.app/Contents/Resources' % bundle if not os.path.exists(res_dir): os.makedirs(res_dir) copy('../../graphics/icon.icns', res_dir) -def create_bundle(bundle_name): - _CreateBundleSkeleton(bundle_name) \ No newline at end of file +def create_bundle(bundle_name, standalone=False): + _CreateBundleSkeleton(bundle_name, standalone) + if standalone: + os.system('mv standalone/* DNG.app/Contents/') \ No newline at end of file diff --git a/deployment/macos/deploy.py b/deployment/macos/deploy.py index d87a6a06b34c0c12de677f5fcdbe7f9fb89e536f..60d45e647da40c0b94d806b6a8107cdc6569049e 100644 --- a/deployment/macos/deploy.py +++ b/deployment/macos/deploy.py @@ -1,7 +1,23 @@ import bundle import deps import sys -bundle.create_bundle('DNG') +from optparse import OptionParser +import shutil +import os +p=OptionParser() +p.add_option('--bundle', action='store_true', default=False) +p.add_option('--no_rpath', action='store_true', + default=False) +p.add_option('--macports_workaround', action='store_true', default=False) +opts, args=p.parse_args() deps.make_standalone('../../stage', 'standalone', True, - '--no-rpath' in sys.argv, - macports_workaround='--macports-workaround' in sys.argv) + opts.no_rpath, + macports_workaround=opts.macports_workaround) +if os.path.exists('DNG.app'): + shutil.rmtree('DNG.app') +bundle.create_bundle('DNG', opts.bundle) +if opts.bundle: + shutil.copytree('../../examples', 'DNG.app/Contents/examples') + os.system('rm `find DNG.app/Contents/examples/ -name "*.pyc"`') + os.system('rm -rf DNG.app/Contents/examples/harmony') + os.system('rm -rf DNG.app/Contents/examples/dokk') \ No newline at end of file diff --git a/deployment/macos/deps.py b/deployment/macos/deps.py index b7c10b67674c0fccd78cb4a3f363abff482501f8..f335dcfa425515b2357c0e2d391c33a34d6ed671 100644 --- a/deployment/macos/deps.py +++ b/deployment/macos/deps.py @@ -252,7 +252,7 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False, framework_path=os.path.join(outdir, 'lib/Python.framework') nonstd_python=True copied_py_framework=True - if glob.glob(os.path.join(outdir, 'lib', 'libpython*'))>0: + if len(glob.glob(os.path.join(outdir, 'lib', 'libpython*')))>0: non_std_python=True if non_std_python: print 'looks like we are using a non-standard python.' diff --git a/modules/gui/pymod/dng/termuse.py b/modules/gui/pymod/dng/termuse.py index 13341a0ca13df3a8b36e2c1fb98e4e31d4d5ce77..8f90c4c47f785f571771bc9a5e09c913f87b71e0 100644 --- a/modules/gui/pymod/dng/termuse.py +++ b/modules/gui/pymod/dng/termuse.py @@ -25,7 +25,8 @@ class TerminalUsageDialog(QDialog): self.path_combo=QComboBox() self.path_combo.setFixedWidth(150) for path in os.getenv('PATH').split(':'): - if os.path.exists(os.path.expanduser(path)): + exp_path=os.path.expanduser(path) + if os.path.exists(exp_path) and exp_path.find('DNG.app')==-1: self.path_combo.addItem(path) l2.addWidget(self.path_combo) l.addLayout(l2)