summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-03-21 21:25:34 +0100
committerAndoni Morales Alastruey <ylatuya@gmail.com>2013-03-25 11:28:01 +0100
commitd33cb57c3a9de42423f750cfbdd584ce1c3503d8 (patch)
tree54d06285085d8291122943702e035c61be317f08
parent68f6f9b2ffe85177bbdcb35b80f4aa721dbbd340 (diff)
packages: add support for post/pre install scripts in osx SDK packages
-rw-r--r--cerbero/packages/osx/bundles.py16
-rw-r--r--cerbero/packages/package.py3
2 files changed, 18 insertions, 1 deletions
diff --git a/cerbero/packages/osx/bundles.py b/cerbero/packages/osx/bundles.py
index a0f5a79..8b3a245 100644
--- a/cerbero/packages/osx/bundles.py
+++ b/cerbero/packages/osx/bundles.py
@@ -45,6 +45,9 @@ class BundlePackagerBase(PackagerBase):
self.package.org = package.org
self.package.install_dir = package.install_dir
self.package.osx_framework_library = package.osx_framework_library
+ self.package.resources_preinstall = package.resources_preinstall
+ self.package.resources_postinstall = package.resources_postinstall
+ self.package.__file__ = package.__file__
PackagerBase.__init__(self, package.config, self.package, package.store)
def pack(self, output_dir, root=None):
@@ -63,9 +66,20 @@ class BundlePackagerBase(PackagerBase):
self.config.target_arch))
if not root:
root = self.create_bundle()
+
+ resources = tempfile.mkdtemp()
+ if os.path.exists(self.package.resources_preinstall):
+ shutil.copy(os.path.join(self.package.resources_preinstall),
+ os.path.join(resources, 'preinstall'))
+ if os.path.exists(self.package.resources_postinstall):
+ shutil.copy(os.path.join(self.package.resources_postinstall),
+ os.path.join(resources, 'postinstall'))
packagebuild = PackageBuild()
+ import pdb; pdb.set_trace()
packagebuild.create_package(root, self.package.identifier(),
- self.package.version, self.title, output_file, install_dir)
+ self.package.version, self.title, output_file, install_dir,
+ resources)
+ shutil.rmtree(resources)
return output_file
def create_bundle(self, target_dir=None):
diff --git a/cerbero/packages/package.py b/cerbero/packages/package.py
index b8df0c7..43cde96 100644
--- a/cerbero/packages/package.py
+++ b/cerbero/packages/package.py
@@ -69,6 +69,8 @@ class PackageBase(object):
@type resources_backgound = str
@cvar resources_preinstall = filename for the pre-installation script
@type resources_preinstall = str
+ @cvar resources_postinstall = filename for the post-installation script
+ @type resources_postinstall = str
'''
name = 'default'
shortdesc = 'default'
@@ -90,6 +92,7 @@ class PackageBase(object):
resources_icon_icns = 'icon.icns'
resources_background = 'background.png'
resources_preinstall = 'preinstall'
+ resources_postinstall = 'postinstall'
def __init__(self, config, store):
self.config = config