refactor: subprocess.run (#592)
* change check_call to run * refactor: change check_output to run * Apply suggestions from code review Co-authored-by: Joe Rickerby <joerick@mac.com> Co-authored-by: Joe Rickerby <joerick@mac.com>
This commit is contained in:
co-authored by
Joe Rickerby
parent
58c5e56e9f
commit
d2772c2293
@@ -15,10 +15,12 @@ ALL_MACOS_WHEELS = (
|
||||
|
||||
|
||||
def get_xcode_version() -> Tuple[int, int]:
|
||||
output = subprocess.check_output(
|
||||
output = subprocess.run(
|
||||
['xcodebuild', '-version'],
|
||||
universal_newlines=True,
|
||||
)
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
).stdout
|
||||
lines = output.splitlines()
|
||||
_, version_str = lines[0].split()
|
||||
|
||||
|
||||
@@ -34,11 +34,11 @@ def main():
|
||||
|
||||
if options.open:
|
||||
if sys.platform == 'darwin':
|
||||
subprocess.check_call(['open', '--', project_dir])
|
||||
subprocess.run(['open', '--', project_dir], check=True)
|
||||
elif sys.platform == 'linux2':
|
||||
subprocess.check_call(['xdg-open', '--', project_dir])
|
||||
subprocess.run(['xdg-open', '--', project_dir], check=True)
|
||||
elif sys.platform == 'win32':
|
||||
subprocess.check_call(['explorer', project_dir])
|
||||
subprocess.run(['explorer', project_dir], check=True)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
+6
-3
@@ -31,11 +31,13 @@ def cibuildwheel_get_build_identifiers(project_path, env=None):
|
||||
Returns the list of build identifiers that cibuildwheel will try to build
|
||||
for the current platform.
|
||||
'''
|
||||
cmd_output = subprocess.check_output(
|
||||
cmd_output = subprocess.run(
|
||||
[sys.executable, '-m', 'cibuildwheel', '--print-build-identifiers', str(project_path)],
|
||||
universal_newlines=True,
|
||||
env=env,
|
||||
)
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
).stdout
|
||||
|
||||
return cmd_output.strip().split('\n')
|
||||
|
||||
@@ -64,10 +66,11 @@ def cibuildwheel_run(project_path, package_dir='.', env=None, add_env=None, outp
|
||||
env.update(add_env)
|
||||
|
||||
with TemporaryDirectoryIfNone(output_dir) as _output_dir:
|
||||
subprocess.check_call(
|
||||
subprocess.run(
|
||||
[sys.executable, '-m', 'cibuildwheel', '--output-dir', str(_output_dir), str(package_dir)],
|
||||
env=env,
|
||||
cwd=project_path,
|
||||
check=True,
|
||||
)
|
||||
wheels = os.listdir(_output_dir)
|
||||
return wheels
|
||||
|
||||
Reference in New Issue
Block a user