本文整理汇总了Python中msilib.Directory方法的典型用法代码示例。如果您正苦于以下问题:Python msilib.Directory方法的具体用法?Python msilib.Directory怎么用?Python msilib.Directory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类msilib
的用法示例。
在下文中一共展示了msilib.Directory方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_files
# 需要导入模块: import msilib [as 别名]
# 或者: from msilib import Directory [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)
示例2: add_files
# 需要导入模块: import msilib [as 别名]
# 或者: from msilib import Directory [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)
示例3: add_config
# 需要导入模块: import msilib [as 别名]
# 或者: from msilib import Directory [as 别名]
def add_config(self, fullname):
if self.add_to_path:
msilib.add_data(self.db, 'Environment',
[("E_PATH", "=-*Path", r"[~];[TARGETDIR]", "TARGETDIR")])
if self.directories:
msilib.add_data(self.db, "Directory", self.directories)
msilib.add_data(self.db, 'CustomAction',
[("A_SET_TARGET_DIR", 256 + 51, "TARGETDIR",
self.initial_target_dir)])
msilib.add_data(self.db, 'InstallExecuteSequence',
[("A_SET_TARGET_DIR", 'TARGETDIR=""', 401)])
msilib.add_data(self.db, 'InstallUISequence',
[("PrepareDlg", None, 140),
("A_SET_TARGET_DIR", 'TARGETDIR=""', 401),
("SelectDirectoryDlg", "not Installed", 1230),
("MaintenanceTypeDlg",
"Installed and not Resume and not Preselected", 1250),
("ProgressDlg", None, 1280)
])
for index, executable in enumerate(self.distribution.executables):
if executable.shortcutName is not None \
and executable.shortcutDir is not None:
baseName = os.path.basename(executable.targetName)
msilib.add_data(self.db, "Shortcut",
[("S_APP_%s" % index, executable.shortcutDir,
executable.shortcutName, "TARGETDIR",
"[TARGETDIR]%s" % baseName, None, None, None,
None, None, None, None)])
for tableName, data in self.data.items():
msilib.add_data(self.db, tableName, data)
示例4: add_files
# 需要导入模块: import msilib [as 别名]
# 或者: from msilib import Directory [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)