[Rivet-svn] r2007 - bootstrap

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Wed Nov 4 19:59:18 GMT 2009


Author: buckley
Date: Wed Nov  4 19:59:17 2009
New Revision: 2007

Log:
Removing duplicate LCG tag computation, and using a regex to detect the SL(C) version a bit more robustly

Modified:
   bootstrap/rivet-bootstrap

Modified: bootstrap/rivet-bootstrap
==============================================================================
--- bootstrap/rivet-bootstrap	Wed Nov  4 17:03:56 2009	(r2006)
+++ bootstrap/rivet-bootstrap	Wed Nov  4 19:59:17 2009	(r2007)
@@ -41,108 +41,10 @@
         f.close()
         if "Scientific Linux" in sltest:
             #slversion = [int(i) for i in commands.getoutput("lsb_release -rs").split(".")]
-            slversion = [int(i) for i in sltest.split()[5].split(".")]
-            distribution = "slc%d" % slversion[0]
-    ## Mac tests
-    if distribution == "Darwin":
-        osxversion = (10,4)
-        macver = platform.mac_ver()[0]
-        if len(macver) > 0:
-            ver = macver.split(".")
-            osxversion = [int(i) for i in ver]
-        distribution = "mac%d%d" % (osxversion[0], osxversion[1])
-    ## Windows tests
-    if distribution == "Windows":
-        distribution = "winxp"
-    logging.debug("OS: " + distribution)
-
-
-    ## Get architecture
-    machine = platform.machine()
-    logging.debug("Architecture: " + machine)
-
-
-    ## Get compiler version
-    compiler_code = None
-    vcversion = None
-    if distribution != "winxp":
-        ## Get GCC version
-        GCC_CMD = "g++"
-        if os.environ.has_key("CC"):
-            GCC_CMD = os.environ["CC"]
-        elif os.environ.has_key("CXX"):
-            GCC_CMD = os.environ["CXX"]
-        gcc_version = commands.getoutput(GCC_CMD + ' --version | head -1 | cut -d" " -f3').split(".")
-        logging.debug("GCC version: " + str(gcc_version))
-        gcc_major = gcc_version[0]
-        gcc_minor = gcc_version[1]
-        gcc_micro = gcc_version[2]
-        compiler_code = "gcc%s%s" % (gcc_major, gcc_minor)
-    else:
-        ## Try to find VC version... somehow!
-        import distutils.msvccompiler as msvc
-        vcversions = sorted(msvc.get_devstudio_versions())
-        vcversion = vcversions[0]
-        compiler_code = "vc%s" % vcversion
-
-
-    ## the "future-proof" platform tag
-    LCGPLATFORM = "%s-%s-%s-%s" % (machine, distribution, compiler_code, "opt")
-
-
-    ## Historical platform tags
-    if vcversion is not None and vcversion < 9:
-        logging.debug("Computing old-style Windows tag to replace " + LCGPLATFORM)
-        LCGPLATFORM = "win32_vc71_dbg"
-    elif slversion is not None and slversion[0] < 5 or osxversion is not None and osxversion[1] < 6:
-        logging.debug("Computing old-style tag to replace " + LCGPLATFORM)
-
-        ## Different arch codes
-        if "64" in machine:
-            machine = "amd64"
-        else:
-            machine = "ia32"
-
-        ## Old Mac code is "osx" rather than "mac"
-        if osxversion:
-            distribution = distribution.replace("mac", "osx")
-
-        ## Historical exceptions for GCC version
-        if compiler_code in ["gcc32", "gcc40"]:
-            compiler_code += gcc_micro
-
-        ## For Macs, append "_dbg" if needed
-        LCGPLATFORM = "%s_%s_%s" % (distribution, machine, compiler_code)
-        if osxversion and opts.BUILD_TYPE == "dbg":
-            LCGPLATFORM += "_dbg"
-
-    return LCGPLATFORM
-
-
-
-##############################
-
-
-
-
-def compute_lcg_tag():
-    import platform
-
-    ## Get distribution
-    slversion = None
-    osxversion = None
-    distribution = platform.system()
-    ## SL tests
-    rhreleasepath = "/etc/redhat-release"
-    if os.path.exists(rhreleasepath):
-        distribution = "redhat"
-        f = open(rhreleasepath, "r")
-        #sltest = commands.getoutput("lsb_release -ds")
-        sltest = f.read()
-        f.close()
-        if "Scientific Linux" in sltest:
-            #slversion = [int(i) for i in commands.getoutput("lsb_release -rs").split(".")]
-            slversion = [int(i) for i in sltest.split()[5].split(".")]
+            import re
+            m = re.search(r'Scientific Linux.*? (\d)\.(\d).*', sltest)
+            if m:
+                slversion = [int(m.group(1)), int(m.group(2))]
             distribution = "slc%d" % slversion[0]
     ## Mac tests
     if distribution == "Darwin":


More information about the Rivet-svn mailing list