diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/lib/python/indra/util/llversion.py | 57 | ||||
-rw-r--r-- | indra/llvfs/lldir_win32.cpp | 42 |
2 files changed, 42 insertions, 57 deletions
diff --git a/indra/lib/python/indra/util/llversion.py b/indra/lib/python/indra/util/llversion.py index 2718a85f41..ba6f567b60 100644 --- a/indra/lib/python/indra/util/llversion.py +++ b/indra/lib/python/indra/util/llversion.py @@ -1,7 +1,9 @@ -"""@file llversion.py -@brief Utility for parsing llcommon/llversion${server}.h - for the version string and channel string - Utility that parses hg or svn info for branch and revision +#!/usr/bin/env python +"""\ +@file llversion.py +@brief Parses llcommon/llversionserver.h and llcommon/llversionviewer.h + for the version string and channel string. + Parses hg info for branch and revision. $LicenseInfo:firstyear=2006&license=mit$ @@ -27,7 +29,7 @@ THE SOFTWARE. $/LicenseInfo$ """ -import re, sys, os, commands +import re, sys, os, subprocess # Methods for gathering version information from # llversionviewer.h and llversionserver.h @@ -73,29 +75,13 @@ def get_viewer_channel(): def get_server_channel(): return get_channel('server') -# Methods for gathering subversion information -def get_svn_status_matching(regular_expression): - # Get the subversion info from the working source tree - status, output = commands.getstatusoutput('svn info %s' % get_src_root()) - m = regular_expression.search(output) - if not m: - print >> sys.stderr, "Failed to parse svn info output, result follows:" - print >> sys.stderr, output - raise Exception, "No matching svn status in "+src_root - return m.group(1) - -def get_svn_branch(): - branch_re = re.compile('URL: (\S+)') - return get_svn_status_matching(branch_re) - -def get_svn_revision(): - last_rev_re = re.compile('Last Changed Rev: (\d+)') - return get_svn_status_matching(last_rev_re) - +# Methods for gathering hg information def get_hg_repo(): - status, output = commands.getstatusoutput('hg showconfig paths.default') + child = subprocess.Popen(["hg","showconfig","paths.default"], stdout=subprocess.PIPE) + output, error = child.communicate() + status = child.returncode if status: - print >> sys.stderr, output + print >> sys.stderr, error sys.exit(1) if not output: print >> sys.stderr, 'ERROR: cannot find repo we cloned from' @@ -103,24 +89,19 @@ def get_hg_repo(): return output def get_hg_changeset(): - # The right thing to do: - # status, output = commands.getstatusoutput('hg id -i') - # if status: - # print >> sys.stderr, output - # sys.exit(1) - - # The temporary hack: - status, output = commands.getstatusoutput('hg parents --template "{rev}"') + # The right thing to do would be to use the *global* revision id: + # "hg id -i" + # For the moment though, we use the parent revision: + child = subprocess.Popen(["hg","parents","--template","{rev}"], stdout=subprocess.PIPE) + output, error = child.communicate() + status = child.returncode if status: - print >> sys.stderr, output + print >> sys.stderr, error sys.exit(1) lines = output.splitlines() if len(lines) > 1: print >> sys.stderr, 'ERROR: working directory has %d parents' % len(lines) return lines[0] -def using_svn(): - return os.path.isdir(os.path.join(get_src_root(), '.svn')) - def using_hg(): return os.path.isdir(os.path.join(get_src_root(), '.hg')) diff --git a/indra/llvfs/lldir_win32.cpp b/indra/llvfs/lldir_win32.cpp index b9a3995e25..4e2a55f4b3 100644 --- a/indra/llvfs/lldir_win32.cpp +++ b/indra/llvfs/lldir_win32.cpp @@ -81,10 +81,11 @@ LLDir_Win32::LLDir_Win32() // fprintf(stderr, "mTempDir = <%s>",mTempDir); -#if 1 - // Don't use the real app path for now, as we'll have to add parsing to detect if - // we're in a developer tree, which has a different structure from the installed product. + // Set working directory, for LLDir::getWorkingDir() + GetCurrentDirectory(MAX_PATH, w_str); + mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); + // Set the executable directory S32 size = GetModuleFileName(NULL, w_str, MAX_PATH); if (size) { @@ -100,32 +101,35 @@ LLDir_Win32::LLDir_Win32() { mExecutableFilename = mExecutablePathAndName; } - GetCurrentDirectory(MAX_PATH, w_str); - mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); } else { fprintf(stderr, "Couldn't get APP path, assuming current directory!"); - GetCurrentDirectory(MAX_PATH, w_str); - mExecutableDir = utf16str_to_utf8str(llutf16string(w_str)); + mExecutableDir = mWorkingDir; // Assume it's the current directory } -#else - GetCurrentDirectory(MAX_PATH, w_str); - mExecutableDir = utf16str_to_utf8str(llutf16string(w_str)); -#endif - if (mExecutableDir.find("indra") == std::string::npos) + // mAppRODataDir = "."; + + // Determine the location of the App-Read-Only-Data + // Try the working directory then the exe's dir. + mAppRODataDir = mWorkingDir; + + +// if (mExecutableDir.find("indra") == std::string::npos) + + // *NOTE:Mani - It is a mistake to put viewer specific code in + // the LLDir implementation. The references to 'skins' and + // 'llplugin' need to go somewhere else. + // alas... this also gets called during static initialization + // time due to the construction of gDirUtil in lldir.cpp. + if(! LLFile::isdir(mAppRODataDir + mDirDelimiter + "skins")) { - // Running from installed directory. Make sure current - // directory isn't something crazy (e.g. if invoking from - // command line). - SetCurrentDirectory(utf8str_to_utf16str(mExecutableDir).c_str()); - GetCurrentDirectory(MAX_PATH, w_str); - mWorkingDir = utf16str_to_utf8str(llutf16string(w_str)); + // What? No skins in the working dir? + // Try the executable's directory. + mAppRODataDir = mExecutableDir; } - mAppRODataDir = mWorkingDir; llinfos << "mAppRODataDir = " << mAppRODataDir << llendl; |