subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1819556 - in /subversion/trunk/build/generator: swig/__init__.py swig/checkout_swig_header.py swig/external_runtime.py util/executable.py
Date Sat, 30 Dec 2017 01:23:49 GMT
Author: danielsh
Date: Sat Dec 30 01:23:49 2017
New Revision: 1819556

URL: http://svn.apache.org/viewvc?rev=1819556&view=rev
Log:
Improve external command invocation in the swig parts of the build system.
Both gen-make.py and 'make swig-py' are affected.

Developer-visible change: failure modes of the build system should be better.

* build/generator/util/executable.py: Remove.
  (exists, find): Unused.
  (output): Callers updated to use check_output(), which raises on non-zero
    exit code.  Note that no caller passed a string argument and doing so
    would not have worked, since shell=True wasn't being passed to Popen().
  (run): Callers updated to use subprocess.check_call() directly, which is
    equivalent (with shell=True) or better (with shell=False, which is the
    default).

* build/generator/swig/__init__.py
  (subprocess): Import.
  (_exec): Remove import.
  (): All callers updated.

* build/generator/swig/checkout_swig_header.py
  (subprocess): Import.
  (run): Remove import.
  (): All callers updated.

* build/generator/swig/external_runtime.py
  (subprocess): Import.
  (_exec, generator.util.executable): Remove import.
  (): All callers updated.

Removed:
    subversion/trunk/build/generator/util/executable.py
Modified:
    subversion/trunk/build/generator/swig/__init__.py
    subversion/trunk/build/generator/swig/checkout_swig_header.py
    subversion/trunk/build/generator/swig/external_runtime.py

Modified: subversion/trunk/build/generator/swig/__init__.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/swig/__init__.py?rev=1819556&r1=1819555&r2=1819556&view=diff
==============================================================================
--- subversion/trunk/build/generator/swig/__init__.py (original)
+++ subversion/trunk/build/generator/swig/__init__.py Sat Dec 30 01:23:49 2017
@@ -25,7 +25,7 @@
 import os
 import re
 import shutil
-import generator.util.executable as _exec
+import subprocess
 from generator.gen_base import _collect_paths
 try:
   # Python >=3.0
@@ -59,14 +59,14 @@ class Generator:
 
     # Calculate SWIG paths
     self.swig_path = swig_path
-    self.swig_libdir = _exec.output([self.swig_path, "-swiglib"], strip=1)
+    self.swig_libdir = subprocess.check_output([self.swig_path, "-swiglib"]).strip()
 
   _swigVersion = None
   def version(self):
     """Get the version number of SWIG"""
 
     if not self._swigVersion:
-      swig_version = _exec.output([self.swig_path, "-version"])
+      swig_version = subprocess.check_output([self.swig_path, "-version"])
       m = re.search("Version (\d+).(\d+).(\d+)", swig_version)
       if m:
         self._swigVersion = tuple(map(int, m.groups()))

Modified: subversion/trunk/build/generator/swig/checkout_swig_header.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/swig/checkout_swig_header.py?rev=1819556&r1=1819555&r2=1819556&view=diff
==============================================================================
--- subversion/trunk/build/generator/swig/checkout_swig_header.py (original)
+++ subversion/trunk/build/generator/swig/checkout_swig_header.py Sat Dec 30 01:23:49 2017
@@ -23,13 +23,12 @@
 # Checkout files from the SWIG library into Subversion's proxy directory
 #
 
-import sys, os, re, fileinput, shutil
+import sys, os, re, fileinput, shutil, subprocess
 if __name__ == "__main__":
   parent_dir = os.path.dirname(os.path.abspath(os.path.dirname(sys.argv[0])))
   sys.path[0:0] = [ parent_dir, os.path.dirname(parent_dir) ]
 import generator.swig
 from gen_base import build_path_splitfile, build_path_join
-from generator.util.executable import run
 
 class Generator(generator.swig.Generator):
 
@@ -63,7 +62,7 @@ class Generator(generator.swig.Generator
     elif self.version() == (1, 3, 24):
       shutil.copy(build_path_join(self.swig_libdir, path), out)
     else:
-      run("%s -o %s -co %s" % (self.swig_path, out, path))
+      subprocess.check_call([self.swig_path, "-o", out, "-co", path])
 
   def _skip_checkout(self, path):
     """Should we skip this checkout?"""

Modified: subversion/trunk/build/generator/swig/external_runtime.py
URL: http://svn.apache.org/viewvc/subversion/trunk/build/generator/swig/external_runtime.py?rev=1819556&r1=1819555&r2=1819556&view=diff
==============================================================================
--- subversion/trunk/build/generator/swig/external_runtime.py (original)
+++ subversion/trunk/build/generator/swig/external_runtime.py Sat Dec 30 01:23:49 2017
@@ -29,13 +29,12 @@ import os
 import re
 import fileinput
 import filecmp
+import subprocess
 
 if __name__ == "__main__":
   parent_dir = os.path.dirname(os.path.abspath(os.path.dirname(sys.argv[0])))
   sys.path[0:0] = [ parent_dir, os.path.dirname(parent_dir) ]
 import generator.swig
-import generator.util.executable
-_exec = generator.util.executable
 
 class Generator(generator.swig.Generator):
   """Generate external runtime files for SWIG"""
@@ -82,7 +81,7 @@ class Generator(generator.swig.Generator
         out_file.write(open("%s/runtime.swg" % self.proxy_dir).read())
       out_file.close()
     else:
-      _exec.run("%s -%s -external-runtime %s" % (self.swig_path, lang, out))
+      subprocess.check_call([self.swig_path, "-"+lang, "-external-runtime", out])
 
     # SWIG 1.3.24-27 should include rubyhead.swg in their
     # external runtime, but they don't.



Mime
View raw message