@@ -46,7 +46,7 @@ def find_all_on_path(filename, extras = None):
4646# is available.
4747def find_working_perl (perls ):
4848 for perl in perls :
49- fh = os .popen ('"%s" -e "use Win32;"' % perl )
49+ fh = os .popen ('"" %s" -e "use Win32;" "' % perl )
5050 fh .read ()
5151 rc = fh .close ()
5252 if rc :
@@ -63,37 +63,13 @@ def find_working_perl(perls):
6363 print (" Please install ActivePerl and ensure it appears on your path" )
6464 return None
6565
66- # Locate the best SSL directory given a few roots to look into.
67- def find_best_ssl_dir (sources ):
68- candidates = []
69- for s in sources :
70- try :
71- # note: do not abspath s; the build will fail if any
72- # higher up directory name has spaces in it.
73- fnames = os .listdir (s )
74- except os .error :
75- fnames = []
76- for fname in fnames :
77- fqn = os .path .join (s , fname )
78- if os .path .isdir (fqn ) and fname .startswith ("openssl-" ):
79- candidates .append (fqn )
80- # Now we have all the candidates, locate the best.
81- best_parts = []
82- best_name = None
83- for c in candidates :
84- parts = re .split ("[.-]" , os .path .basename (c ))[1 :]
85- # eg - openssl-0.9.7-beta1 - ignore all "beta" or any other qualifiers
86- if len (parts ) >= 4 :
87- continue
88- if parts > best_parts :
89- best_parts = parts
90- best_name = c
91- if best_name is not None :
92- print ("Found an SSL directory at '%s'" % (best_name ,))
93- else :
94- print ("Could not find an SSL directory in '%s'" % (sources ,))
95- sys .stdout .flush ()
96- return best_name
66+ # Fetch SSL directory from VC properties
67+ def get_ssl_dir ():
68+ propfile = (os .path .join (os .path .dirname (__file__ ), 'pyproject.props' ))
69+ with open (propfile ) as f :
70+ m = re .search ('openssl-([^<]+)<' , f .read ())
71+ return "..\..\openssl-" + m .group (1 )
72+
9773
9874def create_makefile64 (makefile , m32 ):
9975 """Create and fix makefile for 64bit
@@ -202,7 +178,7 @@ def main():
202178 print ("No Perl installation was found. Existing Makefiles are used." )
203179 sys .stdout .flush ()
204180 # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live.
205- ssl_dir = find_best_ssl_dir (( ".. \\ .." ,) )
181+ ssl_dir = get_ssl_dir ( )
206182 if ssl_dir is None :
207183 sys .exit (1 )
208184
0 commit comments