summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndoni Morales Alastruey <ylatuya@gmail.com>2013-02-25 00:57:58 +0100
committerAndoni Morales Alastruey <ylatuya@gmail.com>2013-08-22 22:02:17 +0200
commit420fecc3030ff73b154b914793803aa4fcdfab21 (patch)
tree14cd82811602a10b5ced2079e480cb43e40b3f6c
parent8efbf727f5c17a0003cc07ca54b5bb49e6e78df3 (diff)
win32 add support for stripping application packages
-rw-r--r--cerbero/packages/wix_packager.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/cerbero/packages/wix_packager.py b/cerbero/packages/wix_packager.py
index fd22d2c3..991c87fd 100644
--- a/cerbero/packages/wix_packager.py
+++ b/cerbero/packages/wix_packager.py
@@ -17,6 +17,8 @@
# Boston, MA 02111-1307, USA.
import os
+import tempfile
+import shutil
from zipfile import ZipFile
from cerbero.errors import EmptyPackageError
@@ -24,6 +26,7 @@ from cerbero.packages import PackagerBase, PackageType
from cerbero.packages.package import Package, App
from cerbero.utils import messages as m
from cerbero.utils import shell, to_winepath, get_wix_prefix
+from cerbero.tools import strip
from cerbero.packages.wix import MergeModule, VSMergeModule, MSI, WixConfig
from cerbero.packages.wix import VSTemplatePackage
from cerbero.config import Platform
@@ -61,6 +64,25 @@ class MergeModulePackager(PackagerBase):
mergemodule = VSMergeModule(self.config, files_list, self.package)
else:
mergemodule = MergeModule(self.config, files_list, self.package)
+ tmpdir = None
+ # For application packages that requires stripping object files, we need
+ # to copy all the files to a new tree and strip them there:
+ if isinstance(self.package, App) and self.package.strip:
+ tmpdir = tempfile.mkdtemp()
+ for f in files_list:
+ src = os.path.join(self.config.prefix, f)
+ dst = os.path.join(tmpdir, f)
+ if not os.path.exists(os.path.dirname(dst)):
+ os.makedirs(os.path.dirname(dst))
+ shutil.copy(src, dst)
+ s = strip.Strip(self.config)
+ s.strip_dir(os.path.join(tmpdir, 'bin'))
+ s.strip_dir(os.path.join(tmpdir, 'lib'))
+
+
+ mergemodule = MergeModule(self.config, files_list, self.package)
+ if tmpdir:
+ mergemodule.prefix = tmpdir
package_name = self._package_name(version)
sources = [os.path.join(output_dir, "%s.wxs" % package_name)]
mergemodule.write(sources[0])
@@ -89,6 +111,8 @@ class MergeModulePackager(PackagerBase):
os.remove(f.replace('.wixobj', '.wixpdb'))
except:
pass
+ if tmpdir:
+ shutil.rmtree(tmpdir)
return path