Skip to content
Snippets Groups Projects
Commit f0a22851 authored by marco's avatar marco
Browse files

deploy.py --bundle creates an installer-free application bundle

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2608 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 49137e86
No related branches found
No related tags found
No related merge requests found
......@@ -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
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
......@@ -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.'
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment