Skip to content
Snippets Groups Projects
Commit f626b42a authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Cleanup python

parent a204ff1a
Branches
Tags
2 merge requests!3Update to main branch,!2Rebase onto current main branch
...@@ -612,7 +612,7 @@ def construct(self): ...@@ -612,7 +612,7 @@ def construct(self):
if not self.is_packaging_viewer(): if not self.is_packaging_viewer():
self.package_file = "copied_deps" self.package_file = "copied_deps"
def nsi_file_commands(self, install=True): def isc_file_commands(self):
def wpath(path): def wpath(path):
if path.endswith('/') or path.endswith(os.path.sep): if path.endswith('/') or path.endswith(os.path.sep):
path = path[:-1] path = path[:-1]
...@@ -628,25 +628,7 @@ def wpath(path): ...@@ -628,25 +628,7 @@ def wpath(path):
rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,'')) rel_file = os.path.normpath(pkg_file.replace(self.get_dst_prefix()+os.path.sep,''))
installed_dir = wpath(os.path.join('{app}', os.path.dirname(rel_file))) installed_dir = wpath(os.path.join('{app}', os.path.dirname(rel_file)))
pkg_file = wpath(os.path.normpath(pkg_file)) pkg_file = wpath(os.path.normpath(pkg_file))
if install:
result += 'Source: "' + pkg_file + '"; DestDir: "' + installed_dir + '"; Flags: ignoreversion \n' result += 'Source: "' + pkg_file + '"; DestDir: "' + installed_dir + '"; Flags: ignoreversion \n'
else:
result += 'Delete ' + wpath(os.path.join('$INSTDIR', rel_file)) + '\n'
# at the end of a delete, just rmdir all the directories
if not install:
deleted_file_dirs = [os.path.dirname(pair[1].replace(self.get_dst_prefix()+os.path.sep,'')) for pair in self.file_list]
# find all ancestors so that we don't skip any dirs that happened to have no non-dir children
deleted_dirs = []
for d in deleted_file_dirs:
deleted_dirs.extend(path_ancestors(d))
# sort deepest hierarchy first
deleted_dirs.sort(key=lambda f: (f.count(os.path.sep), f), reverse=True)
prev = None
for d in deleted_dirs:
if d != prev: # skip duplicates
result += 'RMDir ' + wpath(os.path.join('$INSTDIR', os.path.normpath(d))) + '\n'
prev = d
return result return result
...@@ -688,8 +670,7 @@ def package_finish(self): ...@@ -688,8 +670,7 @@ def package_finish(self):
self.replace_in("installers/windows/install_template.iss", tempfile, { self.replace_in("installers/windows/install_template.iss", tempfile, {
"%%SOURCE%%":self.get_src_prefix(), "%%SOURCE%%":self.get_src_prefix(),
"%%INST_VARS%%":inst_vars_template % substitution_strings, "%%INST_VARS%%":inst_vars_template % substitution_strings,
"%%INSTALL_FILES%%":self.nsi_file_commands(True), "%%INSTALL_FILES%%":self.isc_file_commands()})
"%%DELETE_FILES%%":self.nsi_file_commands(False)})
# If we're on a build machine, sign the code using our Authenticode certificate. JC # If we're on a build machine, sign the code using our Authenticode certificate. JC
# note that the enclosing setup exe is signed later, after the makensis makes it. # note that the enclosing setup exe is signed later, after the makensis makes it.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment