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

more updates to bundle creation on Leopard

git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2480 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent 1653594a
Branches
Tags
No related merge requests found
<pkg-contents spec="1.12"><f n="DNG.app" o="marco" g="staff" p="16877" pt="/Users/marco/proj/ost/deployment/macos/DNG.app" m="false" t="file"><f n="Contents" o="marco" g="staff" p="16877"><f n="Info.plist" o="marco" g="staff" p="33188"/><f n="MacOS" o="marco" g="staff" p="16877"><f n="dng" o="marco" g="staff" p="33261"/></f><f n="PkgInfo" o="marco" g="staff" p="33188"/><f n="Resources" o="marco" g="staff" p="16877"><f n="icon.icns" o="marco" g="staff" p="33188"/></f></f></f></pkg-contents> <pkg-contents spec="1.12"><f n="DNG.app" o="root" g="admin" p="16893" pt="/Users/marco/Projects/prod_ost/deployment/macos/DNG.app" m="true" t="file"><f n="Contents" o="root" g="admin" p="16893"><f n="Info.plist" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="MacOS" o="root" g="admin" p="16893"><f n="dng" o="root" g="admin" p="33277"><mod>mode</mod></f><mod>mode</mod></f><f n="PkgInfo" o="root" g="admin" p="33204"><mod>mode</mod></f><f n="Resources" o="root" g="admin" p="16893"><f n="icon.icns" o="root" g="admin" p="33204"><mod>mode</mod></f><mod>mode</mod></f><mod>mode</mod></f><mod>mode</mod></f></pkg-contents>
\ No newline at end of file \ No newline at end of file
<pkgref spec="1.12" uuid="2FD6FA09-D2A6-4765-A83C-B0F8E372E8FD"><config><identifier>org.openstructure.DNG.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" includeRoot="true">DNG.app</installFrom><installTo>/Applications</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installFrom.isRelativeType</mod><mod>parent</mod><mod>includeRoot</mod><mod>relocatable</mod><mod>identifier</mod><mod>requireAuthorization</mod></config><contents><file-list>01dng-contents.xml</file-list><component id="org.openstructure.OpenStructure" path="/Users/marco/proj/ost/deployment/macos/DNG.app" version=""><mod>isRelocatable</mod></component><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref> <pkgref spec="1.12" uuid="2FD6FA09-D2A6-4765-A83C-B0F8E372E8FD"><config><identifier>org.openstructure.DNG.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" includeRoot="true">DNG.app</installFrom><installTo>/Applications</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>requireAuthorization</mod><mod>relocatable</mod><mod>installFrom.isRelativeType</mod><mod>includeRoot</mod><mod>identifier</mod></config><contents><file-list>01dng-contents.xml</file-list><component id="org.openstructure.OpenStructure" path="/Users/marco/Projects/prod_ost/deployment/macos/DNG.app" version="" isRelocatable="true"><locator-info><token title="pkmk-token-18"><search-rule><combo identifier="org.openstructure.OpenStructure" default-path="/Applications/DNG.app"/></search-rule></token></locator-info></component><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file \ No newline at end of file
<pkgref spec="1.12" uuid="7458E2CA-C8AE-40AC-B086-775A710CD49E"><config><identifier>org.openstructure.OpenStructure.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true">standalone</installFrom><installTo mod="true">/Library/OpenStructure</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo</mod><mod>relocatable</mod><mod>requireAuthorization</mod><mod>parent</mod><mod>identifier</mod><mod>installTo.path</mod><mod>installFrom.isRelativeType</mod></config><contents><file-list>02standalone-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref> <pkgref spec="1.12" uuid="7458E2CA-C8AE-40AC-B086-775A710CD49E"><config><identifier>org.openstructure.OpenStructure.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true">standalone</installFrom><installTo mod="true">/Library/OpenStructure</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>requireAuthorization</mod><mod>relocatable</mod><mod>installFrom.isRelativeType</mod><mod>installTo.path</mod><mod>installTo</mod><mod>identifier</mod></config><contents><file-list>02standalone-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file \ No newline at end of file
<pkgref spec="1.12" uuid="C2FAE439-87F5-415C-91EE-0436CC2E4D66"><config><identifier>org.openstructure.Examples.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true">../../examples</installFrom><installTo mod="true">/Library/OpenStructure/examples</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>installTo.path</mod><mod>installFrom.isRelativeType</mod><mod>installFrom.path</mod><mod>parent</mod><mod>installTo</mod><mod>identifier</mod></config><contents><file-list>03examples-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref> <pkgref spec="1.12" uuid="C2FAE439-87F5-415C-91EE-0436CC2E4D66"><config><identifier>org.openstructure.Examples.pkg</identifier><version>1.0</version><description></description><post-install type="none"/><requireAuthorization/><installFrom relative="true" mod="true">../../examples</installFrom><installTo mod="true">/Library/OpenStructure/examples</installTo><flags><followSymbolicLinks/></flags><packageStore type="internal"></packageStore><mod>parent</mod><mod>installFrom.isRelativeType</mod><mod>installTo.path</mod><mod>installFrom.path</mod><mod>installTo</mod><mod>identifier</mod></config><contents><file-list>03examples-contents.xml</file-list><filter>/CVS$</filter><filter>/\.svn$</filter><filter>/\.cvsignore$</filter><filter>/\.cvspass$</filter><filter>/\.DS_Store$</filter></contents></pkgref>
\ No newline at end of file \ No newline at end of file
<pkmkdoc spec="1.12"><properties><title>OpenStructure</title><build>/Users/marco/Documents/OpenStructure.pkg</build><organization>org.openstructure</organization><userSees ui="easy"/><min-target os="3"/><domain system="true" user="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="DNG" id="choice6" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.openstructure.DNG.pkg"/></choice><choice title="OpenStructure" id="choice7" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.openstructure.OpenStructure.pkg"/></choice><choice title="examples" id="choice8" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.openstructure.Examples.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"/></resources><requirements><requirement id="sosv" operator="ge" value="'10.6.0'"><message-title>Snow Leopard Required</message-title><message>OpenStructure requires Snow Leopard in order to run</message></requirement></requirements><flags/><item type="file">01dng.xml</item><item type="file">02standalone.xml</item><item type="file">03examples.xml</item><mod>properties.title</mod><mod>properties.customizeOption</mod><mod>properties.userDomain</mod><mod>properties.anywhereDomain</mod><mod>properties.systemDomain</mod></pkmkdoc> <pkmkdoc spec="1.12"><properties><title>OpenStructure</title><build>/Users/marco/Sites/ost-leopard.pkg</build><organization>org.openstructure</organization><userSees ui="easy"/><min-target os="3"/><domain system="true" user="true"/></properties><distribution><versions min-spec="1.000000"/><scripts></scripts></distribution><contents><choice title="DNG" id="choice6" description="DNG Graphical Frontend" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.openstructure.DNG.pkg"/></choice><choice title="OpenStructure" id="choice7" description="The OpenStructure Framework" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.openstructure.OpenStructure.pkg"/></choice><choice title="examples" id="choice8" description="OpenStructure Example Files" starts_selected="true" starts_enabled="true" starts_hidden="false"><pkgref id="org.openstructure.Examples.pkg"/></choice></contents><resources bg-scale="none" bg-align="topleft"><locale lang="en"/></resources><flags/><item type="file">01dng.xml</item><item type="file">02standalone.xml</item><item type="file">03examples.xml</item><mod>properties.customizeOption</mod><mod>properties.userDomain</mod><mod>properties.title</mod><mod>properties.anywhereDomain</mod><mod>properties.systemDomain</mod></pkmkdoc>
\ No newline at end of file \ No newline at end of file
...@@ -2,6 +2,7 @@ import os ...@@ -2,6 +2,7 @@ import os
import subprocess import subprocess
import shutil import shutil
import sys import sys
import glob
def _lib_name(component): def _lib_name(component):
return 'libost_%s.dylib' % component return 'libost_%s.dylib' % component
...@@ -168,26 +169,26 @@ def update_pymod_shared_objects(args, path, files): ...@@ -168,26 +169,26 @@ def update_pymod_shared_objects(args, path, files):
abs_name=os.path.join(path, f) abs_name=os.path.join(path, f)
os.system(ADD_RPATH % (path_to_lib_path, abs_name)) os.system(ADD_RPATH % (path_to_lib_path, abs_name))
update_load_commands(abs_name, False, use_rpath, exe_path) update_load_commands(abs_name, False, use_rpath, exe_path)
elif ext=='.py': elif ext in ('.pyc', '.pyo'):
pyc_path=os.path.join(path, '%s.pyc' % base) os.unlink(os.path.join(path, f))
if os.path.exists(pyc_path):
os.unlink(pyc_path)
pyo_path=os.path.join(path, '%s.pyo' % base)
if os.path.exists(pyo_path):
os.unlink(f)
def get_site_package_dir(): def get_site_package_dir():
""" """
Get site-package directory of this python installation. This assumes Get site-package directory of this python installation. This assumes
that ost was linked against the same version of Python that ost was linked against the same version of Python
""" """
for p in sys.path: for p in sys.path:
pattern='/site-packages/' pattern='/site-packages'
index=p.find(pattern) index=p.find(pattern)
if index>=0: if index>=0:
return p[:index+len(pattern)] return p[:index+len(pattern)]
raise RuntimeError("Couldn't determine site-packages location") raise RuntimeError("Couldn't determine site-packages location")
def get_python_home():
"""
Derive Python home by looking at the location of the os module
"""
return os.path.dirname(sys.modules['os'].__file__)
def check_install_name_tool_capabilities(): def check_install_name_tool_capabilities():
""" """
Find out whether install_name_tool supports the add_rpath option. Find out whether install_name_tool supports the add_rpath option.
...@@ -207,6 +208,7 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False): ...@@ -207,6 +208,7 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False):
elif force_no_rpath: elif force_no_rpath:
print "I will use the arcane @executable_path" print "I will use the arcane @executable_path"
use_rpath=False use_rpath=False
if os.path.exists(outdir): if os.path.exists(outdir):
shutil.rmtree(outdir) shutil.rmtree(outdir)
os.system('mkdir -p "%s"' % outdir) os.system('mkdir -p "%s"' % outdir)
...@@ -224,6 +226,27 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False): ...@@ -224,6 +226,27 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False):
print 'copying pymod' print 'copying pymod'
shutil.copytree(os.path.join(stage_dir, 'lib/openstructure'), shutil.copytree(os.path.join(stage_dir, 'lib/openstructure'),
os.path.join(outdir, 'lib/openstructure')) os.path.join(outdir, 'lib/openstructure'))
assert not os.path.exists(os.path.join(outdir, 'lib', 'Python.framework'))
if len(glob.glob(os.path.join(outdir, 'lib', 'libpython*')))>0:
print 'looks like we are using a non-standard python.'
python_home=get_python_home()
print 'also copying python modules from %s' % python_home
modules_dst=os.path.join(outdir, 'lib', os.path.basename(python_home))
shutil.copytree(python_home, modules_dst)
shutil.rmtree(os.path.join(modules_dst, 'site-packages'))
copy_binaries(os.path.join(python_home, '../..'), outdir,
['python'], [], use_rpath)
# replace the python executable
ost_script=os.path.join(outdir, 'bin', 'ost')
os.chmod(ost_script, 0666)
script=''.join(open(ost_script, 'r').readlines())
python_bin=os.path.abspath(os.path.join(python_home, '../../bin/python'))
script=script.replace(python_bin, '$BIN_DIR/python')
open(ost_script, 'w').write(script)
os.chmod(ost_script, 0555)
elif use_rpath==False:
print 'BIG FAT WARNING: Creation bundle with @executable_path and default'
print 'Python might not work. Test carefully before deploying.'
if no_includes: if no_includes:
os.system(REMOVE_HEADERS % outdir) os.system(REMOVE_HEADERS % outdir)
os.system(REMOVE_CURRENT % outdir) os.system(REMOVE_CURRENT % outdir)
...@@ -236,6 +259,6 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False): ...@@ -236,6 +259,6 @@ def make_standalone(stage_dir, outdir, no_includes, force_no_rpath=False):
else: else:
shutil.copy(src, os.path.join(outdir, 'lib/openstructure', sp)) shutil.copy(src, os.path.join(outdir, 'lib/openstructure', sp))
print 'updating link commands of python shared objects' print 'updating link commands of python shared objects'
os.path.walk(os.path.join(outdir, 'lib', 'openstructure'), os.path.walk(os.path.join(outdir, 'lib'),
update_pymod_shared_objects, update_pymod_shared_objects,
(os.path.join(outdir, 'lib'), use_rpath)) (os.path.join(outdir, 'lib'), use_rpath))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment