Skip to content

Commit 5e83da3

Browse files
author
Hirokazu Yamamoto
committed
Issue python#9552: Avoid unnecessary rebuild of OpenSSL. (Windows)
1 parent e8e8042 commit 5e83da3

10 files changed

Lines changed: 464 additions & 42 deletions

File tree

PC/VS8.0/_hashlib.vcproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
>
2828
<Tool
2929
Name="VCPreBuildEventTool"
30-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
3130
/>
3231
<Tool
3332
Name="VCCustomBuildTool"
@@ -89,7 +88,6 @@
8988
>
9089
<Tool
9190
Name="VCPreBuildEventTool"
92-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
9391
/>
9492
<Tool
9593
Name="VCCustomBuildTool"
@@ -153,7 +151,6 @@
153151
>
154152
<Tool
155153
Name="VCPreBuildEventTool"
156-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
157154
/>
158155
<Tool
159156
Name="VCCustomBuildTool"
@@ -216,7 +213,6 @@
216213
>
217214
<Tool
218215
Name="VCPreBuildEventTool"
219-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
220216
/>
221217
<Tool
222218
Name="VCCustomBuildTool"
@@ -280,7 +276,6 @@
280276
>
281277
<Tool
282278
Name="VCPreBuildEventTool"
283-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
284279
/>
285280
<Tool
286281
Name="VCCustomBuildTool"
@@ -343,7 +338,6 @@
343338
>
344339
<Tool
345340
Name="VCPreBuildEventTool"
346-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
347341
/>
348342
<Tool
349343
Name="VCCustomBuildTool"
@@ -408,7 +402,6 @@
408402
>
409403
<Tool
410404
Name="VCPreBuildEventTool"
411-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
412405
/>
413406
<Tool
414407
Name="VCCustomBuildTool"
@@ -471,7 +464,6 @@
471464
>
472465
<Tool
473466
Name="VCPreBuildEventTool"
474-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
475467
/>
476468
<Tool
477469
Name="VCCustomBuildTool"

PC/VS8.0/_ssl.vcproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
>
2828
<Tool
2929
Name="VCPreBuildEventTool"
30-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
3130
/>
3231
<Tool
3332
Name="VCCustomBuildTool"
@@ -89,7 +88,6 @@
8988
>
9089
<Tool
9190
Name="VCPreBuildEventTool"
92-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
9391
/>
9492
<Tool
9593
Name="VCCustomBuildTool"
@@ -153,7 +151,6 @@
153151
>
154152
<Tool
155153
Name="VCPreBuildEventTool"
156-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
157154
/>
158155
<Tool
159156
Name="VCCustomBuildTool"
@@ -216,7 +213,6 @@
216213
>
217214
<Tool
218215
Name="VCPreBuildEventTool"
219-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
220216
/>
221217
<Tool
222218
Name="VCCustomBuildTool"
@@ -280,7 +276,6 @@
280276
>
281277
<Tool
282278
Name="VCPreBuildEventTool"
283-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
284279
/>
285280
<Tool
286281
Name="VCCustomBuildTool"
@@ -343,7 +338,6 @@
343338
>
344339
<Tool
345340
Name="VCPreBuildEventTool"
346-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
347341
/>
348342
<Tool
349343
Name="VCCustomBuildTool"
@@ -408,7 +402,6 @@
408402
>
409403
<Tool
410404
Name="VCPreBuildEventTool"
411-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
412405
/>
413406
<Tool
414407
Name="VCCustomBuildTool"
@@ -471,7 +464,6 @@
471464
>
472465
<Tool
473466
Name="VCPreBuildEventTool"
474-
CommandLine="cd &quot;$(SolutionDir)&quot;&#x0D;&#x0A;&quot;$(PythonExe)&quot; build_ssl.py Release $(PlatformName) -a&#x0D;&#x0A;"
475467
/>
476468
<Tool
477469
Name="VCCustomBuildTool"

PC/VS8.0/build_ssl.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,22 @@ def run_configure(configure, do_script):
146146
print(do_script)
147147
os.system(do_script)
148148

149+
def cmp(f1, f2):
150+
bufsize = 1024 * 8
151+
with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
152+
while True:
153+
b1 = fp1.read(bufsize)
154+
b2 = fp2.read(bufsize)
155+
if b1 != b2:
156+
return False
157+
if not b1:
158+
return True
159+
160+
def copy(src, dst):
161+
if os.path.isfile(dst) and cmp(src, dst):
162+
return
163+
shutil.copy(src, dst)
164+
149165
def main():
150166
build_all = "-a" in sys.argv
151167
if sys.argv[1] == "Release":
@@ -222,8 +238,8 @@ def main():
222238
if arch == "amd64":
223239
create_makefile64(makefile, m32)
224240
fix_makefile(makefile)
225-
shutil.copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
226-
shutil.copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
241+
copy(r"crypto\buildinf.h", r"crypto\buildinf_%s.h" % arch)
242+
copy(r"crypto\opensslconf.h", r"crypto\opensslconf_%s.h" % arch)
227243

228244
# If the assembler files don't exist in tmpXX, copy them there
229245
if perl is None:
@@ -241,8 +257,8 @@ def main():
241257
print("ml64 assembler has failed.")
242258
sys.exit(rc)
243259

244-
shutil.copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
245-
shutil.copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
260+
copy(r"crypto\buildinf_%s.h" % arch, r"crypto\buildinf.h")
261+
copy(r"crypto\opensslconf_%s.h" % arch, r"crypto\opensslconf.h")
246262

247263
#makeCommand = "nmake /nologo PERL=\"%s\" -f \"%s\"" %(perl, makefile)
248264
makeCommand = "nmake /nologo -f \"%s\"" % makefile

PC/VS8.0/pcbuild.sln

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_ssl", "_ssl.vcproj", "{C6E
7474
{B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}
7575
{86937F53-C189-40EF-8CE8-8759D8E7D480} = {86937F53-C189-40EF-8CE8-8759D8E7D480}
7676
{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
77+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0} = {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}
7778
EndProjectSection
7879
EndProject
7980
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_testcapi", "_testcapi.vcproj", "{6901D91C-6E48-4BB7-9FEC-700C8131DF1D}"
@@ -112,6 +113,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_hashlib", "_hashlib.vcproj
112113
ProjectSection(ProjectDependencies) = postProject
113114
{B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}
114115
{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
116+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0} = {E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}
115117
EndProjectSection
116118
EndProject
117119
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sqlite3", "sqlite3.vcproj", "{A1A295E5-463C-437F-81CA-1F32367685DA}"
@@ -124,6 +126,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "_multiprocessing", "_multip
124126
{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26} = {CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}
125127
EndProjectSection
126128
EndProject
129+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ssl", "ssl.vcproj", "{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}"
130+
ProjectSection(ProjectDependencies) = postProject
131+
{B11D750F-CD1F-4A96-85CE-E69A5C5259F9} = {B11D750F-CD1F-4A96-85CE-E69A5C5259F9}
132+
EndProjectSection
133+
EndProject
127134
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kill_python", "kill_python.vcproj", "{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}"
128135
EndProject
129136
Global
@@ -514,6 +521,22 @@ Global
514521
{9E48B300-37D1-11DD-8C41-005056C00008}.Release|Win32.Build.0 = Release|Win32
515522
{9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.ActiveCfg = Release|x64
516523
{9E48B300-37D1-11DD-8C41-005056C00008}.Release|x64.Build.0 = Release|x64
524+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|Win32.ActiveCfg = Debug|Win32
525+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|Win32.Build.0 = Debug|Win32
526+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|x64.ActiveCfg = Debug|x64
527+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Debug|x64.Build.0 = Debug|x64
528+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|Win32.ActiveCfg = PGInstrument|Win32
529+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|Win32.Build.0 = PGInstrument|Win32
530+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|x64.ActiveCfg = PGInstrument|x64
531+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGInstrument|x64.Build.0 = PGInstrument|x64
532+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|Win32.ActiveCfg = PGUpdate|Win32
533+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|Win32.Build.0 = PGUpdate|Win32
534+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|x64.ActiveCfg = PGUpdate|x64
535+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.PGUpdate|x64.Build.0 = PGUpdate|x64
536+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|Win32.ActiveCfg = Release|Win32
537+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|Win32.Build.0 = Release|Win32
538+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|x64.ActiveCfg = Release|x64
539+
{E5B04CC0-EB4C-42AB-B4DC-18EF95F864B0}.Release|x64.Build.0 = Release|x64
517540
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.ActiveCfg = Debug|Win32
518541
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|Win32.Build.0 = Debug|Win32
519542
{6DE10744-E396-40A5-B4E2-1B69AA7C8D31}.Debug|x64.ActiveCfg = Debug|x64

0 commit comments

Comments
 (0)