diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-03-31 11:29:00 +0200 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-03-31 11:29:00 +0200 |
commit | 66ab3762c338640c3d465d039720cfcd1348184d (patch) | |
tree | 8dcf2215b985e1e7fc404851079f80a63610a7a4 | |
parent | 8e83f620ee17f70f3fe77bf873e180f6a70104cf (diff) | |
download | poezio-66ab3762c338640c3d465d039720cfcd1348184d.tar.gz poezio-66ab3762c338640c3d465d039720cfcd1348184d.tar.bz2 poezio-66ab3762c338640c3d465d039720cfcd1348184d.tar.xz poezio-66ab3762c338640c3d465d039720cfcd1348184d.zip |
Import the subprocess module directly in setup.py.
-rwxr-xr-x | setup.py | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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) |