diff --git a/scripts/install.py b/scripts/install.py index e53f664b4..e027c7322 100755 --- a/scripts/install.py +++ b/scripts/install.py @@ -134,12 +134,12 @@ class InstallFile(object): print "Found matching package:", self.filename return print "Downloading",self.url,"to local file",self.filename - + request = urllib2.Request(self.url) - + if re.match("/^http:\/\/github.com/", self.url): - request.add_header('User-agent', defaultUserAgent) - + request.add_header('User-agent', defaultUserAgent) + file(self.filename, 'wb').write(urllib2.urlopen(request).read()) if self.md5sum and not self._is_md5sum_match(): raise RuntimeError("Error matching md5 for %s" % self.url) @@ -379,7 +379,7 @@ class Installer(object): def _update_installable(self, name, platform, url, md5sum): """Update installable entry with specific package information. - @param installable[in,out] a dict containing installable details. + @param installable[in,out] a dict containing installable details. @param platform Platform info, i.e. linux/i686, windows/i686 etc. @param url URL of tar file @param md5sum md5sum of tar file @@ -420,16 +420,16 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" print "Updating installable '" + name + "'." for arg in ('platform', 'url', 'md5sum'): if not kwargs[arg]: - if arg == 'platform': + if arg == 'platform': print platform_help_str kwargs[arg] = raw_input("Package "+arg+":") #path = kwargs['platform'].split('/') - return self._update_installable(name, kwargs['platform'], + return self._update_installable(name, kwargs['platform'], kwargs['url'], kwargs['md5sum']) def add_installable_metadata(self, name, **kwargs): - """Interactively add (only) library metadata into install, + """Interactively add (only) library metadata into install, w/o adding installable""" if name not in self._installables: print "Adding installable '" + name + "'." @@ -531,8 +531,8 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" """ ifiles = [] for bin in self._installables: - ifiles.extend(self._installables[bin].ifiles(bin, - platform, + ifiles.extend(self._installables[bin].ifiles(bin, + platform, cache_dir)) to_install = [] to_uninstall = [] @@ -579,7 +579,7 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" target = os.path.basename(tfile) soname = os.popen("readelf -d \"%(install_dir)s/%(tfile)s\" %(stderr_redirect)s" " | grep SONAME | sed -e 's/.*\[//;s/\].*//'" % - {"install_dir": install_dir, "tfile": tfile, "stderr_redirect": ("2>/dev/null" if self._dryrun else "")}).read() + {"install_dir": install_dir, "tfile": tfile, "stderr_redirect": ("2>/dev/null" if self._dryrun else "")}).read() soname = soname.strip() if soname: # not empty tmpfname = os.path.dirname(LINK) + "/" + soname @@ -634,13 +634,13 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" self.uninstall(to_uninstall, install_dir) self._install(to_install, install_dir) - def do_install(self, installables, platform, install_dir, cache_dir=None, + def do_install(self, installables, platform, install_dir, cache_dir=None, check_license=True, scp=None): """Determine what installables should be installed. If they were passed in on the command line, use them, otherwise install all known installables. """ - if not cache_dir: + if not cache_dir: cache_dir = _default_installable_cache() all_installables = self.list_installables() if not len(installables): @@ -651,7 +651,7 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" install_installables = installables for installable in install_installables: if installable not in all_installables: - raise RuntimeError('Unknown installable: %s' % + raise RuntimeError('Unknown installable: %s' % (installable,)) if check_license: # *TODO: check against a list of 'known good' licenses. @@ -660,13 +660,13 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" for installable in install_installables: if not self.is_valid_license(installable): return 1 - + # Set up the 'scp' handler opener = urllib2.build_opener() scp_or_http = SCPOrHTTPHandler(scp) opener.add_handler(scp_or_http) urllib2.install_opener(opener) - + # Do the work of installing the requested installables. self.install( install_installables, @@ -680,7 +680,7 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" if pkg not in self._installed: raise RuntimeError("No '%s' available for '%s'." % (pkg, platform)) - + def do_uninstall(self, installables, install_dir): # Do not bother to check license if we're uninstalling. all_installed = self.list_installed() @@ -692,7 +692,7 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" uninstall_installables = installables for installable in uninstall_installables: if installable not in all_installed: - raise RuntimeError('Installable not installed: %s' % + raise RuntimeError('Installable not installed: %s' % (installable,)) self.uninstall(uninstall_installables, install_dir) @@ -815,8 +815,8 @@ def _get_platform(): this_platform = platform_map[sys.platform] if this_platform == 'linux': if platform.architecture()[0] == '64bit': - # TODO -- someday when install.py accepts a platform of the form - # os/arch/compiler/compiler_version then we can replace the + # TODO -- someday when install.py accepts a platform of the form + # os/arch/compiler/compiler_version then we can replace the # 'linux64' platform with 'linux/x86_64/gcc/4.1' this_platform = 'linux64' return this_platform @@ -832,7 +832,7 @@ def _getuser(): return win32api.GetUserName() def _default_installable_cache(): - """In general, the installable files do not change much, so find a + """In general, the installable files do not change much, so find a host/user specific location to cache files.""" user = _getuser() cache_dir = "/var/tmp/%s/install.cache" % user @@ -882,75 +882,75 @@ linux/x86_64/gcc/4.0 darwin/universal/gcc/4.0 """) parser.add_option( - '--dry-run', + '--dry-run', action='store_true', default=False, dest='dryrun', help='Do not actually install files. Downloads will still happen.') parser.add_option( - '--install-manifest', + '--install-manifest', type='string', default=os.path.join(base_dir, 'install.xml'), dest='install_filename', help='The file used to describe what should be installed.') parser.add_option( - '--installed-manifest', + '--installed-manifest', type='string', default=os.path.join(base_dir, 'installed.xml'), dest='installed_filename', help='The file used to record what is installed.') parser.add_option( - '--export-manifest', + '--export-manifest', action='store_true', default=False, dest='export_manifest', help="Print the install manifest to stdout and exit.") parser.add_option( - '-p', '--platform', + '-p', '--platform', type='string', default=_get_platform(), dest='platform', help="""Override the automatically determined platform. \ You can specify 'all' to do a installation of installables for all platforms.""") parser.add_option( - '--cache-dir', + '--cache-dir', type='string', default=_default_installable_cache(), dest='cache_dir', help='Where to download files. Default: %s'% \ (_default_installable_cache())) parser.add_option( - '--install-dir', + '--install-dir', type='string', default=base_dir, dest='install_dir', help='Where to unpack the installed files.') parser.add_option( - '--list-installed', + '--list-installed', action='store_true', default=False, dest='list_installed', help="List the installed package names and exit.") parser.add_option( - '--skip-license-check', + '--skip-license-check', action='store_false', default=True, dest='check_license', help="Do not perform the license check.") parser.add_option( - '--list-licenses', + '--list-licenses', action='store_true', default=False, dest='list_licenses', help="List known licenses and exit.") parser.add_option( - '--detail-license', + '--detail-license', type='string', default=None, dest='detail_license', help="Get detailed information on specified license and exit.") parser.add_option( - '--add-license', + '--add-license', type='string', default=None, dest='new_license', @@ -959,114 +959,114 @@ license. Specify --license-url if the license is remote or specify \ --license-text, otherwse the license text will be read from standard \ input.""") parser.add_option( - '--license-url', + '--license-url', type='string', default=None, dest='license_url', help="""Put the specified url into an added license. \ Ignored if --add-license is not specified.""") parser.add_option( - '--license-text', + '--license-text', type='string', default=None, dest='license_text', help="""Put the text into an added license. \ Ignored if --add-license is not specified.""") parser.add_option( - '--remove-license', + '--remove-license', type='string', default=None, dest='remove_license', help="Remove a named license.") parser.add_option( - '--remove-installable', + '--remove-installable', type='string', default=None, dest='remove_installable', help="Remove a installable from the install file.") parser.add_option( - '--add-installable', + '--add-installable', type='string', default=None, dest='add_installable', - help="""Add a installable into the install file. Argument is \ + help="""Add a installable into the install file. Argument is \ the name of the installable to add.""") parser.add_option( - '--add-installable-metadata', + '--add-installable-metadata', type='string', default=None, dest='add_installable_metadata', help="""Add package for library into the install file. Argument is \ the name of the library to add.""") parser.add_option( - '--installable-copyright', + '--installable-copyright', type='string', default=None, dest='installable_copyright', help="""Copyright for specified new package. Ignored if \ --add-installable is not specified.""") parser.add_option( - '--installable-license', + '--installable-license', type='string', default=None, dest='installable_license', help="""Name of license for specified new package. Ignored if \ --add-installable is not specified.""") parser.add_option( - '--installable-description', + '--installable-description', type='string', default=None, dest='installable_description', help="""Description for specified new package. Ignored if \ --add-installable is not specified.""") parser.add_option( - '--add-installable-package', + '--add-installable-package', type='string', default=None, dest='add_installable_package', help="""Add package for library into the install file. Argument is \ the name of the library to add.""") parser.add_option( - '--package-platform', + '--package-platform', type='string', default=None, dest='package_platform', help="""Platform for specified new package. \ Ignored if --add-installable or --add-installable-package is not specified.""") parser.add_option( - '--package-url', + '--package-url', type='string', default=None, dest='package_url', help="""URL for specified package. \ Ignored if --add-installable or --add-installable-package is not specified.""") parser.add_option( - '--package-md5', + '--package-md5', type='string', default=None, dest='package_md5', help="""md5sum for new package. \ Ignored if --add-installable or --add-installable-package is not specified.""") parser.add_option( - '--list', + '--list', action='store_true', default=False, dest='list_installables', help="List the installables in the install manifest and exit.") parser.add_option( - '--detail', + '--detail', type='string', default=None, dest='detail_installable', help="Get detailed information on specified installable and exit.") parser.add_option( - '--detail-installed', + '--detail-installed', type='string', default=None, dest='detail_installed', help="Get list of files for specified installed installable and exit.") parser.add_option( - '--uninstall', + '--uninstall', action='store_true', default=False, dest='uninstall', @@ -1074,7 +1074,7 @@ Ignored if --add-installable or --add-installable-package is not specified.""") during installation, if no installables are listed then all installed \ installables are removed.""") parser.add_option( - '--scp', + '--scp', type='string', default='scp', dest='scp', @@ -1179,9 +1179,9 @@ def main(): elif options.uninstall: installer.do_uninstall(args, options.install_dir) else: - installer.do_install(args, options.platform, options.install_dir, - options.cache_dir, options.check_license, - options.scp) + installer.do_install(args, options.platform, options.install_dir, + options.cache_dir, options.check_license, + options.scp) # save out any changes installer.save() diff --git a/scripts/public_fetch_tarballs.py b/scripts/public_fetch_tarballs.py index 7f7439108..455a42549 100755 --- a/scripts/public_fetch_tarballs.py +++ b/scripts/public_fetch_tarballs.py @@ -134,8 +134,8 @@ def extract_tarball_sans_linden(filename, targetdir): archive.extract(tarentry) archive.close() -# Extract either .tar.gz file or .zip file to targetdir, stripping off the -# leading "linden" directory, but leaving the directory structure otherwise +# Extract either .tar.gz file or .zip file to targetdir, stripping off the +# leading "linden" directory, but leaving the directory structure otherwise # intact. def extract_archive_sans_linden(filename, targetdir): if(filename.endswith('.tar.gz')): @@ -143,7 +143,7 @@ def extract_archive_sans_linden(filename, targetdir): elif(filename.endswith('.zip')): extract_zipfile_sans_linden(filename, targetdir) else: - raise Exception, "Unhandled archive type" + raise Exception, "Unhandled archive type" def get_assetnames_by_platform(platform): assetnames=['SLASSET_ART'] @@ -170,7 +170,7 @@ def _get_platform(): # copied from install.py def _default_installable_cache(): - """In general, the installable files do not change much, so find a + """In general, the installable files do not change much, so find a host/user specific location to cache files.""" user = _getuser() cache_dir = "/var/tmp/%s/install.cache" % user @@ -215,7 +215,7 @@ Example: the corresponding asset bundle into your source tree. """) parser.add_option( - '-p', '--platform', + '-p', '--platform', type='choice', default=_get_platform(), dest='platform', @@ -225,14 +225,14 @@ You can specify 'all' to get assets for all platforms. Choices: windows, \ darwin, linux, solaris, or all. Default: autodetected (%s)""" % \ _get_platform()) parser.add_option( - '--cache-dir', + '--cache-dir', type='string', default=_default_installable_cache(), dest='cache_dir', help='Where to download files. Default: %s'% \ (_default_installable_cache())) parser.add_option( - '--install-dir', + '--install-dir', type='string', default=base_dir, dest='install_dir', @@ -278,4 +278,3 @@ def main(argv): # execute main() only if invoked directly: if __name__ == "__main__": sys.exit(main(sys.argv)) - diff --git a/scripts/template_verifier.py b/scripts/template_verifier.py index 8bb5e1d76..cc112d130 100755 --- a/scripts/template_verifier.py +++ b/scripts/template_verifier.py @@ -78,8 +78,8 @@ from indra.ipc import tokenstream from indra.ipc import llmessage def getstatusall(command): - """ Like commands.getstatusoutput, but returns stdout and - stderr separately(to get around "killed by signal 15" getting + """ Like commands.getstatusoutput, but returns stdout and + stderr separately(to get around "killed by signal 15" getting included as part of the file). Also, works on Windows.""" (input, out, err) = os.popen3(command, 't') status = input.close() # send no input to the command @@ -103,7 +103,7 @@ MESSAGE_TEMPLATE = 'message_template.msg' PRODUCTION_ACCEPTABLE = (compatibility.Same, compatibility.Newer) DEVELOPMENT_ACCEPTABLE = ( compatibility.Same, compatibility.Newer, - compatibility.Older, compatibility.Mixed) + compatibility.Older, compatibility.Mixed) MAX_MASTER_AGE = 60 * 60 * 4 # refresh master cache every 4 hours @@ -146,7 +146,7 @@ def fetch(url): return open(file_name).read() else: # *FIX: this doesn't throw an exception for a 404, and oddly enough the sl.com 404 page actually gets parsed successfully - return ''.join(urllib.urlopen(url).readlines()) + return ''.join(urllib.urlopen(url).readlines()) def cache_master(master_url): """Using the url for the master, updates the local cache, and returns an url to the local cache.""" @@ -251,7 +251,7 @@ http://wiki.secondlife.com/wiki/Template_verifier.py elif len(args) == 1: master_url = None current_filename = args[0] - print "master:", options.master_url + print "master:", options.master_url print "current:", current_filename current_url = 'file://%s' % current_filename # nothing specified, use defaults for everything @@ -263,7 +263,7 @@ http://wiki.secondlife.com/wiki/Template_verifier.py if master_url is None: master_url = options.master_url - + if current_url is None: current_filename = local_template_filename() print "master:", options.master_url @@ -291,7 +291,7 @@ http://wiki.secondlife.com/wiki/Template_verifier.py print "Syntax-checking the local template ONLY, no compatibility check is being run." print "Cause: %s\n\n" % e return 0 - + acceptable, compat = compare( master_parsed, current_parsed, options.mode) @@ -308,5 +308,3 @@ http://wiki.secondlife.com/wiki/Template_verifier.py if __name__ == '__main__': sys.exit(run(sys.argv[1:])) - - diff --git a/scripts/update_source_contributors.py b/scripts/update_source_contributors.py index 6d8fceeaf..a37a6b2dc 100755 --- a/scripts/update_source_contributors.py +++ b/scripts/update_source_contributors.py @@ -2,7 +2,7 @@ # -*- coding: UTF-8 -*- """\ @file update_source_contributors.py -@brief Update the source contributor list in one place, instead of having +@brief Update the source contributor list in one place, instead of having to substitute by hand. Derived from update_viewer_version.py $LicenseInfo:firstyear=2006&license=viewergpl$ @@ -98,7 +98,7 @@ Options: --verbose --help Print this message and exit. - + """ def _getstatusoutput(cmd): """Return Win32 (status, output) of executing cmd @@ -200,4 +200,3 @@ def main(): return 0 main() - diff --git a/scripts/update_version_files.py b/scripts/update_version_files.py index 57fc45662..864a154ed 100755 --- a/scripts/update_version_files.py +++ b/scripts/update_version_files.py @@ -1,7 +1,7 @@ #!/usr/bin/python """\ @file update_version_files.py -@brief Update all of the various files in the repository to a new +@brief Update all of the various files in the repository to a new version number, instead of having to figure it out by hand $LicenseInfo:firstyear=2006&license=viewergpl$ @@ -96,20 +96,20 @@ Common Uses: update_version_files.py --skip-on-branch='^Branch_' # Update server and viewer version numbers explicitly: - update_version_files.py --version=1.18.1.6 - + update_version_files.py --version=1.18.1.6 + # Update just the viewer version number explicitly: - update_version_files.py --viewer --version=1.18.1.6 + update_version_files.py --viewer --version=1.18.1.6 # Update just the server build number to the current SVN revision: update_version_files.py --server - + # Update the viewer channel update_version_files.py --channel="First Look Puppeteering" - + # Update the server channel update_version_files.py --server_channel="Het Grid" - + """ def _getstatusoutput(cmd): """Return Win32 (status, output) of executing cmd @@ -304,4 +304,3 @@ def main(): return 0 main() -