diff --git a/.github/workflows/_downstream-test-oracledb.yml b/.github/workflows/_downstream-test-oracledb.yml index a7a1737729..0b13c66cc6 100644 --- a/.github/workflows/_downstream-test-oracledb.yml +++ b/.github/workflows/_downstream-test-oracledb.yml @@ -213,6 +213,14 @@ jobs: lld liblld-dev \ clang libclang-dev \ cmake + if sudo apt-get install -y libaio1t64; then + # Oracle Instant Client still looks for the pre-t64 SONAME on Ubuntu 24.04. + libaio_t64="$(dpkg -L libaio1t64 | grep '/libaio\.so\.1t64$')" + sudo ln -sf "$libaio_t64" "$(dirname "$libaio_t64")/libaio.so.1" + sudo ldconfig + else + sudo apt-get install -y libaio1 + fi - name: Install Oracle Instant Client run: | curl -fL https://download.oracle.com/otn_software/linux/instantclient/instantclient-basiclite-linuxx64.zip -o instantclient-basiclite.zip diff --git a/AGENTS.md b/AGENTS.md index 15732ee8f5..a8b507d1a0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -32,7 +32,6 @@ It consists of: Java (Truffle) + C (CPython C-API compatibility) + Python stdlib | Vendored stdlib + CPython tests | `graalpython/lib-python/3/` | Large; treat as upstream-ish unless you are explicitly changing stdlib/tests. | | Python-level tests | `graalpython/com.oracle.graal.python.test/src/tests/` | Includes tagged tests + C-API tests. Runner: `.../src/runner.py`. | | CI pipelines | `.github/workflows/`, `ci.jsonnet`, `ci/` | Workflows typically drive `mx` gates/tags. | -| Launchers / helper scripts | `scripts/python.sh`, `scripts/*` | `python.sh` is the local launcher wrapper. | ## CONVENTIONS (DEVIATIONS) - `mx` is the primary build/test entrypoint; suite definition lives in `mx.graalpython/suite.py`. diff --git a/graalpython/com.oracle.graal.python.test/src/tests/test_patmat.py b/graalpython/com.oracle.graal.python.test/src/tests/test_patmat.py index 80219f12c0..146d234a48 100644 --- a/graalpython/com.oracle.graal.python.test/src/tests/test_patmat.py +++ b/graalpython/com.oracle.graal.python.test/src/tests/test_patmat.py @@ -104,6 +104,47 @@ def star_match(x): assert star_match(d) == {33:33} +def test_mapping_star_rest_missing_key_falls_through(): + def single_key(subject): + match subject: + case {"x": x, **rest}: + return ("x", x, rest) + case {**rest}: + return ("rest", rest) + + assert single_key({"p": 1, "q": 2}) == ("rest", {"p": 1, "q": 2}) + assert single_key({"x": 1, "q": 2}) == ("x", 1, {"q": 2}) + + def two_keys(subject): + match subject: + case {"x": x, "y": y, **rest}: + return ("xy", x, y, rest) + case {**rest}: + return ("rest", rest) + + assert two_keys({"p": 1, "q": 2}) == ("rest", {"p": 1, "q": 2}) + assert two_keys({"x": 1, "y": 2, "q": 3}) == ("xy", 1, 2, {"q": 3}) + +def test_mapping_pattern_get_called_once_per_key(): + class CountingDict(dict): + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.get_calls = [] + + def get(self, key, default=None): + self.get_calls.append(key) + return super().get(key, default) + + def match_x(subject): + match subject: + case {"x": x}: + return x + return None + + subject = CountingDict(x=1) + assert match_x(subject) == 1 + assert subject.get_calls == ["x"] + def test_mutable_dict_keys(): class MyObj: pass diff --git a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/bytecode_dsl/RootNodeCompiler.java b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/bytecode_dsl/RootNodeCompiler.java index d0b1808997..5ecb6f3d23 100644 --- a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/bytecode_dsl/RootNodeCompiler.java +++ b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/compiler/bytecode_dsl/RootNodeCompiler.java @@ -5439,12 +5439,17 @@ private void doVisitPattern(PatternTy.MatchMapping node, PatternContext pc) { if (starTarget != null) { BytecodeLocal starVariable = pc.allocateBindVariable(starTarget); - b.beginStoreLocal(starVariable); - b.beginCopyDictWithoutKeys(); - b.emitLoadLocal(pc.subject); - b.emitLoadLocal(keysChecked); - b.endCopyDictWithoutKeys(); - b.endStoreLocal(); + b.beginIfThen(); + b.emitLoadLocal(temp); + b.beginBlock(); + b.beginStoreLocal(starVariable); + b.beginCopyDictWithoutKeys(); + b.emitLoadLocal(pc.subject); + b.emitLoadLocal(keysChecked); + b.endCopyDictWithoutKeys(); + b.endStoreLocal(); + b.endBlock(); + b.endIfThen(); } endTemporaryLocal(keysChecked); diff --git a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java index 528a599194..865e4ab3f3 100644 --- a/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java +++ b/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/bytecode_dsl/PBytecodeDSLRootNode.java @@ -1720,8 +1720,9 @@ public static final class MatchKeys { public static boolean perform(VirtualFrame frame, LocalAccessor values, Object map, Object[] keys, @Bind BytecodeNode bytecodeNode, @Cached MatchKeysNode node) { - values.setObject(bytecodeNode, frame, node.execute(frame, map, keys)); - return node.execute(frame, map, keys) != PNone.NONE; + Object match = node.execute(frame, map, keys); + values.setObject(bytecodeNode, frame, match); + return match != PNone.NONE; } } diff --git a/mx.graalpython/mx_graalpython.py b/mx.graalpython/mx_graalpython.py index 8839527831..8762b61ae1 100644 --- a/mx.graalpython/mx_graalpython.py +++ b/mx.graalpython/mx_graalpython.py @@ -877,7 +877,38 @@ def _dev_pythonhome(): return os.path.join(SUITE.dir, "graalpython") -def get_path_with_patchelf(graalpy=None): +DELVEEWHEEL_GRAALPY_ARTIFACT = "graal/python-native-standalone-svm-svmee-java25-windows-amd64-25.1.3.zip" +DELVEEWHEEL_GRAALPY_HOME = "graalpy3.12-25.1.3-windows-amd64" + + +def _downloaded_graalpy_for_delvewheel(): + download_script = os.environ.get("ARTIFACT_DOWNLOAD_SCRIPT") + if not download_script: + mx.abort("Cannot build delvewheel venv: need CPython >= 3.12 or ARTIFACT_DOWNLOAD_SCRIPT") + + cache_dir = Path(SUITE.get_output_root()).absolute() / "delvewheel-graalpy" + archive = cache_dir / Path(DELVEEWHEEL_GRAALPY_ARTIFACT).name + extracted = cache_dir / "extracted" + graalpy = extracted / DELVEEWHEEL_GRAALPY_HOME / "bin" / "graalpy.exe" + if graalpy.exists(): + return str(graalpy) + + cache_dir.mkdir(parents=True, exist_ok=True) + if not archive.exists(): + mx.log( + f"{time.strftime('[%H:%M:%S] ')} Downloading GraalPy for delvewheel venv: " + f"{DELVEEWHEEL_GRAALPY_ARTIFACT}" + ) + subprocess.check_call([sys.executable, download_script, DELVEEWHEEL_GRAALPY_ARTIFACT, str(archive)]) + + extracted.mkdir(parents=True, exist_ok=True) + mx.Extractor.create(str(archive)).extract(str(extracted)) + if not graalpy.exists(): + mx.abort(f"Could not find bin/graalpy.exe in downloaded artifact {archive}") + return str(graalpy) + + +def get_path_with_patchelf(): path = os.environ.get("PATH", "") if mx.is_linux() and not shutil.which("patchelf"): venv = Path(SUITE.get_output_root()).absolute() / "patchelf-venv" @@ -892,17 +923,29 @@ def get_path_with_patchelf(graalpy=None): venv = Path(SUITE.get_output_root()).absolute() / "delvewheel-venv" path += os.pathsep + str(venv / "Scripts") if not shutil.which("delvewheel", path=path): - if sys.version_info < (3, 12): - if graalpy is None: - graalpy = graalpy_standalone_jvm() - venv_python = [graalpy, "-X", "jit=0"] - else: + if sys.implementation.name == "cpython" and sys.version_info >= (3, 12): venv_python = [sys.executable] - mx.log(f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {shlex.join(venv_python)}... [delvewheel not found on PATH]") + else: + venv_python = [_downloaded_graalpy_for_delvewheel(), "-X", "jit=0"] + mx.log( + f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {shlex.join(venv_python)}... " + "[delvewheel not found on PATH]" + ) t0 = time.time() subprocess.check_call(venv_python + ["-m", "venv", str(venv)]) - subprocess.check_call([str(venv / "Scripts" / "pip.exe"), "install", "delvewheel>=1.13.0"]) - mx.log(f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {shlex.join(venv_python)}... [duration: {time.time() - t0}]") + subprocess.check_call( + [ + str(venv / "Scripts" / "python.exe"), + "-m", + "pip", + "install", + "delvewheel>=1.13.0", + ] + ) + mx.log( + f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {shlex.join(venv_python)}... " + f"[duration: {time.time() - t0}]" + ) return path @@ -1903,7 +1946,7 @@ def graalpython_gate_runner(_, tasks): if task: env = os.environ.copy() graalpy = graalpy_standalone_native() - env['PATH'] = get_path_with_patchelf(graalpy) + env['PATH'] = get_path_with_patchelf() mx.log("1. Running twice without shared engine") run_python_unittests( graalpy, diff --git a/mx.graalpython/mx_graalpython_python_benchmarks.py b/mx.graalpython/mx_graalpython_python_benchmarks.py index e5d685b12e..330e5b4725 100644 --- a/mx.graalpython/mx_graalpython_python_benchmarks.py +++ b/mx.graalpython/mx_graalpython_python_benchmarks.py @@ -131,6 +131,21 @@ SETUPTOOLS_PIN = "77.0.1" + +def add_cpython_build_env(env=None): + if python3_home := os.environ.get("PYTHON3_HOME"): + include_dir = join(python3_home, "Include") + if os.path.exists(join(include_dir, "Python.h")): + env = env.copy() if env is not None else os.environ.copy() + python_includes = os.pathsep.join([include_dir, python3_home]) + include_flags = " ".join(f"-I{path}" for path in python_includes.split(os.pathsep)) + env["CPATH"] = python_includes + (os.pathsep + env["CPATH"] if env.get("CPATH") else "") + for key in ["CFLAGS", "CPPFLAGS", "CXXFLAGS"]: + env[key] = include_flags + (" " + env[key] if env.get(key) else "") + env["LIBRARY_PATH"] = python3_home + (os.pathsep + env["LIBRARY_PATH"] if env.get("LIBRARY_PATH") else "") + return env + + DEFAULT_PYPERFORMANCE_BENCHMARKS = [ # "2to3", # "chameleon", @@ -703,7 +718,8 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs): vm.run(workdir, ["-m", "venv", join(workdir, vm_venv)]) pip = join(workdir, vm_venv, "bin", "pip") - mx.run([pip, "install", *self.BENCHMARK_REQ], cwd=workdir) + env = add_cpython_build_env() if vm.name() == "cpython" else None + mx.run([pip, "install", *self.BENCHMARK_REQ], cwd=workdir, env=env) if vm.name() == "cpython": patch_asv_for_cpython_312(workdir, vm_venv) mx.run( @@ -843,6 +859,8 @@ def _vmRun(self, vm, workdir, command, benchmarks, bmSuiteArgs): constraints.flush() env = os.environ.copy() env['PIP_CONSTRAINT'] = constraints.name + if vm.name() == "cpython": + env = add_cpython_build_env(env) mx.run([pip, "install", *self.BENCHMARK_REQ], cwd=workdir, env=env) if vm.name() == "cpython": patch_asv_for_cpython_312(workdir, vm_venv) diff --git a/scripts/bench.sh b/scripts/bench.sh deleted file mode 100755 index 2dfd299d96..0000000000 --- a/scripts/bench.sh +++ /dev/null @@ -1,79 +0,0 @@ -# Copyright (c) 2017, 2024, 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 - -function info { - local msg=$1 - echo "-----------------------------------------------------------------------------------------" - echo $msg - echo "-----------------------------------------------------------------------------------------" -} - -function bench-py-hotspot { - info "benchmarking GRAALPYTHON with HOTSPOT" - mx --dynamicimports /compiler benchmark micro-graalpython:* -- --python-vm graalpython --python-vm-config default --jvm server --jvm-config default -} - -function bench-py-graal-core { - info "benchmarking GRAALPYTHON with GRAAL-CORE" - mx --dynamicimports /compiler benchmark micro-graalpython:* -- --python-vm graalpython --python-vm-config default --jvm server --jvm-config graal-core -} - -function bench-cpython { - info "benchmarking CPYTHON" - mx benchmark micro-graalpython:* -- --python-vm cpython --python-vm-config default -} - -function bench-pypy { - info "benchmarking PYPY" - mx benchmark micro-graalpython:* -- --python-vm pypy --python-vm-config default -} - - - -# read -p "core, enterprise, hotspot, cpython, pypy? " vm -read -p "core, hotspot, cpython, pypy? " vm -case ${vm} in - 'core') bench-py-graal-core;; - # 'enterprise') bench-py-graal-enterprise;; - 'hotspot') bench-py-hotspot;; - 'cpython') bench-cpython;; - 'pypy') bench-pypy;; -esac diff --git a/scripts/build-tools.sh b/scripts/build-tools.sh deleted file mode 100755 index ed85dc289f..0000000000 --- a/scripts/build-tools.sh +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2017, 2018, 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 -CWD=`pwd` -cd ../graal-enterprise/tools-enterprise/ -mx build -cd #{CWD} diff --git a/scripts/comparepy.sh b/scripts/comparepy.sh deleted file mode 100755 index e1df44032a..0000000000 --- a/scripts/comparepy.sh +++ /dev/null @@ -1,62 +0,0 @@ -# Copyright (c) 2018, 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. - -function info { - local msg=$1 - echo "-----------------------------------------------------------------------------------------" - echo $msg - echo "-----------------------------------------------------------------------------------------" -} - -function graalpython { - info "GRAAL Python" - //mx --dynamicimports /tools-enterprise python -c "$1" - mx python -c "$1" -} - -function cpython { - info "CPython" - python3 -c "$1" -} - -args="$1" - -cpython "${args}" -echo -graalpython "${args}" diff --git a/scripts/gil.py b/scripts/gil.py deleted file mode 100644 index 99fe9e88da..0000000000 --- a/scripts/gil.py +++ /dev/null @@ -1,382 +0,0 @@ -# Copyright (c) 2021, 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. -import argparse -import glob -import os -import re - -# detects the beginning of an exported message -PTRN_MESSAGE = re.compile( - r"@ExportMessage(?P
.*?)(?P\s[a-zA-Z][a-zA-Z0-9]*)\((?P.*?)\)(?P\sthrows .*?)?\s\{", - re.DOTALL | re.MULTILINE | re.UNICODE) - -PTRN_SPECIALIZATION = re.compile( - r"@(Specialization|Fallback)(?P
.*?)(?P\s[a-zA-Z][a-zA-Z0-9]*)\((?P.*?)\)(?P\sthrows .*?)?\s\{", - re.DOTALL | re.MULTILINE | re.UNICODE) - -PTRN_PACKAGE = re.compile( - r"package\s.*?;", - re.DOTALL | re.MULTILINE | re.UNICODE) - -PTRN_GILNODE_ARG = re.compile( - r"(?P,)(?P.*?@Cached GilNode gil)", - re.MULTILINE | re.UNICODE) - -PTRN_REM_GIL_TRY_CATCH = re.compile( - r"(boolean mustRelease = gil\.acquire\(\);\s+)?try\s\{\s(?P.+?)\s+\} finally \{\s+gil\.release\(mustRelease\);\s+\}", - re.DOTALL | re.MULTILINE | re.UNICODE) - -PTRN_REM_GIL_ARGS = re.compile( - r'(,\s+)?@((Cached\.)?Exclusive|Shared\("gil"\))\s@Cached GilNode gil', - re.DOTALL | re.MULTILINE | re.UNICODE) - -PTRN_REM_GIL_BIND = re.compile( - r'(,\s+)?@Bind.*?\sboolean mustRelease', - re.DOTALL | re.MULTILINE | re.UNICODE) - -PTRN_LIB_MSG = re.compile( - r'^ \w(?P
.*?)\s(?P[a-zA-Z][a-zA-Z0-9]*)\((?P.*?)\)(?P\sthrows .*?)?\s\{', - re.MULTILINE | re.UNICODE) - -PTRN_LIB_MSG_ABS = re.compile( - r'^ \w(?P
.*?)\s(?P[a-zA-Z][a-zA-Z0-9]*)\((?P.*?)\)(?P\sthrows .*?)?;', - re.MULTILINE | re.UNICODE) - -RUNTIME_PACKAGE = "package com.oracle.graal.python.runtime;" -GIL_NODE_IMPORT = "import com.oracle.graal.python.runtime.GilNode;" -CACHED_IMPORT = "import com.oracle.truffle.api.dsl.Cached;" -SHARED_IMPORT = "import com.oracle.truffle.api.dsl.Cached.Shared;" -EXCLUSIVE_IMPORT = "import com.oracle.truffle.api.dsl.Cached.Exclusive;" -SKIP_GIL = "// skip GIL" - - -def find_end(match, source, is_class=False): - end = match.end() - cnt = 2 if is_class else 1 - i = 0 - for i, chr in enumerate(source[end:]): - if cnt == 0: - break - if chr == '{': - cnt += 1 - if chr == '}': - cnt -= 1 - return end + i - - -class ExportedMessage(object): - def __init__(self, match, source, start_offset=0, is_class=False, shared=False): - self.match = match - self.full_source = source - self._shared = shared - self._offset = start_offset - self._start = match.start() - self._args_start = match.start('args') - self._args_end = match.end('args') - self._throws_start = match.start('throws') - self._throws_end = match.end('throws') - self._body_start = match.end() - self._end = find_end(match, source, is_class=is_class) - - @property - def start(self): - return self._offset + self._start - - @property - def end(self): - return self._offset + self._end - - @property - def source(self): - return self.full_source[self._start: self._end] - - @property - def header(self): - return self.full_source[self._start: self._args_start - 1] - - @property - def args(self): - return self.full_source[self._args_start: self._args_end] - - @property - def throws(self): - return self.full_source[self._throws_start: self._throws_end] - - @property - def body(self): - return self.full_source[self._body_start:self._end - 1] - - @property - def is_fallback(self): - return '@Fallback' in self.header - - @property - def is_with_gil(self): - return "GilNode gil" in self.source - - @property - def is_class(self): - return ' class ' in self.match.group('header') - - @property - def name(self): - rv = self.match.group('method') - if self.is_class: - hdr = self.match.group('header').split() - name = hdr[hdr.index('class') + 1] - rv = name[:1].lower() + name[1:] - return rv.strip() - - @property - def source_with_gil(self): - # handle varargs ... - _args = self.args - if self.is_fallback: - _uncached_gil = "GilNode gil = GilNode.getUncached();" - else: - _uncached_gil = "" - _args += ",\n " if self.args else "" - if self._shared and ('limit = ' not in self.header or 'limit = "1"' in self.header): - _args += '@Shared("gil")' - else: - _args += "@Exclusive" - _args += "@Cached GilNode gil" - if "..." in _args: - _args = _args.replace("...", "[]") - - return """%s(%s) %s{ - %s boolean mustRelease = gil.acquire(); - try { - %s - } finally { - gil.release(mustRelease); - } -}""" % (self.header, _args, self.throws, _uncached_gil, self.body.strip()) - - @property - def source_without_gil(self): - source = self.source - source = re.sub(PTRN_REM_GIL_TRY_CATCH, lambda match: match.group('body'), source, 1) - source = re.sub(PTRN_REM_GIL_ARGS, "", source, 1) - source = re.sub(PTRN_REM_GIL_BIND, "", source, 1) - return source - - def __str__(self): - return "START: {}, ARGS {}:{}, BODY_START: {}, STOP: {}, CONTENT:\n {}".format( - self._start, self._args_start, self._args_end, self._body_start, self._end, self.source) - - def __repr__(self): - return 'Message({})'.format(self.name) - - -def message_is_class(match): - return ' class ' in match.group('header') - - -def get_messages(source, pattern, start_offset=0, is_class=False, sharing=False): - matches = list(re.finditer(pattern, source)) - messages = [] - shared = False - if ((len(matches) > 1 and pattern == PTRN_MESSAGE) or - (len(matches) > 2 and pattern == PTRN_SPECIALIZATION)) and sharing: - shared = True - for match in matches: - if message_is_class(match): - start = match.start() - end = find_end(match, source, is_class=True) - messages.extend(get_messages(source[start: end], PTRN_SPECIALIZATION, start_offset=start, - sharing=sharing)[0]) - else: - messages.append(ExportedMessage(match, source, start_offset=start_offset, is_class=is_class, shared=shared)) - return messages, shared - - -def add_import(source, shared=False): - match = list(re.finditer(PTRN_PACKAGE, source))[0] - end = match.end() - skip_gil_import = GIL_NODE_IMPORT in source or RUNTIME_PACKAGE in source - skip_cached_import = CACHED_IMPORT in source - skip_shared_import = SHARED_IMPORT in source - skip_excl_shared = EXCLUSIVE_IMPORT in source - gil_import = "" if skip_gil_import else "\n" + GIL_NODE_IMPORT - cached_import = "" if skip_cached_import else "\n" + CACHED_IMPORT - if shared: - shared_import = "" if skip_shared_import else "\n" + SHARED_IMPORT - else: - shared_import = "" if skip_excl_shared else "\n" + EXCLUSIVE_IMPORT - return source[:end] + gil_import + cached_import + shared_import + source[end:] - - -def file_names_filter(f_name, names): - names = names.split(",") - for n in names: - if n in f_name: - return True - return False - - -def fix_gilnode_arg(source): - def repl(match): - return match.group("start") + "\n" + match.group("arg") - return re.sub(PTRN_GILNODE_ARG, repl, source) - - -def get_lib_messages(lib, files): - if lib is None: - return None - lib_file = next(f for f in files if lib in f) - print("got lib source: {}".format(lib_file)) - with open(lib_file, 'r') as SRC: - src = SRC.read() - messages = set() - for m in re.finditer(PTRN_LIB_MSG, src): - messages.add(m.group('method')) - for m in re.finditer(PTRN_LIB_MSG_ABS, src): - messages.add(m.group('method')) - return messages - - -def main(sources, add=True, lib=None, dry_run=True, check_style=True, single_source=False, source_filter=None, - ignore_filter=None, count=False, sharing=False, fix_style=False): - files = glob.glob("{}**/*.java".format(sources), recursive=True) - lib_messages = get_lib_messages(lib, files) - if lib: - from pprint import pprint - print("[{}] messages: ".format(lib)) - pprint(lib_messages) - - if ignore_filter: - files = list(filter(lambda f: not file_names_filter(f, ignore_filter), files)) - if source_filter and not count: - files = list(filter(lambda f: file_names_filter(f, source_filter), files)) - - remove = not add - cnt = 0 - for java_file in files: - with open(java_file, 'r+') as SRC: - source = SRC.read() - if fix_style: - if "GilNode" in source: - print("[process] {}".format(java_file)) - source = fix_gilnode_arg(source) - SRC.seek(0) - SRC.write(source) - continue - else: - messages, shared = get_messages(source, PTRN_MESSAGE, sharing=sharing) - if len(messages) > 0: - if count: - cnt += 1 - continue - - print("[process] dry run: {}, add: {}. messages: {}, {}".format( - dry_run, add, len(messages), java_file)) - - def get_mod_source(msg): - return msg.source_with_gil if add else msg.source_without_gil - - if (add and 'GilNode gil' in source) or \ - (remove and 'GilNode gil' not in source) or \ - SKIP_GIL in source: - print("[skipping] {}".format(java_file)) - continue - - if remove and '@ExportLibrary({}.class)'.format(lib) not in source: - print("[skipping] {}".format(java_file)) - continue - - if lib: - messages = list(filter(lambda m: m.name in lib_messages and m.is_with_gil, messages)) - print("process messages: ", messages) - - if len(messages) == 0: - continue - - _src_parts = [] - m = messages[0] - if len(messages) == 1: - _src_parts = [source[:m.start], get_mod_source(m), source[m.end:]] - else: - _src_parts.append(source[:m.start]) - for m1, m2 in zip(messages[:-1], messages[1:]): - _src_parts.append(get_mod_source(m1)) - _src_parts.append(source[m1.end: m2.start]) - _src_parts.append(get_mod_source(m2)) - _src_parts.append(source[m2.end:]) - - modified_source = ''.join(_src_parts) - if add: - modified_source = add_import(modified_source, shared=shared) - - if dry_run: - print(modified_source) - return - else: - SRC.truncate(0) - SRC.seek(0) - if modified_source: - SRC.write(modified_source) - if single_source: - break - - if count: - print("TO PROCESS: {} files".format(cnt)) - if check_style and not count: - os.system("mx python-gate --tags style,python-license") - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument("--dry_run", help="do not write any changes, stop after the first file transform", - action="store_true") - parser.add_argument("--count", help="count how many files may need the GIL", action="store_true") - parser.add_argument("--remove", help="remove the GIL", action="store_true") - parser.add_argument("--lib", type=str, help="the internal library for which messages to remove the GIL") - parser.add_argument("--no_style", help="do not run the style checker", action="store_true") - parser.add_argument("--sharing", help="use @Shared", action="store_true") - parser.add_argument("--single", help="stop after modifying the first source", action="store_true") - parser.add_argument("--filter", type=str, help="filter for source name(s) (comma separated)") - parser.add_argument("--ignore", type=str, help="ignore filter for source name(s) (comma separated)") - parser.add_argument("--fix_style", help="fix GilNode related style issue", action="store_true") - parser.add_argument("sources", type=str, help="location of sources") - args = parser.parse_args() - - main(args.sources, add=not args.remove, lib=args.lib, dry_run=args.dry_run, check_style=not args.no_style, - single_source=args.single, source_filter=args.filter, ignore_filter=args.ignore, count=args.count, - sharing=args.sharing, fix_style=args.fix_style) diff --git a/scripts/hocon_json.sh b/scripts/hocon_json.sh deleted file mode 100755 index 3a0976f4d9..0000000000 --- a/scripts/hocon_json.sh +++ /dev/null @@ -1,54 +0,0 @@ -# Copyright (c) 2018, 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 [ -z $1 ]; then - CIFILE="ci" -else - CIFILE="$1" -fi - -if [ -z $2 ]; then - CIJSON=${CIFILE} -else - CIJSON="$2" -fi - -echo "${CIFILE}.hocon --> ${CIJSON}.json" -pyhocon -i ${CIFILE}.hocon -f json -o ${CIJSON}.json diff --git a/scripts/jsonnet_json.sh b/scripts/jsonnet_json.sh deleted file mode 100755 index dc786ea163..0000000000 --- a/scripts/jsonnet_json.sh +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright (c) 2018, 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 [ -z $1 ]; then - CIFILE="ci" -else - CIFILE="$1" -fi - -if [ -z $2 ]; then - CIJSON=${CIFILE} -else - CIJSON="$2" -fi - -echo "${CIFILE}.jsonnet --> ${CIJSON}.json" -jsonnet ${CIFILE}.jsonnet > ${CIJSON}.json - diff --git a/scripts/make_venv_native.sh b/scripts/make_venv_native.sh deleted file mode 100755 index 747e3d02ce..0000000000 --- a/scripts/make_venv_native.sh +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2019, 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 -mx --dy=/compiler python3 -m venv $1 diff --git a/scripts/moduleimports.py b/scripts/moduleimports.py deleted file mode 100755 index 4bd9ffe2f3..0000000000 --- a/scripts/moduleimports.py +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright (c) 2018, 2021, 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 python3 -import os, subprocess, sys - - -if len(sys.argv) == 2: - cmd = sys.argv[1] -else: - cmd = "mx python --python.WithJavaStacktrace=true " - - -okoutput = b"Please note: This Python implementation is in the very early stages, and can run little more than basic benchmarks at this point.\n" -success = [] -fail = [] - - -lib = os.listdir("%s/../graalpython/lib-python/3" % os.path.dirname(__file__)) -lib.sort() - -for i in lib: - if i.endswith(".py"): - f = os.path.basename(i).replace(".py", "") - elif os.path.isdir(i) and "__init__.py" in [os.path.basename(j) for j in os.listdir(i)]: - f = os.path.basename(i) - else: - continue - sys.stdout.write(f) - sys.stdout.flush() - proc = subprocess.run( - "%s -c 'import %s'" % (cmd, f), - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - shell=True - ) - if proc.stderr == okoutput: - sys.stdout.write(".\n") - success.append(f) - else: - sys.stdout.write("F\n") - fail.append((f, proc.stderr)) - - -print("Successes %d, Failures %d (~%f %%)", len(success), len(fail), len(success) / (len(success) + len(fail)) * 100) -for f,stderr in fail: - print(f) - print(stderr.decode("ascii")) diff --git a/scripts/pre_cythonize.sh b/scripts/pre_cythonize.sh deleted file mode 100755 index 4b7ea6e6b9..0000000000 --- a/scripts/pre_cythonize.sh +++ /dev/null @@ -1,68 +0,0 @@ -# Copyright (c) 2022, 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. - -#!/bin/bash - -targz_package="$1" - -if [ ! -e "$targz_package" ]; then - echo "Usage: $0 PATH-TO-TARGZ-PACKAGE (as downloaded from pypi)" - exit -fi - -if [[ -z "${VIRTUAL_ENV}" ]]; then - echo "Must run inside a virtualenv (preinstall the packages dependencies prior to running this script)" - exit -fi - -base=`basename ${targz_package}` -base_dir=${base%.*.*} - -echo "pre-cythonizing ${base_dir} ... " -tar -xvf ${targz_package} -cd ${base_dir} -python setup.py build_ext -rm -rf build -find -type d -name "__pycache__" -exec rm -rf {} + -find -type f -name "*.so" -delete -cd .. -zip -r ${base_dir}.zip ${base_dir} -#rm -rf ${base_dir} - -echo "created ${base_dir}.zip" diff --git a/scripts/python-inspect.sh b/scripts/python-inspect.sh deleted file mode 100755 index 5e0ca0ab40..0000000000 --- a/scripts/python-inspect.sh +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2017, 2018, 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 -mx --dynamicimports /tools python --inspect $1 diff --git a/scripts/python.sh b/scripts/python.sh deleted file mode 100755 index 0d0e3e3164..0000000000 --- a/scripts/python.sh +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (c) 2017, 2018, 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 -mx --dynamicimports /tools-enterprise python $1 diff --git a/scripts/venv_deploy.sh b/scripts/venv_deploy.sh deleted file mode 100755 index 644e15533a..0000000000 --- a/scripts/venv_deploy.sh +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) 2021, 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. - -#!/bin/sh -set -ex - -venv="$1" - -if [ ! -e "$venv" ]; then - echo "Usage: $0 PATH-TO-VENV" - exit -fi - -rm -rf "$venv"/bin -rm -rf "$venv"/lib/python*/site-packages/pip* -rm -rf "$venv"/lib/python*/site-packages/setuptools* -rm -rf "$venv"/lib/python*/site-packages/pkg_resources* -rm -rf "$venv"/lib/python*/site-packages/easy_install.py -find "$venv" -name "__pycache__" -exec rm -rf "{}" ";" -echo "include-system-site-packages = false\n" > "$venv"/pyvenv.cfg