Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit faf4d9c

Browse files
committed
Issue10752 Be more robust when finding a PERL interpreter to build OpenSSL. Initial patch by Gabi Davar
2 parents 6eaac13 + 9c18fcf commit faf4d9c

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

PCbuild/prepare_ssl.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import re
2222
import sys
2323
import shutil
24+
import subprocess
2425

2526
# Find all "foo.exe" files on the PATH.
2627
def find_all_on_path(filename, extras = None):
@@ -43,22 +44,21 @@ def find_all_on_path(filename, extras = None):
4344
# is available.
4445
def find_working_perl(perls):
4546
for perl in perls:
46-
fh = os.popen('"%s" -e "use Win32;"' % perl)
47-
fh.read()
48-
rc = fh.close()
49-
if rc:
47+
try:
48+
subprocess.check_output([perl, "-e", "use Win32;"])
49+
except subprocess.CalledProcessError:
5050
continue
51-
return perl
52-
print("Can not find a suitable PERL:")
51+
else:
52+
return perl
53+
5354
if perls:
54-
print(" the following perl interpreters were found:")
55+
print("The following perl interpreters were found:")
5556
for p in perls:
5657
print(" ", p)
5758
print(" None of these versions appear suitable for building OpenSSL")
5859
else:
59-
print(" NO perl interpreters were found on this machine at all!")
60+
print("NO perl interpreters were found on this machine at all!")
6061
print(" Please install ActivePerl and ensure it appears on your path")
61-
return None
6262

6363
def create_makefile64(makefile, m32):
6464
"""Create and fix makefile for 64bit

0 commit comments

Comments
 (0)