diff --git a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_asyncio.txt b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_asyncio.txt index 7c44555c32..7f6b6d1ef8 100644 --- a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_asyncio.txt +++ b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_asyncio.txt @@ -1127,7 +1127,7 @@ test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_yield_future_passes_canc test.test_asyncio.test_tasks.PyTask_PyFuture_Tests.test_yield_wait_does_not_shield_cancel @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests.test_run_coroutine_threadsafe @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests.test_run_coroutine_threadsafe_task_cancelled @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github -test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests.test_run_coroutine_threadsafe_task_factory_exception @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github +test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests.test_run_coroutine_threadsafe_task_factory_exception @ darwin-arm64,linux-aarch64,linux-x86_64 test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests.test_run_coroutine_threadsafe_with_exception @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github test.test_asyncio.test_tasks.RunCoroutineThreadsafeTests.test_run_coroutine_threadsafe_with_timeout @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github test.test_asyncio.test_tasks.SleepTests.test_sleep_zero @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github diff --git a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_string_literals.txt b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_string_literals.txt index be48fbb2d4..978033ea07 100644 --- a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_string_literals.txt +++ b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_string_literals.txt @@ -3,7 +3,7 @@ test.test_string_literals.TestLiterals.test_eval_bytes_invalid_escape @ darwin-a test.test_string_literals.TestLiterals.test_eval_bytes_normal @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_string_literals.TestLiterals.test_eval_bytes_raw @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_string_literals.TestLiterals.test_eval_str_incomplete @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github -test.test_string_literals.TestLiterals.test_eval_str_invalid_escape @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github +test.test_string_literals.TestLiterals.test_eval_str_invalid_escape @ darwin-arm64,linux-aarch64,linux-x86_64,win32-AMD64 test.test_string_literals.TestLiterals.test_eval_str_normal @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_string_literals.TestLiterals.test_eval_str_raw @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github test.test_string_literals.TestLiterals.test_eval_str_u @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github,win32-AMD64,win32-AMD64-github diff --git a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_subprocess.txt b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_subprocess.txt index d6598dac7b..e7127c7d4f 100644 --- a/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_subprocess.txt +++ b/graalpython/com.oracle.graal.python.test/src/tests/unittest_tags/test_subprocess.txt @@ -19,9 +19,9 @@ test.test_subprocess.POSIXProcessTestCase.test_call_string @ darwin-arm64,linux- test.test_subprocess.POSIXProcessTestCase.test_close_fd_0 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_close_fd_1 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_close_fd_2 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github -test.test_subprocess.POSIXProcessTestCase.test_close_fds_0_1 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github -test.test_subprocess.POSIXProcessTestCase.test_close_fds_0_1_2 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github -test.test_subprocess.POSIXProcessTestCase.test_close_fds_0_2 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github +test.test_subprocess.POSIXProcessTestCase.test_close_fds_0_1 @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github +test.test_subprocess.POSIXProcessTestCase.test_close_fds_0_1_2 @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github +test.test_subprocess.POSIXProcessTestCase.test_close_fds_0_2 @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_close_fds_1_2 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_communicate_BrokenPipeError_stdin_close @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_communicate_BrokenPipeError_stdin_close_with_timeout @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github @@ -46,7 +46,7 @@ test.test_subprocess.POSIXProcessTestCase.test_send_signal_race @ darwin-arm64,l test.test_subprocess.POSIXProcessTestCase.test_send_signal_race2 @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_shell_sequence @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_shell_string @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github -test.test_subprocess.POSIXProcessTestCase.test_small_errpipe_write_fd @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github +test.test_subprocess.POSIXProcessTestCase.test_small_errpipe_write_fd @ darwin-arm64,linux-aarch64,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_specific_shell @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_start_new_session @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github test.test_subprocess.POSIXProcessTestCase.test_stderr_stdin_are_single_inout_fd @ darwin-arm64,linux-aarch64,linux-aarch64-github,linux-x86_64,linux-x86_64-github diff --git a/graalpython/lib-graalpython/patches/pymupdf.patch b/graalpython/lib-graalpython/patches/pymupdf.patch index 3adcf03f9b..1fde6f803b 100644 --- a/graalpython/lib-graalpython/patches/pymupdf.patch +++ b/graalpython/lib-graalpython/patches/pymupdf.patch @@ -1,87 +1,3 @@ -diff --git a/graalpy-config b/graalpy-config -new file mode 100755 -index 00000000..1f69f726 ---- /dev/null -+++ b/graalpy-config -@@ -0,0 +1,78 @@ -+#!/bin/sh -+ -+# Adapted from CPython but deferring to GraalPy -+ -+exit_with_usage () -+{ -+ echo "Usage: $0 --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--help|--abiflags|--configdir|--embed" -+ exit $1 -+} -+ -+if [ "$1" = "" ] ; then -+ exit_with_usage 1 -+fi -+ -+# Returns the actual prefix where this script was installed to. -+EXE=$(cd $(dirname "$0") && pwd -P) -+if which readlink >/dev/null 2>&1 ; then -+ if readlink -f "$RESULT" >/dev/null 2>&1; then -+ EXE=$(readlink -f "$RESULT") -+ fi -+fi -+EXE=$EXE/graalpy -+ -+if ! test -x "$EXE" ; then -+ EXE=graalpy -+fi -+ -+# Scan for --help or unknown argument. -+for ARG in $* -+do -+ case $ARG in -+ --help) -+ exit_with_usage 0 -+ ;; -+ --embed) -+ echo "graalpy-config does not print embedding flags" -+ exit 1 -+ ;; -+ --prefix|--exec-prefix|--includes|--libs|--cflags|--ldflags|--extension-suffix|--abiflags|--configdir) -+ ;; -+ *) -+ exit_with_usage 1 -+ ;; -+ esac -+done -+ -+for ARG in "$@" -+do -+ case "$ARG" in -+ --prefix) -+ $EXE -c "print(__import__('sysconfig').get_config_var('prefix'))" -+ ;; -+ --exec-prefix) -+ $EXE -c "print(__import__('sysconfig').get_config_var('exec_prefix'))" -+ ;; -+ --includes) -+ $EXE -c "from sysconfig import get_path; print('-I'+get_path('include'), '-I'+get_path('platinclude'))" -+ ;; -+ --cflags) -+ $EXE -c "import sysconfig as s; print('-I' + s.get_path('include'), '-I' + s.get_path('platinclude'), s.get_config_var('CFLAGS').replace('NDEBUG', 'DEBUG'), s.get_config_var('OPT').replace('NDEBUG', 'DEBUG'))" -+ ;; -+ --libs) -+ $EXE -c "import sysconfig as s; print('-L' + s.get_config_var('LIBDIR'))" -+ ;; -+ --ldflags) -+ $EXE -c "import sysconfig as s; print('-L' + s.get_config_var('LIBDIR'))" -+ ;; -+ --extension-suffix) -+ $EXE -c "import sysconfig as s; print(s.get_config_var('EXT_SUFFIX'))" -+ ;; -+ --abiflags) -+ $EXE -c "import sysconfig as s; print(s.get_config_var('ABIFLAGS'))" -+ ;; -+ --configdir) -+ echo "" -+ ;; -+esac -+done diff --git a/setup.py b/setup.py index 5fba2c97..3fe63b07 100755 --- a/setup.py @@ -98,12 +14,12 @@ index 5fba2c97..3fe63b07 100755 + def build_wheel(wheel_directory, config_settings=None, metadata_directory=None): + wheel_directory = Path(wheel_directory).absolute() + sdir = Path(__file__).absolute().parent -+ cpythonname = os.environ.get("CPYTHON_EXE", "python3.11") ++ cpythonname = os.environ.get("CPYTHON_EXE", "python3.12") + cpython = shutil.which(cpythonname) or cpythonname + if not os.path.exists(cpython): + raise RuntimeError(f"{cpythonname} must be available on the PATH for cross-compilation") + env = os.environ.copy() -+ env["PIPCL_PYTHON_CONFIG"] = str(sdir / "graalpy-config") ++ env["PIPCL_PYTHON_CONFIG"] = str(Path(sys.executable).parent / "graalpy-config") + env["PYMUPDF_SETUP_PY_LIMITED_API"] = "1" + subprocess.run( + [cpython, "setup.py", "bdist_wheel"], diff --git a/graalpython/lib-python/3/test/test_re.py b/graalpython/lib-python/3/test/test_re.py index 67e32f249f..b0f3e80b18 100644 --- a/graalpython/lib-python/3/test/test_re.py +++ b/graalpython/lib-python/3/test/test_re.py @@ -2431,7 +2431,9 @@ def test_search_anchor_at_beginning(self): t = time.perf_counter() - start # Without optimization it takes 1 second on my computer. # With optimization -- 0.0003 seconds. - self.assertLess(t, 0.1) + # GraalPy change: on Github, it may take longer... + # self.assertLess(t, 0.1) + self.assertLess(t, 0.5) def test_possessive_quantifiers(self): """Test Possessive Quantifiers diff --git a/graalpython/lib-python/3/venv/__init__.py b/graalpython/lib-python/3/venv/__init__.py index 70d1ee8f39..e706d164c5 100644 --- a/graalpython/lib-python/3/venv/__init__.py +++ b/graalpython/lib-python/3/venv/__init__.py @@ -335,7 +335,7 @@ def setup_python(self, context): if not os.path.islink(path): os.chmod(path, 0o755) # Truffle change: we add 'graalpy' to the list - for suffix in ('python', 'python3', f'python3.{sys.version_info[1]}', 'graalpy'): + for suffix in ('python', 'python3', f'python3.{sys.version_info[1]}', 'graalpy', 'graalpy-config'): path = os.path.join(binpath, suffix) if not os.path.exists(path): # Issue 18807: make copies if diff --git a/mx.graalpython/mx_graalpython.py b/mx.graalpython/mx_graalpython.py index 95df723378..32f19c511d 100644 --- a/mx.graalpython/mx_graalpython.py +++ b/mx.graalpython/mx_graalpython.py @@ -1221,8 +1221,11 @@ def run_python_unittests(python_binary, args=None, paths=None, exclude=None, env parallel = 4 if paths is None else 1 if sys.platform == 'win32': - # Windows machines don't seem to have much memory - parallel = min(parallel, 2) + if CI: + # Windows machines don't seem to have much memory + parallel = min(parallel, 2) + if GITHUB_CI: + parallel = 0 parallelism = str(min(os.cpu_count() or 1, parallel)) diff --git a/scripts/gh2bb b/scripts/gh2bb new file mode 100755 index 0000000000..8645499f20 --- /dev/null +++ b/scripts/gh2bb @@ -0,0 +1,123 @@ +# Copyright (c) 2026, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# The Universal Permissive License (UPL), Version 1.0 +# +# Subject to the condition set forth below, permission is hereby granted to any +# person obtaining a copy of this software, associated documentation and/or +# data (collectively the "Software"), free of charge and under any and all +# copyright rights in the Software, and any and all patent rights owned or +# freely licensable by each licensor hereunder covering either (i) the +# unmodified Software as contributed to or provided by such licensor, or (ii) +# the Larger Works (as defined below), to deal in both +# +# (a) the Software, and +# +# (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if +# one is included with the Software each a "Larger Work" to which the Software +# is contributed by such licensors), +# +# without restriction, including without limitation the rights to copy, create +# derivative works of, display, perform, and distribute the Software and make, +# use, sell, offer for sale, import, export, have made, and have sold the +# Software and the Larger Work(s), and to sublicense the foregoing rights on +# either these or other terms. +# +# This license is subject to the following condition: +# +# The above copyright notice and either this complete permission notice or at a +# minimum a reference to the UPL must be included in all copies or substantial +# portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +#!/usr/bin/env bash + +if [ $# -ne 0 ]; then + cat <&1) +if [ $? -eq 0 ]; then + remote=$(echo "${remotes}" | grep -E ".*bitbucket.*/${BBREPO}(\.git)? \(push\)") + if [ -n "$remote" ]; then + remote=$(echo $remote | cut -f1 -d' ') + fi +fi + +if [ -z "$remote" ]; then + echo "Must be in the ${BBREPO} git repo with the bitbucket remote" + exit 1 +fi + +open_prs=$(ol-cli github list-prs -o ${GHOWNER} -r ${GHREPO} -s open | grep "PullRequest ID" | grep -v -E '\[GR-[0-9]+\]') +declare -a menu_items +declare -a urls +while IFS= read -r line; do + url=$(echo "$line" | sed -n -E 's#.*pull/([0-9]+).*#\1#p') + title=$(echo "$line" | sed -n -E 's#.*TITLE \[(.+)\] URL.*#\1#p') + title=$(printf "%s" "$title" | xargs) + menu_items+=("$title #$url") + urls+=("$url") +done <<< "$open_prs" +echo "Open PRs without an associated Jira reference:" +PS3="Enter the number of the PR you want to mirror (0 to abort): " +select choice in "${menu_items[@]}"; do + if [[ -z "$choice" ]]; then + echo "No selection made. Exiting." + exit 0 + fi + sel_index=$((REPLY-1)) + selected_pr="${urls[$sel_index]}" + selected_title="${menu_items[$sel_index]}" + break +done + +githubpullurl="https://github.com/${GHOWNER}/${GHREPO}/pull/${selected_pr}" +jiraissueurl="$(ol-cli jira search --max=1 -jql="\"Web Link\" = \"${githubpullurl}\" AND \"Resolution\" = \"Unresolved\"" | grep https)" +if [ $? -ne 0 ]; then + printf "Mirroring the Github PR to a Jira issue... " + parent_dir="$(readlink -f "${BASH_SOURCE[0]}" | xargs dirname)" + jiraissue=$(ol-cli jira mirror --from=GITHUB "--labels-mapping=${parent_dir}/github_mapping.yaml" --link "https://github.com/${GHOWNER}/${GHREPO}/issues/${selected_pr}" --format=key) +else + printf "Jira issue exists... " + jiraissue=$(echo $jiraissueurl | sed 's#.*/##') +fi +echo "$jiraissue" + +echo "Mirroring the code from Github to Bitbucket..." +mirrorbranch="gh/${selected_pr}" +git fetch --force "https://github.com/${GHOWNER}/${GHREPO}" "pull/${selected_pr}/head:${mirrorbranch}" +git push --force-with-lease "${remote}" "${mirrorbranch}:${mirrorbranch}" + +pr="$(ol-cli bitbucket list-prs --project G --repos graalpython --filterText "${selected_title}" 2>/dev/null | grep "/${BBREPO}/")" +if [ $? -ne 0 ]; then + printf "Opening the bitbucket PR... " + pr=$(ol-cli bitbucket create-pr --project G --repo "${BBREPO}" --from-branch "${mirrorbranch}" --to-branch master --title "[${jiraissue}] ${selected_title}" --description "Mirrored from ${githubpullurl}") +else + printf "Bitbucket PR exists... " +fi +echo "$pr" diff --git a/scripts/github_mapping.yaml b/scripts/github_mapping.yaml new file mode 100644 index 0000000000..56436396dd --- /dev/null +++ b/scripts/github_mapping.yaml @@ -0,0 +1,23 @@ +# Used by the gh2bb script to mirror Github PRs to the internal CI and issue tracking +api: github +repos: + - repo: oracle/graalpython + project: GR + githubLinkField: customfield_12408 + issueTypes: + OCA Verified: Task + components: + default: Python + Product Type: + default: CE + labels: + defaultLabels: + - githubissue + - no-backport +users: + timfel: tim.felgentreff@oracle.com + msimacek: michael.simacek@oracle.com + fangerer: florian.angerer@oracle.com + steve-s: stepan.sindelar@oracle.com + otethal: ondrej.tethal@oracle.com +