summaryrefslogtreecommitdiff
path: root/PCbuild/build_ssl.py
diff options
context:
space:
mode:
authorHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2010-09-24 16:36:34 +0000
committerHirokazu Yamamoto <ocean-city@m2.ccsnet.ne.jp>2010-09-24 16:36:34 +0000
commit5e83da3d0867c36b3cf5d63b1c72ae0615652f99 (patch)
treef940a12756ecc43f8173872fe78897c0b78ac19b /PCbuild/build_ssl.py
parente8e8042bb5f722481ce22be573e62a6d009c7dfe (diff)
downloadcpython-git-5e83da3d0867c36b3cf5d63b1c72ae0615652f99.tar.gz
Issue #9552: Avoid unnecessary rebuild of OpenSSL. (Windows)
Diffstat (limited to 'PCbuild/build_ssl.py')
-rw-r--r--PCbuild/build_ssl.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/PCbuild/build_ssl.py b/PCbuild/build_ssl.py
index cfcb0ac8f1..573bf4b84b 100644
--- a/PCbuild/build_ssl.py
+++ b/PCbuild/build_ssl.py
@@ -23,7 +23,6 @@
# python.exe build_ssl.py Release x64
# python.exe build_ssl.py Release Win32
-from __future__ import with_statement
import os, sys, re, shutil
# Find all "foo.exe" files on the PATH.
@@ -122,7 +121,6 @@ def fix_makefile(makefile):
"""
if not os.path.isfile(makefile):
return
- fin = open(makefile)
with open(makefile) as fin:
lines = fin.readlines()
with open(makefile, 'w') as fout:
@@ -148,6 +146,22 @@ def run_configure(configure, do_script):
print(do_script)
os.system(do_script)
+def cmp(f1, f2):
+ bufsize = 1024 * 8
+ with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
+ while True:
+ b1 = fp1.read(bufsize)
+ b2 = fp2.read(bufsize)
+ if b1 != b2:
+ return False
+ if not b1:
+ return True
+
+def copy(src, dst):
+ if os.path.isfile(dst) and cmp(src, dst):
+ return
+ shutil.copy(src, dst)
+
def main():
build_all = "-a" in sys.argv
if sys.argv[1] == "Release":
@@ -224,8 +238,8 @@ def main():
if arch == "amd64":
create_makefile64(makefile, m32)
fix_makefile(makefile)
- shutil.copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
- shutil.copy(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 perl is None:
@@ -243,8 +257,8 @@ def main():
print("ml64 assembler has failed.")
sys.exit(rc)
- shutil.copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
- shutil.copy(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