예제 #1
0
    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
예제 #2
0
    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
예제 #3
0
    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)
        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

        return path