本文整理匯總了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)