From 66ab3762c338640c3d465d039720cfcd1348184d Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sat, 31 Mar 2018 11:29:00 +0200 Subject: Import the subprocess module directly in setup.py. --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 965e3d64..9f0b23d1 100755 --- a/setup.py +++ b/setup.py @@ -8,6 +8,7 @@ except ImportError: sys.exit(1) import os +import subprocess current_dir = os.path.dirname(__file__) @@ -38,11 +39,11 @@ def find_doc(before, path): def check_include(library_name, header): command = [os.environ.get('PKG_CONFIG', 'pkg-config'), '--cflags', library_name] try: - cflags = check_output(command).decode('utf-8').split() + cflags = subprocess.check_output(command).decode('utf-8').split() except FileNotFoundError: print('pkg-config not found.') return False - except CalledProcessError: + except subprocess.CalledProcessError: # pkg-config already prints the missing libraries on stderr. return False command = [os.environ.get('CC', 'cc')] + cflags + ['-E', '-'] @@ -50,7 +51,7 @@ def check_include(library_name, header): c_file.write('#include <%s>' % header) c_file.seek(0) try: - return call(command, stdin=c_file, stdout=DEVNULL, stderr=DEVNULL) == 0 + return subprocess.call(command, stdin=c_file, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) == 0 except FileNotFoundError: print('%s headers not found.' % library_name) return False @@ -72,7 +73,6 @@ if not os.path.exists(os.path.join(current_dir, 'poezio', 'default_config.cfg')) git_dir = os.path.join(current_dir, '.git') if os.path.exists(git_dir): try: - import subprocess result = subprocess.Popen(['git', '--git-dir', git_dir, 'describe'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) -- cgit v1.2.3