[Python-Dev] Silly little benchmark

Skip Montanaro skip@pobox.com (Skip Montanaro)
Tue, 10 Jul 2001 21:30:39 -0500

    >> I can tell by the startup message that it was compiled with gcc
    >> 2.95.3, but not what optimization flags were used.

    Guido> If you did a full "make install" then and the results are still
    Guido> around, look in <prefix>/lib/python1.6/config/Makefile .

Thanks for the tip.  Since I just rebuilt 1.6 this evening I wiped out
whatever was there from last June.  Still, I now have that information at my

    def getbuildinfo():
        import sys, re, string
        makefile = "%s/lib/python%d.%d/config/Makefile" % \
                   (sys.prefix, sys.version_info[0], sys.version_info[1])
        f = open(makefile)
        pat = re.compile("^([A-Z_]+)\s*=\s*(.*)")
        lines = f.readlines()
        opts = {}
        for line in lines:
            mat = pat.match(line)
            if mat:
                name = mat.group(1)
                val = string.strip(mat.group(2))
                opts[name] = val
        return opts