commit 86df512b76e52abee802bff901e562a8fd3a4883 Author: Elan Ruusamäe <g...@pld-linux.org> Date: Wed Dec 1 13:28:28 2021 +0200
Refactor: Extract specdump to a function check-unused-files.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- diff --git a/check-unused-files.py b/check-unused-files.py index 4ecc6a9..e9edd05 100755 --- a/check-unused-files.py +++ b/check-unused-files.py @@ -5,6 +5,12 @@ import sys import os import fnmatch +def specdump(spec): + p = subprocess.Popen(['rpm-specdump', spec], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (out, err) = p.communicate(None) + p.wait() + return (out, err) + if len(sys.argv) == 2: spec = sys.argv[1] else: @@ -19,9 +25,7 @@ dir = os.path.dirname(spec) if dir == '': dir = '.' -p = subprocess.Popen(['rpm-specdump', spec], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) -(out, err) = p.communicate(None) -p.wait() +(out, err) = specdump(spec) if err: print >> sys.stderr, "%s: %s" % (sys.argv[0], err) sys.exit(1) ================================================================ ---- gitweb: http://git.pld-linux.org/gitweb.cgi/packages/rpm-build-tools.git/commitdiff/3e5d0ee427278c4c7de0bb065ccddaa3f676ec5a _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit