當前位置: 首頁>>代碼示例>>Python>>正文


Python msilib.CAB屬性代碼示例

本文整理匯總了Python中msilib.CAB屬性的典型用法代碼示例。如果您正苦於以下問題:Python msilib.CAB屬性的具體用法?Python msilib.CAB怎麽用?Python msilib.CAB使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在msilib的用法示例。


在下文中一共展示了msilib.CAB屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: add_files

# 需要導入模塊: import msilib [as 別名]
# 或者: from msilib import CAB [as 別名]
def add_files(self):
        db = self.db
        cab = msilib.CAB("distfiles")
        f = Feature(db, "default", "Default Feature", "Everything", 1, directory="TARGETDIR")
        f.set_current()
        rootdir = os.path.abspath(self.bdist_dir)
        root = Directory(db, cab, None, rootdir, "TARGETDIR", "SourceDir")
        db.Commit()
        todo = [root]
        while todo:
            dir = todo.pop()
            for file in os.listdir(dir.absolute):
                afile = os.path.join(dir.absolute, file)
                if os.path.isdir(afile):
                    newdir = Directory(db, cab, dir, file, file, "%s|%s" % (dir.make_short(file), file))
                    todo.append(newdir)
                else:
                    key = dir.add_file(file)
                    if file==self.install_script:
                        if self.install_script_key:
                            raise DistutilsOptionError, "Multiple files with name %s" % file
                        self.install_script_key = '[#%s]' % key

        cab.commit(db) 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:26,代碼來源:bdist_msi.py

示例2: add_files

# 需要導入模塊: import msilib [as 別名]
# 或者: from msilib import CAB [as 別名]
def add_files(self):
        db = self.db
        cab = msilib.CAB("distfiles")
        f = msilib.Feature(db, "default", "Default Feature", "Everything", 1,
                directory="TARGETDIR")
        f.set_current()
        rootdir = os.path.abspath(self.bdist_dir)
        root = msilib.Directory(db, cab, None, rootdir, "TARGETDIR",
                "SourceDir")
        db.Commit()
        todo = [root]
        while todo:
            dir = todo.pop()
            for file in os.listdir(dir.absolute):
                if os.path.isdir(os.path.join(dir.absolute, file)):
                    newDir = msilib.Directory(db, cab, dir, file, file,
                            "%s|%s" % (dir.make_short(file), file))
                    todo.append(newDir)
                else:
                    dir.add_file(file)
        cab.commit(db) 
開發者ID:tensorlang,項目名稱:tensorlang,代碼行數:23,代碼來源:windist.py

示例3: add_files

# 需要導入模塊: import msilib [as 別名]
# 或者: from msilib import CAB [as 別名]
def add_files(self):
        db = self.db
        cab = msilib.CAB("distfiles")
        rootdir = os.path.abspath(self.bdist_dir)

        root = Directory(db, cab, None, rootdir, "TARGETDIR", "SourceDir")
        f = Feature(db, "Python", "Python", "Everything",
                    0, 1, directory="TARGETDIR")

        items = [(f, root, '')]
        for version in self.versions + [self.other_version]:
            target = "TARGETDIR" + version
            name = default = "Python" + version
            desc = "Everything"
            if version is self.other_version:
                title = "Python from another location"
                level = 2
            else:
                title = "Python %s from registry" % version
                level = 1
            f = Feature(db, name, title, desc, 1, level, directory=target)
            dir = Directory(db, cab, root, rootdir, target, default)
            items.append((f, dir, version))
        db.Commit()

        seen = {}
        for feature, dir, version in items:
            todo = [dir]
            while todo:
                dir = todo.pop()
                for file in os.listdir(dir.absolute):
                    afile = os.path.join(dir.absolute, file)
                    if os.path.isdir(afile):
                        short = "%s|%s" % (dir.make_short(file), file)
                        default = file + version
                        newdir = Directory(db, cab, dir, file, default, short)
                        todo.append(newdir)
                    else:
                        if not dir.component:
                            dir.start_component(dir.logical, feature, 0)
                        if afile not in seen:
                            key = seen[afile] = dir.add_file(file)
                            if file==self.install_script:
                                if self.install_script_key:
                                    raise DistutilsOptionError(
                                          "Multiple files with name %s" % file)
                                self.install_script_key = '[#%s]' % key
                        else:
                            key = seen[afile]
                            add_data(self.db, "DuplicateFile",
                                [(key + version, dir.component, key, None, dir.logical)])
            db.Commit()
        cab.commit(db) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:55,代碼來源:bdist_msi.py


注:本文中的msilib.CAB屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。