def _create_tarball_stripped(self, output_dir, package_type, files, force, package_prefix): tmpdir = tempfile.mkdtemp(dir=self.config.home_dir) if hasattr(self.package, 'strip_excludes'): s = strip.Strip(self.config, self.package.strip_excludes) else: s = strip.Strip(self.config) for f in files: orig_file = os.path.join(self.prefix, f) tmp_file = os.path.join(tmpdir, f) tmp_file_dir = os.path.dirname(tmp_file) if not os.path.exists(tmp_file_dir): os.makedirs(tmp_file_dir) shutil.copy(orig_file, tmp_file, follow_symlinks=False) s.strip_file(tmp_file) prefix_restore = self.prefix self.prefix = tmpdir tarball = self._create_tarball(output_dir, package_type, files, force, package_prefix) self.prefix = prefix_restore shutil.rmtree(tmpdir) return tarball
def _strip_binaries(self, tmp_dir): if not self.package.strip: return for f in self.package.strip_dirs: s_dir = os.path.join(tmp_dir, f) s = strip.Strip(self.config, self.package.strip_excludes) s.strip_dir(s_dir)
def create_merge_module(self, output_dir, package_type, force, version, keep_temp): self.package.set_mode(package_type) files_list = self.files_list(package_type, force) if isinstance(self.package, VSTemplatePackage): 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, self.package.strip_excludes) for p in self.package.strip_dirs: s.strip_dir(os.path.join(tmpdir, p)) 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]) wixobjs = [os.path.join(output_dir, "%s.wixobj" % package_name)] for x in ['utils']: wixobjs.append(os.path.join(output_dir, "%s.wixobj" % x)) sources.append( os.path.join(os.path.abspath(self.config.data_dir), 'wix/%s.wxs' % x)) if self._with_wine: wixobjs = [to_winepath(x) for x in wixobjs] sources = [to_winepath(x) for x in sources] candle = Candle(self.wix_prefix, self._with_wine) candle.compile(' '.join(sources), output_dir) light = Light(self.wix_prefix, self._with_wine) path = light.compile(wixobjs, package_name, output_dir, True) # Clean up if not keep_temp: os.remove(sources[0]) for f in wixobjs: os.remove(f) try: os.remove(f.replace('.wixobj', '.wixpdb')) except: pass if tmpdir: shutil.rmtree(tmpdir) return path
def _strip_binaries(self): if self.package.strip: for f in self.package.strip_dirs: s_dir = os.path.join(self.appdir, 'Contents', 'Home', f) s = strip.Strip(self.config, self.package.strip_excludes) s.strip_dir(s_dir)