[Python-checkins] cpython (merge 3.4 -> default): Issue10752 Be more robust when finding a PERL interpreter to build OpenSSL.

tim.golden python-checkins at python.org
Fri May 9 19:03:22 CEST 2014


http://hg.python.org/cpython/rev/e492d0ac9abb
changeset:   90604:e492d0ac9abb
parent:      90602:9bd844792b32
parent:      90603:160f32753b0c
user:        Tim Golden <mail at timgolden.me.uk>
date:        Fri May 09 18:01:44 2014 +0100
summary:
  Issue10752 Be more robust when finding a PERL interpreter to build OpenSSL. Initial patch by Gabi Davar

files:
  PCbuild/prepare_ssl.py |  18 +++++++++---------
  1 files changed, 9 insertions(+), 9 deletions(-)


diff --git a/PCbuild/prepare_ssl.py b/PCbuild/prepare_ssl.py
--- a/PCbuild/prepare_ssl.py
+++ b/PCbuild/prepare_ssl.py
@@ -21,6 +21,7 @@
 import re
 import sys
 import shutil
+import subprocess
 
 # Find all "foo.exe" files on the PATH.
 def find_all_on_path(filename, extras = None):
@@ -43,22 +44,21 @@
 # is available.
 def find_working_perl(perls):
     for perl in perls:
-        fh = os.popen('"%s" -e "use Win32;"' % perl)
-        fh.read()
-        rc = fh.close()
-        if rc:
+        try:
+            subprocess.check_output([perl, "-e", "use Win32;"])
+        except subprocess.CalledProcessError:
             continue
-        return perl
-    print("Can not find a suitable PERL:")
+        else:
+            return perl
+
     if perls:
-        print(" the following perl interpreters were found:")
+        print("The following perl interpreters were found:")
         for p in perls:
             print(" ", p)
         print(" None of these versions appear suitable for building OpenSSL")
     else:
-        print(" NO perl interpreters were found on this machine at all!")
+        print("NO perl interpreters were found on this machine at all!")
     print(" Please install ActivePerl and ensure it appears on your path")
-    return None
 
 def create_makefile64(makefile, m32):
     """Create and fix makefile for 64bit

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list