summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cerbero/build/filesprovider.py1
-rw-r--r--cerbero/packages/osx/packager.py48
-rw-r--r--cerbero/packages/package.py30
3 files changed, 74 insertions, 5 deletions
diff --git a/cerbero/build/filesprovider.py b/cerbero/build/filesprovider.py
index db3c8e9..908df75 100644
--- a/cerbero/build/filesprovider.py
+++ b/cerbero/build/filesprovider.py
@@ -34,6 +34,7 @@ class FilesProvider(object):
PY_CAT = 'python'
DEVEL_CAT = 'devel'
LANG_CAT = 'lang'
+ TUTORIAL_CAT = 'tutorials'
EXTENSIONS = {
Platform.WINDOWS: {'bext': '.exe', 'sext': '*-*.dll', 'sdir': 'bin',
diff --git a/cerbero/packages/osx/packager.py b/cerbero/packages/osx/packager.py
index 45f9a18..035cbe0 100644
--- a/cerbero/packages/osx/packager.py
+++ b/cerbero/packages/osx/packager.py
@@ -35,6 +35,11 @@ from cerbero.tools.osxrelocator import OSXRelocator
from cerbero.utils import shell, _
from cerbero.utils import messages as m
+def create_dmg(output_file, name, input_folder):
+ # Create Disk Image
+ cmd = 'hdiutil create %s -volname %s -ov -srcfolder %s' % \
+ (output_file, name, input_folder)
+ shell.call(cmd)
class FrameworkHeadersMixin(object):
@@ -400,10 +405,7 @@ class ApplicationPackage(PackagerBase):
def _create_dmg(self):
dmg_file = os.path.join(self.output_dir, '%s-%s-%s.dmg' % (
self.package.app_name, self.package.version, self.config.target_arch))
- # Create Disk Image
- cmd = 'hdiutil create %s -volname %s -ov -srcfolder %s' % \
- (dmg_file, self.package.app_name, self.tmp)
- shell.call(cmd)
+ create_dmg(dmg_file, self.package.app_name, self.tmp)
return dmg_file
@@ -506,6 +508,42 @@ class IOSPackage(ProductPackage, FrameworkHeadersMixin):
return '%s-%s-%s-%s%s' % (self.package.name, self.package.version,
self.config.target_platform, self.config.target_arch, suffix)
+class IOSBundlePackage(IOSPackage):
+ '''
+ Creates a dmg bundle containing an ios Framework package from a
+ L{cerbero.package.package.MetaPackage} using IOSPackage and ships
+ together acessory files/folders.
+ '''
+
+ def pack(self, output_dir, devel=False, force=False, keep_temp=False):
+ paths = super(IOSBundlePackage, self).pack(output_dir, devel, force,
+ keep_temp)
+ new_paths = []
+ for p in paths:
+ if p is None:
+ new_paths.append(p)
+ continue
+ tmp = tempfile.mkdtemp()
+ shutil.copy(p, tmp)
+
+ self._add_extra_files(tmp)
+
+ dmg_file = os.path.join(self.output_dir, '%s-%s-%s-%s.dmg' % (
+ self.package.name, self.package.version,
+ self.config.target_platform, self.config.target_arch))
+ create_dmg(dmg_file, self.package.name, tmp)
+ new_paths.append(dmg_file)
+
+ return new_paths
+
+ def _add_extra_files(self, tmp):
+ files = self.package.get_extra_files()
+ for k in files.keys():
+ outdir = os.path.join(tmp, k)
+ os.mkdir(outdir)
+ for f in files[k]:
+ shutil.copy(os.path.join(self.config.prefix, f), outdir)
+
class Packager(object):
@@ -514,7 +552,7 @@ class Packager(object):
if not isinstance(package, MetaPackage):
raise FatalError ("iOS platform only support packages",
"for MetaPackage")
- return IOSPackage(config, package, store)
+ return IOSBundlePackage(config, package, store)
if isinstance(package, Package):
return OSXPackage(config, package, store)
elif isinstance(package, MetaPackage):
diff --git a/cerbero/packages/package.py b/cerbero/packages/package.py
index 43cde96..e06e07e 100644
--- a/cerbero/packages/package.py
+++ b/cerbero/packages/package.py
@@ -23,6 +23,7 @@ from cerbero.enums import License, Platform
from cerbero.packages import PackageType
from cerbero.utils import remove_list_duplicates
+EXTRAS_CATEGORIES = ['tutorials']
class PackageBase(object):
'''
@@ -137,6 +138,10 @@ class PackageBase(object):
raise NotImplemented("'all_files_list' must be implemented by "
"subclasses")
+ def get_extra_files(self):
+ raise NotImplemented("'get_extra_files' must be implemented by "
+ "subclasses")
+
def set_mode(self, package_type):
self.package_mode = package_type
@@ -224,6 +229,8 @@ class Package(PackageBase):
platform_files = dict()
files_devel = list()
platform_files_devel = dict()
+ files_tutorials = list()
+ platform_files_tutorials = dict()
osx_framework_library = None
def __init__(self, config, store, cookbook):
@@ -297,6 +304,19 @@ class Package(PackageBase):
files.extend(self.devel_files_list())
return sorted(files)
+ def get_extra_files(self):
+ files = {}
+ for recipe, categories in self._recipes_files_devel.iteritems():
+ recipe = self.cookbook.get_recipe(recipe)
+ if categories:
+ for c in categories:
+ if c in EXTRAS_CATEGORIES:
+ current = files.get(c, [])
+ rfiles = recipe.files_list_by_categories(categories)
+ current.extend(rfiles)
+ files[c] = current
+ return files
+
def _parse_files(self):
self._recipes_files = {}
for r in self._files:
@@ -376,6 +396,16 @@ class MetaPackage(PackageBase):
def all_files_list(self):
return self._list_files(Package.all_files_list)
+ def get_extra_files(self):
+ files = {}
+ for package in self.store.get_package_deps(self, True):
+ for k,v in package.get_extra_files().iteritems():
+ if k in files.keys():
+ files[k].extend(v)
+ else:
+ files[k] = v
+ return files
+
def get_wix_upgrade_code(self):
m = self.package_mode
p = self.config.target_arch