Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 85fb89b

Browse files
committed
ENH: do not show any output in editable verbose mode when there is no work to do
1 parent 041ed59 commit 85fb89b

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

mesonpy/_editable.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,14 @@ def rebuild(self) -> Node:
304304
env[MARKER] = os.pathsep.join((env.get(MARKER, ''), self._build_path))
305305

306306
if self._verbose or bool(env.get(VERBOSE, '')):
307-
print('+ ' + ' '.join(self._build_cmd))
308-
stdout = None
307+
dry_run_build_cmd = self._build_cmd + ["-n"]
308+
# We do not want any output if there is no work to do
309+
p = subprocess.run(dry_run_build_cmd, cwd=self._build_path, env=env, capture_output=True)
310+
if b'no work to do' not in p.stdout:
311+
print('+ ' + ' '.join(self._build_cmd))
312+
subprocess.run(self._build_cmd, cwd=self._build_path, env=env)
309313
else:
310-
stdout = subprocess.DEVNULL
311-
312-
subprocess.run(self._build_cmd, cwd=self._build_path, env=env, stdout=stdout, check=True)
314+
subprocess.run(self._build_cmd, cwd=self._build_path, env=env, stdout=subprocess.DEVNULL)
313315

314316
install_plan_path = os.path.join(self._build_path, 'meson-info', 'intro-install_plan.json')
315317
with open(install_plan_path, 'r', encoding='utf8') as f:

0 commit comments

Comments
 (0)