Skip to content

Commit ce34cad

Browse files
committed
[GR-53060] Do not fail gates because of hardcoded versions.
PullRequest: graalpython/3282
2 parents 23d75f3 + 3c93afe commit ce34cad

File tree

11 files changed

+118
-525
lines changed

11 files changed

+118
-525
lines changed

graalpython/com.oracle.graal.python.test.integration/pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,17 @@ Additionally, one can change the polyglot artifacts version with
9999
</build>
100100

101101
<profiles>
102+
<profile>
103+
<id>Version from suite</id>
104+
<activation>
105+
<property>
106+
<name>env.GRAALPY_VERSION</name>
107+
</property>
108+
</activation>
109+
<properties>
110+
<com.oracle.graal.python.test.polyglot.version>${env.GRAALPY_VERSION}</com.oracle.graal.python.test.polyglot.version>
111+
</properties>
112+
</profile>
102113
<profile>
103114
<id>Custom central repo</id>
104115
<activation>

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_jbang_integration.py

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def ensureLocalMavenRepo(self):
119119
def clearCache(self):
120120
command = [JBANG_CMD, "cache", "clear"]
121121
out, result = run_cmd(command)
122-
122+
123123
def getCatalogFile(self):
124124
catalog_dir = os.path.dirname(os.path.abspath(__file__))
125125
for _ in range(5):
@@ -188,29 +188,6 @@ def test_catalog(self):
188188
file_path = os.path.normpath(os.path.join(os.path.dirname(self.catalog_file), file_ref))
189189
self.assertTrue(os.path.isfile(file_path), f"The path definied in catalog is not found: {file_path}")
190190

191-
@unittest.skipUnless(is_enabled, "ENABLE_JBANG_INTEGRATION_UNITTESTS is not true")
192-
def test_graal_version(self):
193-
json_data = self.getCatalogData(self.catalog_file)
194-
for alias in json_data.get("aliases", {}).values():
195-
script_ref = alias.get("script-ref")
196-
script_path = os.path.normpath(os.path.join(os.path.dirname(self.catalog_file), script_ref))
197-
with open(script_path, 'r') as script_file:
198-
content = script_file.read()
199-
self.assertIn (f"//DEPS org.graalvm.python:python-language:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-language:{GRAAL_VERSION} was not found in {script_path}")
200-
self.assertIn (f"//DEPS org.graalvm.python:python-resources:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-resources:{GRAAL_VERSION} was not found in {script_path}")
201-
self.assertIn (f"//DEPS org.graalvm.python:python-launcher:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-launcher:{GRAAL_VERSION} was not found in {script_path}")
202-
self.assertIn (f"//DEPS org.graalvm.python:python-embedding:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-embedding:{GRAAL_VERSION} was not found in {script_path}")
203-
204-
for template in json_data.get("templates", {}).values():
205-
for file_ref in template.get("file-refs", {}).values():
206-
file_path = os.path.normpath(os.path.join(os.path.dirname(self.catalog_file), file_ref))
207-
with open(script_path, 'r') as script_file:
208-
content = script_file.read()
209-
self.assertIn (f"//DEPS org.graalvm.python:python-language:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-language:{GRAAL_VERSION} was not found in {script_path}")
210-
self.assertIn (f"//DEPS org.graalvm.python:python-resources:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-resources:{GRAAL_VERSION} was not found in {script_path}")
211-
self.assertIn (f"//DEPS org.graalvm.python:python-launcher:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-launcher:{GRAAL_VERSION} was not found in {script_path}")
212-
self.assertIn (f"//DEPS org.graalvm.python:python-embedding:{GRAAL_VERSION}", content, f"//DEPS org.graalvm.python:python-embedding:{GRAAL_VERSION} was not found in {script_path}")
213-
214191
@unittest.skipUnless(is_enabled, "ENABLE_JBANG_INTEGRATION_UNITTESTS is not true")
215192
def test_graalpy_template(self):
216193
template_name = "graalpy"
@@ -233,7 +210,7 @@ def test_graalpy_template(self):
233210

234211
self.assertTrue(result == 0, f"Execution failed with code {result}\n command: {command}\n stdout: {out}\n")
235212
self.assertTrue(expected_text in out, f"Expected text:\n{expected_text}\nbut in stdout was:\n{out}")
236-
213+
237214
@unittest.skipUnless(is_enabled, "ENABLE_JBANG_INTEGRATION_UNITTESTS is not true")
238215
@unittest.skipUnless('win32' not in sys.platform, "Currently the jbang native image on Win gate fails.")
239216
def test_graalpy_template_native(self):

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ public final class PythonLanguage extends TruffleLanguage<PythonContext> {
191191
* a GraalVM build, but we may run from Jar files directly during development. We generate the
192192
* version during the build that are checked against these constants.
193193
*/
194-
public static final int GRAALVM_MAJOR = 24;
195-
public static final int GRAALVM_MINOR = 1;
194+
public static final int GRAALVM_MAJOR;
195+
public static final int GRAALVM_MINOR;
196196
public static final String DEV_TAG;
197197

198198
/**
@@ -229,12 +229,8 @@ public final class PythonLanguage extends TruffleLanguage<PythonContext> {
229229
if (MICRO != (ch = is.read() - VERSION_BASE)) {
230230
throw new RuntimeException("suite.py version info does not match PythonLanguage#MICRO: " + ch);
231231
}
232-
if (GRAALVM_MAJOR != (ch = is.read() - VERSION_BASE)) {
233-
throw new RuntimeException("suite.py version info does not match PythonLanguage#GRAALVM_MAJOR: " + ch);
234-
}
235-
if (GRAALVM_MINOR != (ch = is.read() - VERSION_BASE)) {
236-
throw new RuntimeException("suite.py version info does not match PythonLanguage#GRAALVM_MINOR: " + ch);
237-
}
232+
GRAALVM_MAJOR = is.read() - VERSION_BASE;
233+
GRAALVM_MINOR = is.read() - VERSION_BASE;
238234
is.read(); // skip GraalVM micro version
239235
// see mx.graalpython/mx_graalpython.py:dev_tag
240236
byte[] rev = new byte[3 /* 'dev' */ + 10 /* revision */];

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonOptions.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ private PythonOptions() {
112112
@Option(category = OptionCategory.EXPERT, help = "Set the location of sys.base_prefix. Overrides any environment variables or Java options.", usageSyntax = "<path>", stability = OptionStability.STABLE) //
113113
public static final OptionKey<TruffleString> SysBasePrefix = new OptionKey<>(T_EMPTY_STRING, TS_OPTION_TYPE);
114114

115-
@Option(category = OptionCategory.USER, help = "Set the location of lib/graalpy" + PythonLanguage.GRAALVM_MAJOR + "." + //
116-
PythonLanguage.GRAALVM_MINOR + ". Overrides any environment variables or Java options.", //
115+
@Option(category = OptionCategory.USER, help = "Set the location of what is usually lib/graalpy<graalvm_major>.<graalvm_minor>. Overrides any environment variables or Java options.", //
117116
usageSyntax = "<path>", stability = OptionStability.STABLE) //
118117
public static final OptionKey<TruffleString> CoreHome = new OptionKey<>(T_EMPTY_STRING, TS_OPTION_TYPE);
119118

graalpython/graalpy-archetype-polyglot-app/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ SOFTWARE.
4444

4545
<groupId>org.graalvm.python</groupId>
4646
<artifactId>graalpy-archetype-polyglot-app</artifactId>
47+
<!-- This version is always overridden when deploying using mx -->
4748
<version>24.1.0</version>
4849
<url>http://www.graalvm.org/</url>
4950
<description>Maven archetype providing a skeleton GraalPy - Java polyglot application.</description>

graalpython/graalpy-jbang/examples/hello.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
*/
4141
///usr/bin/env jbang "$0" "$@" ; exit $?
4242

43-
//DEPS org.graalvm.python:python-language:24.1.0
44-
//DEPS org.graalvm.python:python-resources:24.1.0
45-
//DEPS org.graalvm.python:python-launcher:24.1.0
46-
//DEPS org.graalvm.python:python-embedding:24.1.0
43+
//DEPS org.graalvm.python:python-language:${env.GRAALPY_VERSION:24.0.0}
44+
//DEPS org.graalvm.python:python-resources:${env.GRAALPY_VERSION:24.0.0}
45+
//DEPS org.graalvm.python:python-launcher:${env.GRAALPY_VERSION:24.0.0}
46+
//DEPS org.graalvm.python:python-embedding:${env.GRAALPY_VERSION:24.0.0}
4747
//PIP termcolor
4848

4949
import org.graalvm.polyglot.Context;

graalpython/graalpy-jbang/templates/graalpy-template.java.qute

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
//DEPS {dep}
44
{/for}
55
{#if dependencies.isEmpty()}// //DEPS <dependency1> <dependency2>{/if}
6-
7-
//DEPS org.graalvm.python:python-language:24.1.0
8-
//DEPS org.graalvm.python:python-resources:24.1.0
9-
//DEPS org.graalvm.python:python-launcher:24.1.0
10-
//DEPS org.graalvm.python:python-embedding:24.1.0
6+
{|
7+
//DEPS org.graalvm.python:python-language:${env.GRAALPY_VERSION:24.0.0}
8+
//DEPS org.graalvm.python:python-resources:${env.GRAALPY_VERSION:24.0.0}
9+
//DEPS org.graalvm.python:python-launcher:${env.GRAALPY_VERSION:24.0.0}
10+
//DEPS org.graalvm.python:python-embedding:${env.GRAALPY_VERSION:24.0.0}
1111
//PIP termcolor
12-
12+
|}
1313
import org.graalvm.polyglot.Context;
1414
import org.graalvm.polyglot.PolyglotAccess;
1515
import org.graalvm.polyglot.PolyglotException;

graalpython/graalpy-jbang/templates/graalpy-template_local_repo.java.qute

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66

77
//REPOS mc=https://repo1.maven.org/maven2/
88
//REPOS local=file://{path_to_local_repo}
9-
//DEPS org.graalvm.python:python-language:24.1.0
10-
//DEPS org.graalvm.python:python-resources:24.1.0
11-
//DEPS org.graalvm.python:python-launcher:24.1.0
12-
//DEPS org.graalvm.python:python-embedding:24.1.0
9+
{|
10+
//DEPS org.graalvm.python:python-language:${env.GRAALPY_VERSION:24.0.0}
11+
//DEPS org.graalvm.python:python-resources:${env.GRAALPY_VERSION:24.0.0}
12+
//DEPS org.graalvm.python:python-launcher:${env.GRAALPY_VERSION:24.0.0}
13+
//DEPS org.graalvm.python:python-embedding:${env.GRAALPY_VERSION:24.0.0}
1314
//PIP termcolor
14-
15+
|}
1516
import org.graalvm.polyglot.Context;
1617
import org.graalvm.polyglot.PolyglotAccess;
1718
import org.graalvm.polyglot.PolyglotException;

graalpython/graalpy-maven-plugin/pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ SOFTWARE.
4747
<groupId>org.graalvm.python</groupId>
4848
<artifactId>graalpy-maven-plugin</artifactId>
4949
<packaging>maven-plugin</packaging>
50+
<!-- This version is always overridden when deploying using mx -->
5051
<version>24.1.0</version>
5152
<url>http://www.graalvm.org/</url>
5253
<name>graalpy-maven-plugin</name>
@@ -59,6 +60,20 @@ SOFTWARE.
5960
<graalpy.version>24.1.0</graalpy.version>
6061
</properties>
6162

63+
<profiles>
64+
<profile>
65+
<id>Version from suite</id>
66+
<activation>
67+
<property>
68+
<name>env.GRAALPY_VERSION</name>
69+
</property>
70+
</activation>
71+
<properties>
72+
<graalpy.version>${env.GRAALPY_VERSION}</graalpy.version>
73+
</properties>
74+
</profile>
75+
</profiles>
76+
6277
<build>
6378
<plugins>
6479
<plugin>

0 commit comments

Comments
 (0)