Skip to content

Commit 00a086b

Browse files
committed
[GR-21590] Update imports
PullRequest: graalpython/875
2 parents fe790de + 5e857a3 commit 00a086b

File tree

3 files changed

+26
-22
lines changed

3 files changed

+26
-22
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "ca0a6bfd6f58538d7c2171a5b49a19e10d90bc42" }
1+
{ "overlay": "6ec8de6ed2c3aa9e0a603e4d89f5e686d725338a" }

mx.graalpython/mx_graalpython.py

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,12 @@ def delete_self_if_testdownstream(args):
758758

759759
def update_import(name, suite_py, rev="origin/master"):
760760
parent = os.path.join(SUITE.dir, "..")
761+
dep_dir = None
761762
for dirpath, dirnames, _ in os.walk(parent):
762763
if os.path.sep in os.path.relpath(dirpath, parent):
763764
dirnames.clear() # we're looking for siblings or sibling-subdirs
764-
elif name in dirnames:
765-
dep_dir = os.path.join(os.path.join(dirpath))
765+
elif name in dirnames and os.path.isdir(os.path.join(dirpath, name, "mx.%s" % name)):
766+
dep_dir = dirpath
766767
break
767768
if not dep_dir:
768769
mx.warn("could not find suite %s to update" % name)
@@ -851,7 +852,7 @@ def update_import_cmd(args):
851852
d = {}
852853
with open(suite_py) as f:
853854
exec(f.read(), d, d) # pylint: disable=exec-used;
854-
for suite in dict["suite"].get("imports", {}).get("suites", []):
855+
for suite in d["suite"].get("imports", {}).get("suites", []):
855856
import_name = suite["name"]
856857
if suite.get("version") and import_name not in local_names:
857858
imports_to_update.add(import_name)
@@ -868,39 +869,42 @@ def update_import_cmd(args):
868869

869870
repos_updated = []
870871

871-
# commit ci if dirty
872-
overlaytip = str(vc.tip(overlaydir)).strip()
873-
if vc.isDirty(overlaydir):
874-
vc.commit(overlaydir, "Update Python imports")
875-
overlaytip = str(vc.tip(overlaydir)).strip()
876-
repos_updated.append(overlaydir)
877-
878872
# now allow dependent repos to hook into update
879873
output = mx.OutputCapture()
880874
for repo in repos:
881875
basename = os.path.basename(repo)
882876
cmdname = "%s-update-import" % basename
883-
is_mx_command = mx.run_mx(["help", cmdname], out=output, err=output, nonZeroIsFatal=False, quiet=True) == 0
877+
is_mx_command = mx.run_mx(["-p", repo, "help", cmdname], out=output, err=output, nonZeroIsFatal=False, quiet=True) == 0
884878
if is_mx_command:
885-
mx.run_mx([cmdname, "--overlaydir=%s" % overlaydir], suite=repo, nonZeroIsFatal=True)
879+
mx.run_mx(["-p", repo, cmdname, "--overlaydir=%s" % overlaydir], suite=repo, nonZeroIsFatal=True)
886880
else:
887881
print(mx.colorize('%s command for %s.. skipped!' % (cmdname, basename), color='magenta', bright=True, stream=sys.stdout))
888882

889-
# update ci import in all our repos, commit the full update, and push verbosely
883+
# commit ci-overlays if dirty
884+
if vc.isDirty(overlaydir):
885+
vc.commit(overlaydir, "Update Python imports")
886+
repos_updated.append(overlaydir)
887+
888+
overlaytip = str(vc.tip(overlaydir)).strip()
889+
890+
# update ci import in all our repos, commit the full update
890891
prev_verbosity = mx._opts.very_verbose
891892
for repo in repos:
892893
jsonnetfile = os.path.join(repo, "ci.jsonnet")
893894
with open(jsonnetfile, "w") as f:
894895
f.write('{ "overlay": "%s" }\n' % overlaytip)
895896
if vc.isDirty(repo):
896897
vc.commit(repo, "Update imports")
897-
try:
898-
mx._opts.very_verbose = True
899-
vc.git_command(repo, ["push", "-u", "origin", "HEAD:%s" % current_branch], abortOnError=True)
900-
finally:
901-
mx._opts.very_verbose = prev_verbosity
902898
repos_updated.append(repo)
903899

900+
# push all repos
901+
for repo in repos_updated:
902+
try:
903+
mx._opts.very_verbose = True
904+
vc.git_command(repo, ["push", "-u", "origin", "HEAD:%s" % current_branch], abortOnError=True)
905+
finally:
906+
mx._opts.very_verbose = prev_verbosity
907+
904908
if repos_updated:
905909
mx.log("\n ".join(["These repos were updated:"] + repos_updated))
906910

mx.graalpython/suite.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,23 +44,23 @@
4444
},
4545
{
4646
"name": "tools",
47-
"version": "0bb6082710f6bc80ca0531dc8a49357b2c321647",
47+
"version": "69794db183e49551cc31b7c5aa122cd332c863f0",
4848
"subdir": True,
4949
"urls": [
5050
{"url": "https://github.com/oracle/graal", "kind": "git"},
5151
],
5252
},
5353
{
5454
"name": "sulong",
55-
"version": "0bb6082710f6bc80ca0531dc8a49357b2c321647",
55+
"version": "69794db183e49551cc31b7c5aa122cd332c863f0",
5656
"subdir": True,
5757
"urls": [
5858
{"url": "https://github.com/oracle/graal", "kind": "git"},
5959
]
6060
},
6161
{
6262
"name": "regex",
63-
"version": "0bb6082710f6bc80ca0531dc8a49357b2c321647",
63+
"version": "69794db183e49551cc31b7c5aa122cd332c863f0",
6464
"subdir": True,
6565
"urls": [
6666
{"url": "https://github.com/oracle/graal", "kind": "git"},

0 commit comments

Comments
 (0)