Changeset 391 for python/trunk/PCbuild/build_ssl.py
- Timestamp:
- Mar 19, 2014, 11:31:01 PM (11 years ago)
- Location:
- python/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/trunk
-
Property svn:mergeinfo
set to
/python/vendor/Python-2.7.6 merged eligible /python/vendor/current merged eligible
-
Property svn:mergeinfo
set to
-
python/trunk/PCbuild/build_ssl.py
r2 r391 1 from __future__ import with_statement, print_function 1 2 # Script for building the _ssl and _hashlib modules for Windows. 2 3 # Uses Perl to setup the OpenSSL environment correctly … … 47 48 def find_working_perl(perls): 48 49 for perl in perls: 49 fh = os.popen( perl + ' -e "use Win32;"')50 fh = os.popen('"%s" -e "use Win32;"' % perl) 50 51 fh.read() 51 52 rc = fh.close() … … 64 65 return None 65 66 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 67 # Fetch SSL directory from VC properties 68 def get_ssl_dir(): 69 propfile = (os.path.join(os.path.dirname(__file__), 'pyproject.vsprops')) 70 with open(propfile) as f: 71 m = re.search('openssl-([^"]+)"', f.read()) 72 return "..\..\openssl-"+m.group(1) 73 97 74 98 75 def create_makefile64(makefile, m32): … … 103 80 if not os.path.isfile(m32): 104 81 return 105 # 2.4 compatibility 106 fin = open(m32) 107 if 1: # with open(m32) as fin: 108 fout = open(makefile, 'w') 109 if 1: # with open(makefile, 'w') as fout: 82 with open(m32) as fin: 83 with open(makefile, 'w') as fout: 110 84 for line in fin: 111 85 line = line.replace("=tmp32", "=tmp64") … … 187 161 perls = find_all_on_path("perl.exe", ["\\perl\\bin", "C:\\perl\\bin"]) 188 162 perl = find_working_perl(perls) 189 if perl is None: 163 if perl: 164 print("Found a working perl at '%s'" % (perl,)) 165 else: 190 166 print("No Perl installation was found. Existing Makefiles are used.") 191 192 print("Found a working perl at '%s'" % (perl,))193 167 sys.stdout.flush() 194 168 # Look for SSL 2 levels up from pcbuild - ie, same place zlib etc all live. 195 ssl_dir = find_best_ssl_dir(("..\\..",))169 ssl_dir = get_ssl_dir() 196 170 if ssl_dir is None: 197 171 sys.exit(1)
Note:
See TracChangeset
for help on using the changeset viewer.