Skip to content

Commit ad83c1b

Browse files
authored
Move run_process to utils.py. NFC (#25716)
1 parent 467a4e3 commit ad83c1b

File tree

14 files changed

+61
-55
lines changed

14 files changed

+61
-55
lines changed

emmake.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import shutil
2727
import sys
2828

29-
from tools import building, shared, utils
29+
from tools import building, utils
3030

3131

3232
#
@@ -58,10 +58,10 @@ def run():
5858
# 'sdl2-config.bat' in PATH.
5959
print(f'emmake: "{shlex.join(args)}" in "{os.getcwd()}"', file=sys.stderr)
6060
if utils.WINDOWS:
61-
return shared.run_process(args, check=False, shell=True, env=env).returncode
61+
return utils.run_process(args, check=False, shell=True, env=env).returncode
6262
else:
6363
os.environ.update(env)
64-
shared.exec_process(args)
64+
utils.exec(args)
6565

6666

6767
if __name__ == '__main__':

test/benchmark/benchmark_sse.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
from common import EMRUN, test_file
2222

2323
from tools.config import V8_ENGINE
24-
from tools.shared import CLANG_CXX, EMCC, WINDOWS, run_process
24+
from tools.shared import CLANG_CXX, EMCC, WINDOWS
25+
from tools.utils import run_process
2526

2627
# System info
2728
system_info = subprocess.check_output([EMRUN, '--system_info'], stderr=subprocess.STDOUT, text=True)

test/clang_native.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import platform
99
import sys
1010

11-
from tools.shared import CLANG_CC, CLANG_CXX, PIPE, run_process
12-
from tools.utils import MACOS, WINDOWS, path_from_root
11+
from tools.shared import CLANG_CC, CLANG_CXX, PIPE
12+
from tools.utils import MACOS, WINDOWS, path_from_root, run_process
1313

1414
logger = logging.getLogger('clang_native')
1515

test/common.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ def verify_es5(self, filename):
959959
# ES-Check: there were no ES version matching errors!
960960
# pipe stdout and stderr so that we can choose if/when to print this
961961
# output and avoid spamming stdout when tests are successful.
962-
shared.run_process(es_check + ['es5', inputfile], stdout=PIPE, stderr=STDOUT, env=es_check_env)
962+
utils.run_process(es_check + ['es5', inputfile], stdout=PIPE, stderr=STDOUT, env=es_check_env)
963963
except subprocess.CalledProcessError as e:
964964
print(e.stdout)
965965
self.fail('es-check failed to verify ES5 output compliance')
@@ -1296,7 +1296,7 @@ def clear(self):
12961296
utils.delete_contents(shared.EMSCRIPTEN_TEMP_DIR)
12971297

12981298
def run_process(self, cmd, check=True, **kwargs):
1299-
# Wrapper around shared.run_process. This is desirable so that the tests
1299+
# Wrapper around utils.run_process. This is desirable so that the tests
13001300
# can fail (in the unittest sense) rather than error'ing.
13011301
# In the long run it would nice to completely remove the dependency on
13021302
# core emscripten code (shared.py) here.
@@ -1312,7 +1312,7 @@ def run_process(self, cmd, check=True, **kwargs):
13121312
kwargs['stderr'] = PIPE
13131313

13141314
try:
1315-
rtn = shared.run_process(cmd, check=check, **kwargs)
1315+
rtn = utils.run_process(cmd, check=check, **kwargs)
13161316
except subprocess.CalledProcessError as e:
13171317
if check and e.returncode != 0:
13181318
print(e.stdout)
@@ -2349,8 +2349,7 @@ def build_library(name,
23492349
with open(os.path.join(project_dir, 'configure_err'), 'w') as err:
23502350
stdout = out if EMTEST_BUILD_VERBOSE < 2 else None
23512351
stderr = err if EMTEST_BUILD_VERBOSE < 1 else None
2352-
shared.run_process(configure, env=env, stdout=stdout, stderr=stderr,
2353-
cwd=project_dir)
2352+
utils.run_process(configure, env=env, stdout=stdout, stderr=stderr, cwd=project_dir)
23542353
except subprocess.CalledProcessError:
23552354
print('-- configure stdout --')
23562355
print(read_file(Path(project_dir, 'configure_out')))
@@ -2378,8 +2377,7 @@ def open_make_err(mode='r'):
23782377
with open_make_err('w') as make_err:
23792378
stdout = make_out if EMTEST_BUILD_VERBOSE < 2 else None
23802379
stderr = make_err if EMTEST_BUILD_VERBOSE < 1 else None
2381-
shared.run_process(make + make_args, stdout=stdout, stderr=stderr, env=env,
2382-
cwd=project_dir)
2380+
utils.run_process(make + make_args, stdout=stdout, stderr=stderr, env=env, cwd=project_dir)
23832381
except subprocess.CalledProcessError:
23842382
with open_make_out() as f:
23852383
print('-- make stdout --')

test/test_benchmark.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
from decorators import needs_make
2626

2727
from tools import building, utils
28-
from tools.shared import CLANG_CC, CLANG_CXX, EMCC, PIPE, config, run_process
28+
from tools.shared import CLANG_CC, CLANG_CXX, EMCC, PIPE, config
29+
from tools.utils import run_process
2930

3031
# standard arguments for timing:
3132
# 0: no runtime, just startup

test/test_other.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def decorated(self, *args, **kwargs):
268268

269269

270270
def llvm_nm(file):
271-
output = shared.run_process([LLVM_NM, file], stdout=PIPE).stdout
271+
output = utils.run_process([LLVM_NM, file], stdout=PIPE).stdout
272272

273273
symbols = {
274274
'defs': set(),

test/test_sockets.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
)
2929

3030
from tools import config
31-
from tools.shared import CLANG_CC, EMCC, path_from_root, run_process
31+
from tools.shared import CLANG_CC, EMCC, path_from_root
32+
from tools.utils import run_process
3233

3334
npm_checked = False
3435

tools/building.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,9 @@
4646
get_emscripten_temp_dir,
4747
is_c_symbol,
4848
path_from_root,
49-
run_process,
5049
)
5150
from .toolchain_profiler import ToolchainProfiler
52-
from .utils import WINDOWS
51+
from .utils import WINDOWS, run_process
5352

5453
logger = logging.getLogger('building')
5554

tools/cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def version_string():
145145
# look up and find the revision in a parent directory that is a git repo
146146
revision_suffix = ''
147147
if os.path.exists(utils.path_from_root('.git')):
148-
git_rev = shared.run_process(
148+
git_rev = utils.run_process(
149149
['git', 'rev-parse', 'HEAD'],
150150
stdout=PIPE, stderr=PIPE, cwd=utils.path_from_root()).stdout.strip()
151151
revision_suffix = ' (%s)' % git_rev

tools/empath-split.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
__rootdir__ = os.path.dirname(__scriptdir__)
6969
sys.path.insert(0, __rootdir__)
7070

71-
from tools import building, diagnostics, emsymbolizer, shared, utils, webassembly
71+
from tools import building, diagnostics, emsymbolizer, utils, webassembly
7272
from tools.utils import exit_with_error
7373

7474

@@ -349,7 +349,7 @@ def main():
349349
cmd += forwarded_args
350350
if args.verbose:
351351
print('\n' + ' '.join(cmd))
352-
shared.run_process(cmd)
352+
utils.run_process(cmd)
353353
finally:
354354
if not args.preserve_manifest:
355355
os.remove(manifest)

0 commit comments

Comments
 (0)