Index: PCbuild/build_ssl.py =================================================================== --- PCbuild/build_ssl.py (revision 84924) +++ PCbuild/build_ssl.py (working copy) @@ -148,6 +148,23 @@ print(do_script) os.system(do_script) +def copy(src, dst): + """Copies file src to dst + + But file won't be copied when contents of two files are same + """ + if os.path.isfile(dst): + bufsize = 1024 * 8 + with open(src, "rb") as src_f, open(dst, "rb") as dst_f: + while True: + src_s = src_f.read(bufsize) + dst_s = dst_f.read(bufsize) + if src_s != dst_s: + break + if not src_s: + return + shutil.copy(src, dst) + def main(): build_all = "-a" in sys.argv if sys.argv[1] == "Release": @@ -224,15 +241,16 @@ if arch == "amd64": create_makefile64(makefile, m32) fix_makefile(makefile) - shutil.copy2(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch) - shutil.copy2(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch) + copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch) + copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch) # If the assembler files don't exist in tmpXX, copy them there if not os.path.exists("tmp"+dirsuffix): os.mkdir("tmp"+dirsuffix) for f in os.listdir("asm"+dirsuffix): if not f.endswith(".asm"): continue - shutil.copy2(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix) + if os.path.isfile(r"tmp%s\%s" % (dirsuffix, f)): continue + shutil.copy(r"asm%s\%s" % (dirsuffix, f), "tmp"+dirsuffix) # Now run make. if arch == "amd64": @@ -241,8 +259,8 @@ print("ml64 assembler has failed.") sys.exit(rc) - shutil.copy2(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h") - shutil.copy2(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h") + copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h") + copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h") #makeCommand = "nmake /nologo PERL=\"%s\" -f \"%s\"" %(perl, makefile) makeCommand = "nmake /nologo -f \"%s\"" % makefile