def testproperwindowspath(self): self.assertEqual( llmanifest.proper_windows_path("C:\Program Files", "cygwin"), "/cygdrive/c/Program Files") self.assertEqual( llmanifest.proper_windows_path("C:\Program Files", "windows"), "C:\Program Files") self.assertEqual( llmanifest.proper_windows_path("/cygdrive/c/Program Files/NSIS", "windows"), "C:\Program Files\NSIS") self.assertEqual( llmanifest.proper_windows_path("/cygdrive/c/Program Files/NSIS", "cygwin"), "/cygdrive/c/Program Files/NSIS")
def testproperwindowspath(self): self.assertEqual(llmanifest.proper_windows_path("C:\Program Files", "cygwin"),"/cygdrive/c/Program Files") self.assertEqual(llmanifest.proper_windows_path("C:\Program Files", "windows"), "C:\Program Files") self.assertEqual(llmanifest.proper_windows_path("/cygdrive/c/Program Files/NSIS", "windows"), "C:\Program Files\NSIS") self.assertEqual(llmanifest.proper_windows_path("/cygdrive/c/Program Files/NSIS", "cygwin"), "/cygdrive/c/Program Files/NSIS")
def package_finish(self): # a standard map of strings for replacing in the templates substitution_strings = { 'version': '.'.join(self.args['version']), 'version_short': '.'.join(self.args['version'][:-1]), 'version_dashes': '-'.join(self.args['version']), 'final_exe': self.final_exe(), 'grid': self.args['grid'], 'grid_caps': self.args['grid'].upper(), # escape quotes becase NSIS doesn't handle them well 'flags': self.flags_list().replace('"', '$\\"'), 'channel': self.channel(), 'channel_oneword': self.channel_oneword(), 'channel_unique': self.channel_unique(), } version_vars = """ !define INSTEXE "%(final_exe)s" !define VERSION "%(version_short)s" !define VERSION_LONG "%(version)s" !define VERSION_DASHES "%(version_dashes)s" """ % substitution_strings if self.default_channel(): if self.default_grid(): # release viewer installer_file = "Second_Life_%(version_dashes)s_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define INSTFLAGS "%(flags)s" !define INSTNAME "SecondLife" !define SHORTCUT "Second Life" !define URLNAME "secondlife" Caption "Second Life ${VERSION}" """ else: # beta grid viewer installer_file = "Second_Life_%(version_dashes)s_(%(grid_caps)s)_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define INSTFLAGS "%(flags)s" !define INSTNAME "SecondLife%(grid_caps)s" !define SHORTCUT "Second Life (%(grid_caps)s)" !define URLNAME "secondlife%(grid)s" !define UNINSTALL_SETTINGS 1 Caption "Second Life %(grid)s ${VERSION}" """ else: # some other channel on some grid installer_file = "Second_Life_%(version_dashes)s_%(channel_oneword)s_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define INSTFLAGS "%(flags)s" !define INSTNAME "SecondLife%(channel_oneword)s" !define SHORTCUT "%(channel)s" !define URLNAME "secondlife" !define UNINSTALL_SETTINGS 1 Caption "%(channel)s ${VERSION}" """ if 'installer_name' in self.args: installer_file = self.args['installer_name'] else: installer_file = installer_file % substitution_strings substitution_strings['installer_file'] = installer_file tempfile = "secondlife_setup_tmp.nsi" # the following replaces strings in the nsi template # it also does python-style % substitution self.replace_in( "installers/windows/installer_template.nsi", tempfile, { "%%VERSION%%": version_vars, "%%SOURCE%%": self.get_src_prefix(), "%%GRID_VARS%%": grid_vars_template % substitution_strings, "%%INSTALL_FILES%%": self.nsi_file_commands(True), "%%DELETE_FILES%%": self.nsi_file_commands(False) }) # We use the Unicode version of NSIS, available from # http://www.scratchpaper.com/ NSIS_path = 'C:\\Program Files\\NSIS\\Unicode\\makensis.exe' self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile)) # self.remove(self.dst_path_of(tempfile)) # If we're on a build machine, sign the code using our Authenticode certificate. JC sign_py = 'C:\\buildscripts\\code-signing\\sign.py' if os.path.exists(sign_py): self.run_command(sign_py + ' ' + self.dst_path_of(installer_file)) else: print "Skipping code signing,", sign_py, "does not exist" self.created_path(self.dst_path_of(installer_file)) self.package_file = installer_file
def package_finish(self): if 'signature' in self.args and 'VIEWER_SIGNING_PWD' in os.environ: try: self.sign(self.args['configuration']+"\\"+self.final_exe()) self.sign(self.args['configuration']+"\\SLPlugin.exe") self.sign(self.args['configuration']+"\\SLVoice.exe") except: print "Couldn't sign binaries. Tried to sign %s" % self.args['configuration'] + "\\" + self.final_exe() # a standard map of strings for replacing in the templates substitution_strings = { 'version' : '.'.join(self.args['version']), 'version_short' : '.'.join(self.args['version'][:-1]), 'version_dashes' : '-'.join(self.args['version']), 'final_exe' : self.final_exe(), 'flags':'', 'app_name':self.app_name(), 'app_name_oneword':self.app_name_oneword() } installer_file = self.installer_base_name() + '_Setup.exe' substitution_strings['installer_file'] = installer_file version_vars = """ !define INSTEXE "%(final_exe)s" !define VERSION "%(version_short)s" !define VERSION_LONG "%(version)s" !define VERSION_DASHES "%(version_dashes)s" """ % substitution_strings if self.channel_type() == 'release': substitution_strings['caption'] = CHANNEL_VENDOR_BASE else: substitution_strings['caption'] = self.app_name() + ' ${VERSION}' inst_vars_template = """ !define INSTOUTFILE "%(installer_file)s" !define INSTEXE "%(final_exe)s" !define APPNAME "%(app_name)s" !define APPNAMEONEWORD "%(app_name_oneword)s" !define VERSION "%(version_short)s" !define VERSION_LONG "%(version)s" !define VERSION_DASHES "%(version_dashes)s" !define URLNAME "secondlife" !define CAPTIONSTR "%(caption)s" !define VENDORSTR "Singularity Viewer Project" """ tempfile = "singularity_setup_tmp.nsi" # the following replaces strings in the nsi template # it also does python-style % substitution self.replace_in("installers/windows/installer_template.nsi", tempfile, { "%%VERSION%%":version_vars, "%%SOURCE%%":self.get_src_prefix(), "%%INST_VARS%%":inst_vars_template % substitution_strings, "%%INSTALL_FILES%%":self.nsi_file_commands(True), "%%DELETE_FILES%%":self.nsi_file_commands(False), "%%WIN64_BIN_BUILD%%":"!define WIN64_BIN_BUILD 1" if self.is_win64() else "", }) # We use the Unicode version of NSIS, available from # http://www.scratchpaper.com/ try: import _winreg as reg NSIS_path = reg.QueryValue(reg.HKEY_LOCAL_MACHINE, r"SOFTWARE\NSIS\Unicode") + '\\makensis.exe' self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)]) except: try: NSIS_path = os.environ['ProgramFiles'] + '\\NSIS\\Unicode\\makensis.exe' self.run_command([proper_windows_path(NSIS_path), self.dst_path_of(tempfile)]) except: NSIS_path = os.environ['ProgramFiles(X86)'] + '\\NSIS\\Unicode\\makensis.exe' self.run_command([proper_windows_path(NSIS_path),self.dst_path_of(tempfile)]) # self.remove(self.dst_path_of(tempfile)) if 'signature' in self.args and 'VIEWER_SIGNING_PWD' in os.environ: try: self.sign(self.args['configuration'] + "\\" + substitution_strings['installer_file']) except: print "Couldn't sign windows installer. Tried to sign %s" % self.args['configuration'] + "\\" + substitution_strings['installer_file'] self.created_path(self.dst_path_of(installer_file)) self.package_file = installer_file
def package_finish(self): # a standard map of strings for replacing in the templates substitution_strings = { 'version' : '.'.join(self.args['version']), 'version_short' : '.'.join(self.args['version'][:-1]), 'version_dashes' : '-'.join(self.args['version']), 'final_exe' : self.final_exe(), 'grid':self.args['grid'], 'grid_caps':self.args['grid'].upper(), # escape quotes becase NSIS doesn't handle them well 'flags':self.flags_list().replace('"', '$\\"'), 'channel':self.channel(), 'channel_oneword':self.channel_oneword(), 'channel_unique':self.channel_unique(), } version_vars = """ !define INSTEXE "%(final_exe)s" !define VERSION "%(version_short)s" !define VERSION_LONG "%(version)s" !define VERSION_DASHES "%(version_dashes)s" """ % substitution_strings if self.default_channel() and self.viewer_branding_id()=="secondlife": if self.default_grid(): # release viewer installer_file = "Second_Life_%(version_dashes)s_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define VIEWERNAME "Second Life" !define INSTFLAGS "%(flags)s" !define INSTNAME "SecondLife" !define SHORTCUT "Second Life" !define URLNAME "secondlife" !define INSTALL_ICON "install_icon.ico" !define UNINSTALL_ICON "uninstall_icon.ico" Caption "Second Life ${VERSION}" """ else: # beta grid viewer installer_file = "Second_Life_%(version_dashes)s_(%(grid_caps)s)_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define VIEWERNAME "Second Life" !define INSTFLAGS "%(flags)s" !define INSTNAME "SecondLife%(grid_caps)s" !define SHORTCUT "Second Life (%(grid_caps)s)" !define URLNAME "secondlife%(grid)s" !define INSTALL_ICON "install_icon.ico" !define UNINSTALL_ICON "uninstall_icon.ico" !define UNINSTALL_SETTINGS 1 Caption "Second Life %(grid)s ${VERSION}" """ elif self.viewer_branding_id()=="snowglobe": installer_file = "Snowglobe_%(version_dashes)s_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define VIEWERNAME "Snowglobe" !define INSTFLAGS "%(flags)s" !define INSTNAME "Snowglobe" !define SHORTCUT "Snowglobe" !define URLNAME "secondlife" !define INSTALL_ICON "install_icon_snowglobe.ico" !define UNINSTALL_ICON "uninstall_icon_snowglobe.ico" Caption "Snowglobe ${VERSION}" """ else: # some other channel on some grid installer_file = "Second_Life_%(version_dashes)s_%(channel_oneword)s_Setup.exe" grid_vars_template = """ OutFile "%(installer_file)s" !define INSTFLAGS "%(flags)s" !define INSTNAME "SecondLife%(channel_oneword)s" !define SHORTCUT "%(channel)s" !define URLNAME "secondlife" !define UNINSTALL_SETTINGS 1 Caption "%(channel)s ${VERSION}" """ if 'installer_name' in self.args: installer_file = self.args['installer_name'] else: installer_file = installer_file % substitution_strings substitution_strings['installer_file'] = installer_file tempfile = "secondlife_setup_tmp.nsi" # the following replaces strings in the nsi template # it also does python-style % substitution self.replace_in("installers/windows/installer_template.nsi", tempfile, { "%%VERSION%%":version_vars, "%%SOURCE%%":self.get_src_prefix(), "%%GRID_VARS%%":grid_vars_template % substitution_strings, "%%INSTALL_FILES%%":self.nsi_file_commands(True), "%%DELETE_FILES%%":self.nsi_file_commands(False)}) # We use the Unicode version of NSIS, available from # http://www.scratchpaper.com/ NSIS_path = 'C:\\Program Files\\NSIS\\Unicode\\makensis.exe' self.run_command('"' + proper_windows_path(NSIS_path) + '" ' + self.dst_path_of(tempfile)) # self.remove(self.dst_path_of(tempfile)) # If we're on a build machine, sign the code using our Authenticode certificate. JC sign_py = os.path.expandvars("{SIGN_PY}") if sign_py == "" or sign_py == "{SIGN_PY}": sign_py = 'C:\\buildscripts\\code-signing\\sign.py' if os.path.exists(sign_py): self.run_command('python ' + sign_py + ' ' + self.dst_path_of(installer_file)) else: print "Skipping code signing,", sign_py, "does not exist" self.created_path(self.dst_path_of(installer_file)) self.package_file = installer_file