Skip to content

Commit 0b9d29e

Browse files
committed
[GR-20490] Allow dependent repositories to hook into the import update command.
PullRequest: graalpython/846
2 parents 6d6a787 + bf827d4 commit 0b9d29e

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Python3.g4.stamp
5555
/graalpython/com.oracle.graal.python.test/src/tests/cpyext/Test*.c
5656
/graalpython/com.oracle.graal.python.test/src/tests/cpyext/*.sha256
5757
/*.diff
58+
/testenv
5859
## generated from: pyhocon -i ci.hocon -f json -o ci.json
5960
/ci.json
6061
/*.err

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/set/FrozenSetBuiltins.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,6 @@ HashingStorage doIterable(VirtualFrame frame, HashingStorage dictStorage, Object
396396
@Cached("create()") IsBuiltinClassProfile errorProfile,
397397
@Cached("createBinaryProfile()") ConditionProfile hasFrame,
398398
@CachedLibrary("dictStorage") HashingStorageLibrary lib) {
399-
400399
HashingStorage curStorage = dictStorage;
401400
Object iterator = getIteratorNode.executeWith(frame, iterable);
402401
while (true) {
@@ -454,19 +453,19 @@ abstract static class IsSupersetNode extends PythonBinaryBuiltinNode {
454453
@Specialization(limit = "1")
455454
boolean isSuperSet(VirtualFrame frame, PBaseSet self, PBaseSet other,
456455
@Cached("createBinaryProfile()") ConditionProfile hasFrame,
457-
@CachedLibrary("self.getDictStorage()") HashingStorageLibrary lib) {
456+
@CachedLibrary("other.getDictStorage()") HashingStorageLibrary lib) {
458457
if (hasFrame.profile(frame != null)) {
459458
return lib.compareKeysWithState(other.getDictStorage(), self.getDictStorage(), PArguments.getThreadState(frame)) <= 0;
460459
} else {
461460
return lib.compareKeys(other.getDictStorage(), self.getDictStorage()) <= 0;
462461
}
463462
}
464463

465-
@Specialization(replaces = "isSuperSet", limit = "1")
464+
@Specialization(replaces = "isSuperSet")
466465
boolean isSuperSetGeneric(VirtualFrame frame, PBaseSet self, Object other,
467466
@Cached SetNodes.ConstructSetNode constructSetNode,
468467
@Cached("createBinaryProfile()") ConditionProfile hasFrame,
469-
@CachedLibrary("self.getDictStorage()") HashingStorageLibrary lib) {
468+
@CachedLibrary(limit = "3") HashingStorageLibrary lib) {
470469
PSet otherSet = constructSetNode.executeWith(frame, other);
471470
if (hasFrame.profile(frame != null)) {
472471
return lib.compareKeysWithState(otherSet.getDictStorage(), self.getDictStorage(), PArguments.getThreadState(frame)) <= 0;
@@ -480,10 +479,10 @@ boolean isSuperSetGeneric(VirtualFrame frame, PBaseSet self, Object other,
480479
@Builtin(name = __LE__, minNumOfPositionalArgs = 2)
481480
@GenerateNodeFactory
482481
abstract static class LessEqualNode extends PythonBinaryBuiltinNode {
483-
@Specialization
482+
@Specialization(limit = "1")
484483
boolean doLE(VirtualFrame frame, PBaseSet self, PBaseSet other,
485484
@Cached("createBinaryProfile()") ConditionProfile hasFrame,
486-
@CachedLibrary(limit = "3") HashingStorageLibrary lib) {
485+
@CachedLibrary("self.getDictStorage()") HashingStorageLibrary lib) {
487486
if (hasFrame.profile(frame != null)) {
488487
return lib.compareKeysWithState(self.getDictStorage(), other.getDictStorage(), PArguments.getThreadState(frame)) <= 0;
489488
} else {
@@ -504,7 +503,7 @@ abstract static class GreaterEqualNode extends PythonBinaryBuiltinNode {
504503
@Specialization(limit = "1")
505504
boolean doGE(VirtualFrame frame, PBaseSet self, PBaseSet other,
506505
@Cached("createBinaryProfile()") ConditionProfile hasFrame,
507-
@CachedLibrary("self.getDictStorage()") HashingStorageLibrary lib) {
506+
@CachedLibrary("other.getDictStorage()") HashingStorageLibrary lib) {
508507
if (hasFrame.profile(frame != null)) {
509508
return lib.compareKeysWithState(other.getDictStorage(), self.getDictStorage(), PArguments.getThreadState(frame)) <= 0;
510509
} else {

mx.graalpython/mx_graalpython.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,12 @@ def update_import_cmd(args):
865865
overlaytip = str(vc.tip(overlaydir)).strip()
866866
repos_updated.append(overlaydir)
867867

868+
# now allow dependent repos to hook into update
869+
for repo in repos:
870+
cmdname = "%s-update-import" % os.path.basename(repo)
871+
if mx.run_mx(["help", cmdname], nonZeroIsFatal=False, quiet=True) == 0:
872+
mx.run_mx([cmdname, "--overlaydir=%s" % overlaydir], suite=repo, nonZeroIsFatal=True)
873+
868874
# update ci import in all our repos, commit the full update, and push verbosely
869875
prev_verbosity = mx._opts.very_verbose
870876
for repo in repos:

0 commit comments

Comments
 (0)