diff --git a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java index 664704efba..54a7030aad 100644 --- a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java +++ b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java @@ -205,7 +205,9 @@ public final class PythonLanguage extends TruffleLanguage { public static final int GRAALVM_MAJOR; public static final int GRAALVM_MINOR; public static final int GRAALVM_MICRO; - public static final String DEV_TAG; + + /** See {@code mx_graalpython.py:abi_version} */ + public static final String GRAALPY_ABI_VERSION; /* Magic number used to mark pyc files */ public static final int MAGIC_NUMBER = 21000 + Compiler.BYTECODE_VERSION * 10; @@ -226,8 +228,6 @@ public final class PythonLanguage extends TruffleLanguage { static { // The resource file is built by mx from "graalpy-versions" project using mx substitutions. - // The actual values of the versions are computed by mx helper functions py_version_short, - // graal_version_short, and dev_tag defined in mx_graalpython.py try (InputStream is = PythonLanguage.class.getResourceAsStream("/graalpy_versions")) { int ch; if (MAJOR != (ch = is.read() - VERSION_BASE)) { @@ -257,13 +257,7 @@ public final class PythonLanguage extends TruffleLanguage { default: RELEASE_LEVEL_STRING = tsLiteral("final"); } - // see mx.graalpython/mx_graalpython.py:dev_tag - byte[] rev = new byte[3 /* 'dev' */ + 10 /* revision */]; - if (is.read(rev) == rev.length) { - DEV_TAG = new String(rev, StandardCharsets.US_ASCII).strip(); - } else { - DEV_TAG = ""; - } + GRAALPY_ABI_VERSION = new String(is.readAllBytes(), StandardCharsets.US_ASCII).strip(); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SysModuleBuiltins.java b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SysModuleBuiltins.java index c2b27d5f2e..b576a43423 100644 --- a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SysModuleBuiltins.java +++ b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SysModuleBuiltins.java @@ -40,7 +40,6 @@ */ package com.oracle.graal.python.builtins.modules; -import static com.oracle.graal.python.PythonLanguage.J_GRAALPYTHON_ID; import static com.oracle.graal.python.PythonLanguage.RELEASE_LEVEL; import static com.oracle.graal.python.PythonLanguage.RELEASE_SERIAL; import static com.oracle.graal.python.PythonLanguage.T_GRAALPYTHON_ID; @@ -472,10 +471,7 @@ protected List> getNodeFa private static PSimpleNamespace makeImplementation(PythonLanguage language, PTuple graalpyVersionInfo, TruffleString gmultiarch) { final PSimpleNamespace ns = PFactory.createSimpleNamespace(language); ns.setAttribute(StringLiterals.T_NAME, T_GRAALPYTHON_ID); - /*- 'cache_tag' must match the format of mx.graalpython/mx_graalpython.py:graalpy_ext */ - ns.setAttribute(T_CACHE_TAG, toTruffleStringUncached(J_GRAALPYTHON_ID + - PythonLanguage.GRAALVM_MAJOR + PythonLanguage.GRAALVM_MINOR + PythonLanguage.DEV_TAG + - "-" + PythonLanguage.MAJOR + PythonLanguage.MINOR)); + ns.setAttribute(T_CACHE_TAG, toTruffleStringUncached(PythonLanguage.GRAALPY_ABI_VERSION)); ns.setAttribute(T_VERSION, graalpyVersionInfo); ns.setAttribute(T__MULTIARCH, gmultiarch); ns.setAttribute(tsLiteral("hexversion"), PythonLanguage.GRAALVM_MAJOR << 24 | PythonLanguage.GRAALVM_MINOR << 16 | PythonLanguage.GRAALVM_MICRO << 8 | RELEASE_LEVEL << 4 | RELEASE_SERIAL); diff --git a/mx.graalpython/mx_graalpython.py b/mx.graalpython/mx_graalpython.py index e36f63a74d..926f12afec 100644 --- a/mx.graalpython/mx_graalpython.py +++ b/mx.graalpython/mx_graalpython.py @@ -90,6 +90,7 @@ def get_boolean_env(name, default=False): SUITE = cast(mx.SourceSuite, mx.suite('graalpython')) SUITE_COMPILER = mx.suite("compiler", fatalIfMissing=False) +GRAALPY_ABI_VERSION = 'graalpy250' GRAAL_VERSION = SUITE.suiteDict['version'] IS_RELEASE = SUITE.suiteDict['release'] GRAAL_VERSION_MAJ_MIN = ".".join(GRAAL_VERSION.split(".")[:2]) @@ -1923,7 +1924,7 @@ def graalpy_ext(*_): # on Windows we use '.pyd' else '.so' but never '.dylib' (similar to CPython): # https://github.com/python/cpython/issues/37510 ext = 'pyd' if os == 'windows' else 'so' - return f'.graalpy{GRAAL_VERSION_MAJ_MIN.replace(".", "") + dev_tag()}-{PYTHON_VERSION_MAJ_MIN.replace(".", "")}-native-{arch}-{pyos}.{ext}' + return f'.{abi_version()}-native-{arch}-{pyos}.{ext}' def dev_tag(_=None): @@ -1949,6 +1950,11 @@ def dev_tag(_=None): return res +def abi_version(): + # The ABI version for wheel cache tag + return f'{GRAALPY_ABI_VERSION}{dev_tag()}-{PYTHON_VERSION_MAJ_MIN.replace(".", "")}' + + mx_subst.path_substitutions.register_with_arg('suite', _get_suite_dir) mx_subst.path_substitutions.register_with_arg('suite_parent', _get_suite_parent_dir) mx_subst.path_substitutions.register_with_arg('src_dir', _get_src_dir) @@ -1956,7 +1962,7 @@ def dev_tag(_=None): mx_subst.path_substitutions.register_with_arg('py_ver', py_version_short) mx_subst.path_substitutions.register_with_arg('graal_ver', graal_version_short) mx_subst.path_substitutions.register_with_arg('release_level', release_level) -mx_subst.results_substitutions.register_with_arg('dev_tag', dev_tag) +mx_subst.results_substitutions.register_no_arg('abi_version', abi_version) mx_subst.path_substitutions.register_no_arg('graalpy_ext', graalpy_ext) mx_subst.results_substitutions.register_no_arg('graalpy_ext', graalpy_ext) diff --git a/mx.graalpython/suite.py b/mx.graalpython/suite.py index 6c92430151..c38092e99d 100644 --- a/mx.graalpython/suite.py +++ b/mx.graalpython/suite.py @@ -630,7 +630,7 @@ "max_jobs": "1", "ninja_targets": ["all"], "cmakeConfig": { - "GRAALPY_VER": "", + "GRAALPY_VER": "", }, "results": [ "graalpy_versions"