summaryrefslogtreecommitdiff
path: root/indra/lib
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2012-02-10 12:04:27 -0500
committerNat Goodspeed <nat@lindenlab.com>2012-02-10 12:04:27 -0500
commit028a05e79467e0c1fd7d63224fb447a964ab7a0b (patch)
tree1b06f4bfc24984d12112562f073fd8d5f0ca2d86 /indra/lib
parentd7f123ab526df7dbef153e0de71f325ab1b69571 (diff)
Use wildcards instead of many version-specific lib names on Linux.
viewer_manifest.py's Linux_i686Manifest class has contained directives to copy library files with names like (e.g.) "libapr-1.so.0.4.2", which means that every update to any such library requires messing with viewer_manifest.py. But LLManifest.path() claims to support wildcards, and it's more robust to specify "libapr-1.so*" instead. Unfortunately LLManifest.path()'s wildcard support only used to work for files in the source tree (vs. the artwork tree or the build tree). The logic in path() tries each tree in turn, relying on an exception to make it try the next tree. This exception was raised for a nonexistent specific filename -- but it never used to raise that exception for a wildcard matching 0 files. Instead it would simply report "0 files" and proceed, producing an invalid viewer install. Raise that exception for a wildcard matching nothing. This forces path() to consider the artwork tree and the build tree, permitting us to use wildcards in library names. Define an exception specific to LLManifest: ManifestException rather than the generic Python RuntimeException. Make it a subclass of RuntimeException so any existing callers expecting to catch RuntimeException will continue to work.
Diffstat (limited to 'indra/lib')
-rw-r--r--indra/lib/python/indra/util/llmanifest.py27
1 files changed, 18 insertions, 9 deletions
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index c33a03034a..237153b756 100644
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -41,6 +41,9 @@ import tarfile
import errno
import subprocess
+class ManifestError(RuntimeError):
+ pass
+
def path_ancestors(path):
drive, path = os.path.splitdrive(os.path.normpath(path))
result = []
@@ -180,6 +183,9 @@ def usage(srctree=""):
arg['description'] % nd)
def main():
+## import itertools
+## print ' '.join((("'%s'" % item) if ' ' in item else item)
+## for item in itertools.chain([sys.executable], sys.argv))
option_names = [arg['name'] + '=' for arg in ARGUMENTS]
option_names.append('help')
options, remainder = getopt.getopt(sys.argv[1:], "", option_names)
@@ -385,7 +391,7 @@ class LLManifest(object):
child.stdout.close()
status = child.wait()
if status:
- raise RuntimeError(
+ raise ManifestError(
"Command %s returned non-zero status (%s) \noutput:\n%s"
% (command, status, output) )
return output
@@ -395,7 +401,7 @@ class LLManifest(object):
a) verify that you really have created it
b) schedule it for cleanup"""
if not os.path.exists(path):
- raise RuntimeError, "Should be something at path " + path
+ raise ManifestError, "Should be something at path " + path
self.created_paths.append(path)
def put_in_file(self, contents, dst):
@@ -550,7 +556,7 @@ class LLManifest(object):
except (IOError, os.error), why:
errors.append((srcname, dstname, why))
if errors:
- raise RuntimeError, errors
+ raise ManifestError, errors
def cmakedirs(self, path):
@@ -598,13 +604,16 @@ class LLManifest(object):
def check_file_exists(self, path):
if not os.path.exists(path) and not os.path.islink(path):
- raise RuntimeError("Path %s doesn't exist" % (
- os.path.normpath(os.path.join(os.getcwd(), path)),))
+ raise ManifestError("Path %s doesn't exist" % (os.path.abspath(path),))
- wildcard_pattern = re.compile('\*')
+ wildcard_pattern = re.compile(r'\*')
def expand_globs(self, src, dst):
src_list = glob.glob(src)
+ # Assume that if caller specifies a wildcard, s/he wants it to match
+ # at least one file...
+ if not src_list:
+ raise ManifestError("Path %s doesn't exist" % (os.path.abspath(src),))
src_re, d_template = self.wildcard_regex(src.replace('\\', '/'),
dst.replace('\\', '/'))
for s in src_list:
@@ -615,7 +624,7 @@ class LLManifest(object):
sys.stdout.write("Processing %s => %s ... " % (src, dst))
sys.stdout.flush()
if src == None:
- raise RuntimeError("No source file, dst is " + dst)
+ raise ManifestError("No source file, dst is " + dst)
if dst == None:
dst = src
dst = os.path.join(self.get_dst_prefix(), dst)
@@ -639,10 +648,10 @@ class LLManifest(object):
return count
try:
count = try_path(os.path.join(self.get_src_prefix(), src))
- except RuntimeError:
+ except ManifestError:
try:
count = try_path(os.path.join(self.get_artwork_prefix(), src))
- except RuntimeError:
+ except ManifestError:
count = try_path(os.path.join(self.get_build_prefix(), src))
print "%d files" % count