From 7abecb48babe6a6f09bf6692ba55076546cfced9 Mon Sep 17 00:00:00 2001 From: Jacek Antonelli Date: Mon, 1 Dec 2008 17:39:58 -0600 Subject: Second Life viewer sources 1.22.0-RC --- linden/scripts/install.py | 50 +++++++++++++++++++++++++++++++++++-- linden/scripts/template_verifier.py | 32 ++++++++++++++++++++---- 2 files changed, 75 insertions(+), 7 deletions(-) (limited to 'linden/scripts') diff --git a/linden/scripts/install.py b/linden/scripts/install.py index 0cc2fad..3e8f9bb 100755 --- a/linden/scripts/install.py +++ b/linden/scripts/install.py @@ -37,6 +37,7 @@ import copy import md5 import optparse import os +import platform import pprint import shutil import sys @@ -308,6 +309,13 @@ class Installer(object): "Return a list of installed packages." return self._installed.keys() + def detail_installed(self, name): + "Return file list for specific installed package." + filelist = [] + for url in self._installed[name]._installed.keys(): + filelist.extend(self._installed[name].files_in(url)) + return filelist + def _update_field(self, description, field, value, multiline=False): """Given a block and a field name, add or update it. @param description a dict containing all the details of a description. @@ -458,7 +466,12 @@ windows/i686/vs/2003 -- specify a windows visual studio 2003 package""" if not self._dryrun: if os.path.exists(filename): remove_dir_set.add(os.path.dirname(filename)) - os.remove(filename) + try: + os.remove(filename) + except OSError: + # This is just for cleanup, so we don't care + # about normal failures. + pass for dirname in remove_dir_set: try: os.removedirs(dirname) @@ -730,7 +743,23 @@ def _get_platform(): 'cygwin' : 'windows', 'solaris' : 'solaris' } - return platform_map[sys.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 + # 'linux64' platform with 'linux/x86_64/gcc/4.1' + this_platform = 'linux64' + else: + gcc_version = os.popen("g++ -dumpversion", 'r').read()[:-3] + if gcc_version == '4.1': + # the 'linux32' platform is a HACK until we can figure + # out how to make the install.py script accept a platform of + # the form os/arch/compiler/compiler_version for the download + # and extract stage + #this_platform = 'linux/i686/gcc/4.1' + this_platform = 'linux32' + return this_platform def _getuser(): "Get the user" @@ -971,6 +1000,12 @@ Ignored if --add-installable or --add-installable-package is not specified.""") dest='detail_installable', help="Get detailed information on specified installable and exit.") parser.add_option( + '--detail-installed', + type='string', + default=None, + dest='detail_installed', + help="Get list of files for specified installed installable and exit.") + parser.add_option( '--uninstall', action='store_true', default=False, @@ -1012,6 +1047,17 @@ def main(): print "Installable '"+options.detail_installable+"' not found in", print "install file." return 0 + if options.detail_installed: + try: + detail = installer.detail_installed(options.detail_installed) + #print "Detail on installed",options.detail_installed+":" + for line in detail: + print line + except: + raise + print "Installable '"+options.detail_installed+"' not found in ", + print "install file." + return 0 if options.list_licenses: print "license list:", installer.list_licenses() return 0 diff --git a/linden/scripts/template_verifier.py b/linden/scripts/template_verifier.py index f1f3953..d451cbf 100755 --- a/linden/scripts/template_verifier.py +++ b/linden/scripts/template_verifier.py @@ -38,13 +38,35 @@ If [FILE] [FILE] is specified, two local files will be checked against each other. """ -from os.path import realpath, dirname, join, exists -setup_path = join(dirname(realpath(__file__)), "setup-path.py") -if exists(setup_path): - execfile(setup_path) +import sys +import os.path + +# Look for indra/lib/python in all possible parent directories ... +# This is an improvement over the setup-path.py method used previously: +# * the script may blocated anywhere inside the source tree +# * it doesn't depend on the current directory +# * it doesn't depend on another file being present. + +root = os.path.abspath(__file__) +# always insert the directory of the script in the search path +dir = os.path.dirname(root) +if dir not in sys.path: + sys.path.insert(0, dir) + +# Now go look for indra/lib/python in the parent dies +while root != os.path.sep: + root = os.path.dirname(root) + dir = os.path.join(root, 'indra', 'lib', 'python') + if os.path.isdir(dir): + if dir not in sys.path: + sys.path.insert(0, dir) + break +else: + print >>sys.stderr, "This script is not inside a valid installation." + sys.exit(1) + import optparse import os -import sys import urllib from indra.ipc import compatibility -- cgit v1.1