Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/PC/VC6/build_ssl.py

    r2 r391  
    1313# it should configure and build SSL, then build the ssl Python extension
    1414# without intervention.
     15
     16# Modified by Christian Heimes
     17# Now this script supports pre-generated makefiles and assembly files.
     18# Developers don't need an installation of Perl anymore to build Python. A svn
     19# checkout from our svn repository is enough.
    1520
    1621import os, sys, re, shutil
     
    3742def find_working_perl(perls):
    3843    for perl in perls:
    39         fh = os.popen(perl + ' -e "use Win32;"')
     44        fh = os.popen('"%s" -e "use Win32;"' % perl)
    4045        fh.read()
    4146        rc = fh.close()
     
    121126    os.system(do_script)
    122127
     128def cmp(f1, f2):
     129    bufsize = 1024 * 8
     130    with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
     131        while True:
     132            b1 = fp1.read(bufsize)
     133            b2 = fp2.read(bufsize)
     134            if b1 != b2:
     135                return False
     136            if not b1:
     137                return True
     138
     139def copy(src, dst):
     140    if os.path.isfile(dst) and cmp(src, dst):
     141        return
     142    shutil.copy(src, dst)
     143
    123144def main():
    124145    debug = "-d" in sys.argv
     
    130151        makefile="ms\\nt.mak"
    131152        m32 = makefile
     153        dirsuffix = "32"
    132154    configure += " no-idea no-rc5 no-mdc2"
    133155    make_flags = ""
     
    138160    perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"])
    139161    perl = find_working_perl(perls)
    140     if perl is None:
     162    if perl:
     163        print "Found a working perl at '%s'" % (perl,)
     164    else:
    141165        print "No Perl installation was found. Existing Makefiles are used."
    142     else:
    143         print "Found a working perl at '%s'" % (perl,)
    144166    sys.stdout.flush()
    145     # Look for SSL 3 levels up from pcbuild - ie, same place zlib etc all live.
     167    # Look for SSL 3 levels up from PC/VC6 - ie, same place zlib etc all live.
    146168    ssl_dir = find_best_ssl_dir(("..\\..\\..",))
    147169    if ssl_dir is None:
     
    174196
    175197            fix_makefile(makefile)
    176             shutil.copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
    177             shutil.copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
     198            copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
     199            copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
     200
     201        # If the assembler files don't exist in tmpXX, copy them there
     202        if perl is None:
     203            if not os.path.exists("tmp"+dirsuffix):
     204                os.mkdir("tmp"+dirsuffix)
     205            for f in os.listdir("asm"+dirsuffix):
     206                if not f.endswith(".asm"): continue
     207                if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue
     208                shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix)
    178209
    179210        # Now run make.
    180         shutil.copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
    181         shutil.copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
     211        copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
     212        copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
    182213
    183214        #makeCommand = "nmake /nologo PERL=\"%s\" -f \"%s\"" %(perl, makefile)
Note: See TracChangeset for help on using the changeset viewer.