Skip to content

Commit 9aaa278

Browse files
committed
tweak build watcher
1 parent 658bd2a commit 9aaa278

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

mx.graalpython/mx_graalpython.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,21 +1034,26 @@ def python_build_watch(args):
10341034
args = parser.parse_args(args)
10351035
if sum([args.full, args.graalvm, args.no_java]) > 1:
10361036
mx.abort("Only one of --full, --graalvm, --no-java can be specified")
1037+
if args.full:
1038+
suffixes = [".c", ".h", ".class", ".jar", ".java"]
1039+
excludes = [".*\\.py$"]
1040+
elif args.graalvm:
1041+
suffixes = [".c", ".h", ".class", ".jar", ".java", ".py"]
1042+
excludes = ["mx_.*\\.py$"]
1043+
else:
1044+
suffixes = [".c", ".h", ".class", ".jar"]
1045+
excludes = [".*\\.py$", ".*\\.java$"]
1046+
1047+
cmd = ["inotifywait", "-q", "-e", "close_write,moved_to", "-r", "--format=%f"]
1048+
for e in excludes:
1049+
cmd += ["--exclude", e]
1050+
cmd += ["@%s" % os.path.join(SUITE.dir, ".git"), SUITE.dir]
1051+
10371052
while True:
10381053
out = mx.OutputCapture()
1039-
mx.run([
1040-
"inotifywait", "-q", "-e", "close_write,moved_to", "-r", "--format=%f",
1041-
"--exclude", ".*\\.py$",
1042-
"@%s" % os.path.join(SUITE.dir, ".git"),
1043-
SUITE.dir
1044-
], out=out)
1054+
mx.run(cmd, out=out)
10451055
changed_file = out.data.strip()
10461056
mx.logv(changed_file)
1047-
suffixes = [".c", ".h", ".class", ".jar"]
1048-
if args.full:
1049-
suffixes.append(".java")
1050-
elif args.graalvm:
1051-
suffixes.extend([".java", ".py"])
10521057
if any(changed_file.endswith(ext) for ext in [".c", ".h", ".class", ".jar"]):
10531058
mx.log("Build needed ...")
10541059
time.sleep(2)
@@ -1058,6 +1063,7 @@ def python_build_watch(args):
10581063
mx.log(python_gvm())
10591064
else:
10601065
nativebuild([])
1066+
mx.log("Build done.")
10611067

10621068

10631069
# ----------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)