Skip to content

Commit 2264307

Browse files
committed
python-setup: change env passing
1 parent 1309aaf commit 2264307

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

python-setup/auto_install_packages.py

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,20 @@
99
import extractor_version
1010

1111

12-
def _check_call(command, extra_env=None):
12+
def _check_call(command, extra_env={}):
1313
print('+ {}'.format(' '.join(command)), flush=True)
1414

15-
# only pass `env` argument if we need to pass in an updated environment
16-
kwargs = {}
17-
if extra_env:
18-
new_env = os.environ.copy()
19-
new_env.update(extra_env)
20-
kwargs = {"env": new_env}
15+
env = os.environ.copy()
16+
env.update(extra_env)
17+
subprocess.check_call(command, stdin=subprocess.DEVNULL, env=env)
2118

22-
subprocess.check_call(command, stdin=subprocess.DEVNULL, **kwargs)
2319

24-
25-
def _check_output(command, extra_env=None):
20+
def _check_output(command, extra_env={}):
2621
print('+ {}'.format(' '.join(command)), flush=True)
2722

28-
# only pass `env` argument if we need to pass in an updated environment
29-
kwargs = {}
30-
if extra_env:
31-
new_env = os.environ.copy()
32-
new_env.update(extra_env)
33-
kwargs = {"env": new_env}
34-
35-
out = subprocess.check_output(command, stdin=subprocess.DEVNULL, **kwargs)
23+
env = os.environ.copy()
24+
env.update(extra_env)
25+
out = subprocess.check_output(command, stdin=subprocess.DEVNULL, env=env)
3626
print(out, flush=True)
3727
sys.stderr.flush()
3828
return out

0 commit comments

Comments
 (0)