From 5db93d9008c75b738e7948f62541ca9aef160470 Mon Sep 17 00:00:00 2001 From: mcbarton Date: Thu, 23 Jan 2025 19:26:21 +0000 Subject: [PATCH] Add support for Ubuntu 22.04 arm --- .github/workflows/Ubuntu.yml | 25 +++++++++++---------- installer/cppyy_monkey_patch.py | 39 --------------------------------- pyproject.toml | 2 -- setup.py | 3 --- test/support.py | 8 +++++++ test/test_api.py | 4 +++- test/test_concurrent.py | 3 ++- test/test_cpp11features.py | 3 ++- test/test_crossinheritance.py | 15 +++++++++++-- test/test_doc_features.py | 5 ++++- 10 files changed, 45 insertions(+), 62 deletions(-) delete mode 100644 installer/cppyy_monkey_patch.py diff --git a/.github/workflows/Ubuntu.yml b/.github/workflows/Ubuntu.yml index ff7d02e3..d1f81a48 100644 --- a/.github/workflows/Ubuntu.yml +++ b/.github/workflows/Ubuntu.yml @@ -284,31 +284,31 @@ jobs: cling: On cling-version: '1.0' cppyy: On - - name: ubu22-arm-gcc12-clang-repl-19 + - name: ubu22-arm-gcc12-clang-repl-19-cppyy os: ubuntu-22.04-arm compiler: gcc-12 clang-runtime: '19' cling: Off - cppyy: Off - - name: ubu22-arm-gcc12-clang-repl-18 + cppyy: On + - name: ubu22-arm-gcc12-clang-repl-18-cppyy os: ubuntu-22.04-arm compiler: gcc-12 clang-runtime: '18' cling: Off - cppyy: Off - - name: ubu22-arm-gcc12-clang-repl-17 + cppyy: On + - name: ubu22-arm-gcc12-clang-repl-17-cppyy os: ubuntu-22.04-arm compiler: gcc-12 clang-runtime: '17' cling: Off - cppyy: Off - - name: ubu22-arm-gcc9-clang13-cling + cppyy: On + - name: ubu22-arm-gcc9-clang13-cling-cppyy os: ubuntu-22.04-arm compiler: gcc-9 clang-runtime: '13' cling: On cling-version: '1.0' - cppyy: Off + cppyy: On steps: - uses: actions/checkout@v4 @@ -534,7 +534,8 @@ jobs: # source virtual environment source ${{ github.workspace }}/CppInterOp/.venv/bin/activate cd ${{ github.workspace }} - python -m pip install --upgrade . --no-deps + python -m pip install uv + python -m uv pip install --upgrade . --no-deps --verbose cd .. - name: Run cppyy @@ -556,9 +557,9 @@ jobs: echo ::group::Prepare For Testing make all python -m pip install --upgrade pip - python -m pip install pytest - python -m pip install pytest-xdist - python -m pip install numba + python -m uv pip install pytest + python -m uv pip install pytest-xdist + python -m uv pip install numba echo ::endgroup:: echo ::group::Run complete test suite set -o pipefail diff --git a/installer/cppyy_monkey_patch.py b/installer/cppyy_monkey_patch.py deleted file mode 100644 index aa57c5a3..00000000 --- a/installer/cppyy_monkey_patch.py +++ /dev/null @@ -1,39 +0,0 @@ -# monkey patch to be able to select a specific backend based on PyPy's version, -# which is not possible in the pyproject.toml file as there is currently no -# marker for it (this may change, after which this file can be removed) - -try: - # _BACKEND is the primary, __legacy__ the backwards compatible backend - from setuptools.build_meta import _BACKEND - main = _BACKEND -except (NameError, ImportError): - # fallback as the name __legacy__ is actually documented (and part of __all__) - main = __legacy__ - -# the following ensures proper build/installation order, after which the normal -# install through setup.py picks up their wheels from the cache (TODO: note the -# duplication here with setup.py; find a better way) -_get_requires_for_build_wheel = main.get_requires_for_build_wheel -def get_requires_for_build_wheel(*args, **kwds): - try: - import __pypy__, sys - version = sys.pypy_version_info - requirements = ['cppyy-cling==6.28.0'] - if version[0] == 5: - if version[1] <= 9: - requirements = ['cppyy-cling<6.12'] - elif version[1] <= 10: - requirements = ['cppyy-cling<=6.15'] - elif version[0] == 6: - if version[1] <= 0: - requirements = ['cppyy-cling<=6.15'] - elif version[0] == 7: - if version[1] <= 3 and version[2] <= 3: - requirements = ['cppyy-cling<=6.18.2.3'] - except ImportError: - # CPython - requirements = ['cppyy-backend==1.14.11', 'cppyy-cling==6.28.0'] - - return requirements + _get_requires_for_build_wheel(*args, **kwds) - -main.get_requires_for_build_wheel = get_requires_for_build_wheel diff --git a/pyproject.toml b/pyproject.toml index 91c1695f..d1e6ae6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,2 @@ [build-system] requires = ["setuptools", "wheel"] -backend-path = ["installer"] -build-backend = "cppyy_monkey_patch:main" diff --git a/setup.py b/setup.py index 5b0dd484..28f856b7 100755 --- a/setup.py +++ b/setup.py @@ -139,9 +139,6 @@ def get_outputs(self): keywords='C++ bindings data science calling language integration', - include_package_data=True, - package_data={'': ['installer/cppyy_monkey_patch.py']}, - package_dir={'': 'python'}, packages=find_packages('python', include=add_pkg), diff --git a/test/support.py b/test/support.py index dddd8073..4c3c8fc7 100644 --- a/test/support.py +++ b/test/support.py @@ -45,8 +45,16 @@ def setup_make(targetname): IS_MAC = IS_MAC_ARM or IS_MAC_X86 IS_LINUX = 0 +IS_LINUX_ARM = 0 +IS_LINUX_X86 = 0 if 'linux' in sys.platform: IS_LINUX = 1 + import platform + if 'aarch64' in platform.machine(): + IS_LINUX_ARM = 64 + os.environ["CPPYY_UNCAUGHT_QUIET"] = "1" + else: + IS_LINUX_X86 = 1 try: import __pypy__ diff --git a/test/test_api.py b/test/test_api.py index 71f492d2..24509945 100644 --- a/test/test_api.py +++ b/test/test_api.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import ispypy, IS_MAC +from .support import ispypy, IS_MAC, IS_LINUX_ARM class TestAPI: @@ -64,6 +64,7 @@ class APICheck2 { m2 = API.Instance_FromVoidPtr(voidp, 'APICheck2') assert m is m2 + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test04_custom_converter(self): """Custom type converter""" @@ -142,6 +143,7 @@ class APICheck3Converter : public CPyCppyy::Converter { assert type(gA3b) == cppyy.gbl.APICheck3 assert not gA3b.wasFromMemoryCalled() + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test05_custom_executor(self): """Custom type executor""" diff --git a/test/test_concurrent.py b/test/test_concurrent.py index a903ebc5..5d74d0cd 100644 --- a/test/test_concurrent.py +++ b/test/test_concurrent.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import IS_MAC_ARM, IS_MAC_X86 +from .support import IS_MAC_ARM, IS_MAC_X86, IS_LINUX_ARM class TestCONCURRENT: @@ -166,6 +166,7 @@ def process(self, c): assert "RuntimeError" in w.err_msg assert "all wrong" in w.err_msg + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test05_float2d_callback(self): """Passing of 2-dim float arguments""" diff --git a/test/test_cpp11features.py b/test/test_cpp11features.py index b32bff9c..f1089eac 100644 --- a/test/test_cpp11features.py +++ b/test/test_cpp11features.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, mark -from .support import setup_make, ispypy, IS_CLANG_REPL +from .support import setup_make, ispypy, IS_CLANG_REPL, IS_LINUX_ARM currpath = py.path.local(__file__).dirpath() @@ -15,6 +15,7 @@ def setup_class(cls): import cppyy cls.cpp11features = cppyy.load_reflection_info(cls.test_dct) + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test01_smart_ptr(self): """Usage and access of std::shared/unique_ptr<>""" diff --git a/test/test_crossinheritance.py b/test/test_crossinheritance.py index 0f5c2477..0fc245f4 100644 --- a/test/test_crossinheritance.py +++ b/test/test_crossinheritance.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, pylong, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLANG_DEBUG +from .support import setup_make, pylong, IS_MAC_ARM, IS_MAC, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_LINUX_ARM currpath = py.path.local(__file__).dirpath() @@ -36,6 +36,7 @@ def get_value(self): assert Base1.call_get_value(Base1()) == 42 assert Base1.call_get_value(Derived()) == 13 + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test02_constructor(self): """Test constructor usage for derived classes""" @@ -72,6 +73,7 @@ def get_value(self): assert d.get_value() == 29 assert Base1.call_get_value(d) == 29 + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test03_override_function_abstract_base(self): """Test ability to override a simple function with an abstract base""" @@ -164,6 +166,7 @@ def pass_value5(self, b): d2 = Derived2() assert Base1.sum_pass_value(d2) == 12+4*d2.m_int + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test05_override_overloads(self): """Test ability to override overloaded functions""" @@ -184,6 +187,7 @@ def sum_all(self, *args): assert d.sum_all(-7, -5) == 1 assert Base1.call_sum_all(d, -7, -5) == 1 + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test06_const_methods(self): """Declared const methods should keep that qualifier""" @@ -206,6 +210,7 @@ def __init__(self): assert CX.IBase4.call_get_value(c1) == 17 assert CX.IBase4.call_get_value(c2) == 27 + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Fails with ModuleNotFound error") def test07_templated_base(self): """Derive from a base class that is instantiated from a template""" @@ -505,7 +510,8 @@ def __init__(self): assert m.my_data == 42 assert m.get_data() == 42 assert m.get_data_v() == 42 - + + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test15_object_returns(self): """Return of C++ objects from overridden functions""" @@ -740,6 +746,7 @@ class Derived(ns.Base): def abstract1(self): return ns.Result(1) + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test20_basic_multiple_inheritance(self): """Basic multiple inheritance""" @@ -818,6 +825,7 @@ def z(self): assert a.m_2 == 42 assert a.m_3 == 67 + @mark.xfail(run=not IS_CLANG_DEBUG, reason="Crashes with ClangRepl with 'toString not implemented'") def test21_multiple_inheritance_with_constructors(self): """Multiple inheritance with constructors""" @@ -905,6 +913,7 @@ def z(self): assert a.m_2 == 88 assert a.m_3 == -11 + @mark.xfail(run=not IS_CLANG_DEBUG, reason="Crashes with ClangRepl with 'toString not implemented'") def test22_multiple_inheritance_with_defaults(self): """Multiple inheritance with defaults""" @@ -1276,6 +1285,7 @@ class D(B): assert inst.fun1() == val1 assert inst.fun2() == inst.fun1() + @mark.xfail(run=not IS_CLANG_DEBUG, reason="Crashes with ClangRepl with 'toString not implemented'") def test29_cross_deep_multi(self): """Deep multi-inheritance hierarchy""" @@ -1517,6 +1527,7 @@ def getValue(self): gc.collect() assert ns.Component.get_count() == 0 + @mark.xfail(run=not IS_CLANG_DEBUG, reason="Crashes with ClangRepl with 'toString not implemented'") def test32_by_value_arguments(self): """Override base function taking by-value arguments""" diff --git a/test/test_doc_features.py b/test/test_doc_features.py index e779c3ea..b350829e 100644 --- a/test/test_doc_features.py +++ b/test/test_doc_features.py @@ -1,6 +1,6 @@ import py, os, sys from pytest import raises, skip, mark -from .support import setup_make, ispypy, IS_WINDOWS, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_MAC, IS_MAC_X86, IS_MAC_ARM +from .support import setup_make, ispypy, IS_WINDOWS, IS_CLANG_REPL, IS_CLANG_DEBUG, IS_MAC, IS_MAC_X86, IS_MAC_ARM, IS_LINUX_ARM currpath = py.path.local(__file__).dirpath() test_dct = str(currpath.join("doc_helperDict")) @@ -1106,6 +1106,7 @@ def test_template_instantiation(self): assert len(v) == 10 assert [m.fData for m in v] == list(range(10)) + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test_cross_inheritance(self): """Cross-inheritance example""" @@ -1145,6 +1146,7 @@ def add(self, i): assert v.back().add(17) == 4+42+2*17 + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test_fallbacks(self): """Template instantation switches based on value sizes""" @@ -1163,6 +1165,7 @@ def test_fallbacks(self): assert CC.passT(2**64-1) == 2**64-1 assert 'unsigned long long' in CC.passT.__doc__ + @mark.xfail(run=False, condition=IS_LINUX_ARM, reason="Crashes pytest on Linux ARM") def test_callbacks(self): """Function callback example"""