Skip to content

Commit d2d18e5

Browse files
committed
[GR-21590] Update Python imports
PullRequest: graalpython/2625
2 parents a9dd444 + ed79b6f commit d2d18e5

File tree

6 files changed

+39
-75
lines changed

6 files changed

+39
-75
lines changed

ci.jsonnet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{ "overlay": "9012ebbaded147a29695965f3f8fb1b07151f7cc" }
1+
{ "overlay": "d59023a625716d3e6f01e70af51cbbaeb0468497" }

graalpython/lib-graalpython/patches/hypothesis/whl/hypothesis-6.65.patch

Lines changed: 0 additions & 54 deletions
This file was deleted.

mx.graalpython/mx_graalpython.py

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from __future__ import print_function
2626

2727
import contextlib
28+
import datetime
2829
import fnmatch
2930
import getpass
3031
import glob
@@ -349,8 +350,7 @@ def compare_unittests(args):
349350

350351
def run_cpython_test(raw_args):
351352
test_args = ['-v']
352-
import argparse
353-
parser = argparse.ArgumentParser()
353+
parser = ArgumentParser()
354354
parser.add_argument('--all', action='store_true')
355355
parser.add_argument('--gvm', dest='vm', action='store_const', const='gvm')
356356
parser.add_argument('--svm', dest='vm', action='store_const', const='svm')
@@ -1530,7 +1530,7 @@ def delete_self_if_testdownstream(args):
15301530
shutil.rmtree(SUITE.dir, ignore_errors=True)
15311531

15321532

1533-
def update_import(name, suite_py, rev="origin/master"):
1533+
def update_import(name, suite_py, args):
15341534
parent = os.path.join(SUITE.dir, "..")
15351535
dep_dir = None
15361536
for dirpath, dirnames, _ in os.walk(parent):
@@ -1543,9 +1543,17 @@ def update_import(name, suite_py, rev="origin/master"):
15431543
mx.warn("could not find suite %s to update" % name)
15441544
return
15451545
vc = mx.VC.get_vc(dep_dir)
1546-
if rev != "HEAD":
1547-
vc.pull(dep_dir, update=False)
1548-
vc.update(dep_dir, rev=rev)
1546+
repo_name = os.path.basename(dep_dir)
1547+
if repo_name == "graal" and args.graal_rev:
1548+
rev = args.graal_rev
1549+
elif repo_name == "graal-enterprise" and args.graal_enterprise_rev:
1550+
rev = args.graal_enterprise_rev
1551+
elif args.no_pull:
1552+
rev = "HEAD"
1553+
else:
1554+
vc.pull(dep_dir)
1555+
rev = "origin/master"
1556+
vc.update(dep_dir, rev=rev, mayPull=True)
15491557
tip = str(vc.tip(dep_dir)).strip()
15501558
contents = None
15511559
with open(suite_py, 'r') as f:
@@ -1562,14 +1570,24 @@ def update_import(name, suite_py, rev="origin/master"):
15621570

15631571
def update_import_cmd(args):
15641572
"""Update our imports"""
1573+
1574+
parser = ArgumentParser()
1575+
parser.add_argument('--graal-rev', default='')
1576+
parser.add_argument('--graal-enterprise-rev', default='')
1577+
parser.add_argument('--no-pull', action='store_true')
1578+
parser.add_argument('--no-push', action='store_true')
1579+
parser.add_argument('--allow-dirty', action='store_true')
1580+
args = parser.parse_args(args)
1581+
15651582
join = os.path.join
15661583
vc = SUITE.vc
15671584

15681585
current_branch = vc.active_branch(SUITE.dir)
1569-
if current_branch == "master":
1570-
mx.abort("updating imports should be done on a branch")
1571-
if vc.isDirty(SUITE.dir):
1586+
if vc.isDirty(SUITE.dir) and not args.allow_dirty:
15721587
mx.abort("updating imports should be done on a clean branch")
1588+
if current_branch == "master":
1589+
vc.git_command(SUITE.dir, ["checkout", "-b", f"update/GR-21590/{datetime.datetime.now().strftime('%d%m%y')}"])
1590+
current_branch = vc.active_branch(SUITE.dir)
15731591

15741592
suite_py_files = []
15751593
local_names = []
@@ -1593,7 +1611,7 @@ def update_import_cmd(args):
15931611

15941612
# make sure all other repos are clean and on the same branch
15951613
for d in repos:
1596-
if vc.isDirty(d):
1614+
if vc.isDirty(d) and not args.allow_dirty:
15971615
mx.abort("repo %s is not clean" % d)
15981616
d_branch = vc.active_branch(d)
15991617
if d_branch == current_branch:
@@ -1609,11 +1627,11 @@ def update_import_cmd(args):
16091627
if not os.path.exists(overlaydir):
16101628
mx.abort("Overlays repo must be next to graalpython repo")
16111629
vc = mx.VC.get_vc(overlaydir)
1612-
if vc.isDirty(overlaydir):
1630+
if vc.isDirty(overlaydir) and not args.allow_dirty:
16131631
mx.abort("overlays repo must be clean")
16141632
overlaybranch = vc.active_branch(overlaydir)
16151633
if overlaybranch == "master":
1616-
if "--no-pull" not in args:
1634+
if not args.no_pull:
16171635
vc.pull(overlaydir)
16181636
vc.set_branch(overlaydir, current_branch, with_remote=False)
16191637
vc.git_command(overlaydir, ["checkout", current_branch], abortOnError=True)
@@ -1636,8 +1654,8 @@ def update_import_cmd(args):
16361654
revisions = {}
16371655
# now update all imports
16381656
for name in imports_to_update:
1639-
for idx, suite_py in enumerate(suite_py_files):
1640-
revisions[name] = update_import(name, suite_py, rev=("HEAD" if (idx or "--no-pull" in args) else "origin/master"))
1657+
for _, suite_py in enumerate(suite_py_files):
1658+
revisions[name] = update_import(name, suite_py, args)
16411659

16421660
# copy files we inline from our imports
16431661
shutil.copy(
@@ -1680,7 +1698,7 @@ def update_import_cmd(args):
16801698
repos_updated.append(repo)
16811699

16821700
# push all repos
1683-
if "--no-push" not in args:
1701+
if not args.no_push:
16841702
for repo in repos_updated:
16851703
try:
16861704
mx._opts.very_verbose = True

mx.graalpython/native-image.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Requires = language:regex language:llvm language:nfi
55

6-
JavaArgs = -Xmx12G -Dpolyglot.image-build-time.PreinitializeContexts=python
6+
JavaArgs = -Xmx5100M -Dpolyglot.image-build-time.PreinitializeContexts=python
77

88
# TODO --enable-all-security-services is deprecated in 22.0
99
Args = -H:MaxRuntimeCompileMethods=20000 \

mx.graalpython/suite.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,31 +44,31 @@
4444
},
4545
{
4646
"name": "sdk",
47-
"version": "856902d658150d8f6a99458228a03ad2cdbf739b",
47+
"version": "142ad1489737b10874f1ccb3b58bd28c09bc2fab",
4848
"subdir": True,
4949
"urls": [
5050
{"url": "https://github.com/oracle/graal", "kind": "git"},
5151
]
5252
},
5353
{
5454
"name": "tools",
55-
"version": "856902d658150d8f6a99458228a03ad2cdbf739b",
55+
"version": "142ad1489737b10874f1ccb3b58bd28c09bc2fab",
5656
"subdir": True,
5757
"urls": [
5858
{"url": "https://github.com/oracle/graal", "kind": "git"},
5959
],
6060
},
6161
{
6262
"name": "sulong",
63-
"version": "856902d658150d8f6a99458228a03ad2cdbf739b",
63+
"version": "142ad1489737b10874f1ccb3b58bd28c09bc2fab",
6464
"subdir": True,
6565
"urls": [
6666
{"url": "https://github.com/oracle/graal", "kind": "git"},
6767
]
6868
},
6969
{
7070
"name": "regex",
71-
"version": "856902d658150d8f6a99458228a03ad2cdbf739b",
71+
"version": "142ad1489737b10874f1ccb3b58bd28c09bc2fab",
7272
"subdir": True,
7373
"urls": [
7474
{"url": "https://github.com/oracle/graal", "kind": "git"},

0 commit comments

Comments
 (0)