diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08f6c3f..efb82a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,7 +40,6 @@ jobs: strategy: matrix: python-version: - - "3.6" - "3.7" - "3.8" - "3.9" @@ -51,9 +50,6 @@ jobs: - os: ubuntu-latest # older versions need older OS - - python-version: "3.6" - os: ubuntu-20.04 - - python-version: "3.7" os: ubuntu-22.04 @@ -192,7 +188,8 @@ jobs: matrix: os: - windows-latest - - macos-latest + - macos-13 # intel-based macos + - macos-latest # Apple silicon - ubuntu-latest include: # Only build CPython 3.x targets @@ -204,8 +201,8 @@ jobs: - name: Build wheels uses: pypa/cibuildwheel@v2.22.0 env: - # Only build CPython ABI3 targets - CIBW_BUILD: "cp3*-abi3-*" + # Only build CPython targets + CIBW_BUILD: "cp3*" # Ensure full C++17 availability on macOS builds MACOSX_DEPLOYMENT_TARGET: "10.13" # Signal setup.py to fail if binary build fails diff --git a/pyproject.toml b/pyproject.toml index 4980d28..5888568 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "systemrdl-compiler" dynamic = ["version"] -requires-python = ">=3.6" +requires-python = ">=3.7" dependencies = [ "antlr4-python3-runtime >= 4.11, < 4.14", "colorama", @@ -25,7 +25,6 @@ classifiers = [ "Development Status :: 5 - Production/Stable", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 281df88..0000000 --- a/setup.cfg +++ /dev/null @@ -1,8 +0,0 @@ -# This file is only required for Python3.6 build compatibility with pyproject.toml -[metadata] -name = systemrdl-compiler -version = attr: systemrdl.__about__.__version__ - -[options] -package_dir= - =src diff --git a/setup.py b/setup.py index d910924..4e6f3ce 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,7 @@ -import sys import os import platform -import fnmatch import setuptools +from glob import glob target = platform.system().lower() PLATFORMS = {'windows', 'linux', 'darwin', 'cygwin'} @@ -27,15 +26,15 @@ def run_setup(with_binary): include_dirs=["src/systemrdl/parser/ext/antlr4-cpp-runtime"], # Rather than listing each C++ file (Antlr has a lot!), discover them automatically - sources=get_files("src/systemrdl/parser/ext", "*.cpp"), - depends=get_files("src/systemrdl/parser/ext", "*.h"), + sources=glob("src/systemrdl/parser/ext/**/*.cpp", recursive=True), + depends=glob("src/systemrdl/parser/ext/**/*.h", recursive=True), extra_compile_args=extra_compile_args.get(target, []), - define_macros=[("Py_LIMITED_API", "0x03060000")], + define_macros=[("Py_LIMITED_API", "0x03070000")], py_limited_api=True, ) ext_modules = [parser_ext] - options = {"bdist_wheel": {"py_limited_api": "cp36"}} + options = {"bdist_wheel": {"py_limited_api": "cp37"}} else: ext_modules = [] options = {} @@ -50,27 +49,14 @@ def run_setup(with_binary): #=============================================================================== from setuptools.command.build_ext import build_ext -def get_files(path, pattern): - """ - Recursive file search that is compatible with python3.4 and older - """ - matches = [] - for root, _, filenames in os.walk(path): - for filename in fnmatch.filter(filenames, pattern): - matches.append(os.path.join(root, filename)) - return matches - - class BuildFailed(Exception): pass - class ve_build_ext(build_ext): """ This class extends setuptools to fail with a common BuildFailed exception if a build fails """ - def run(self): try: build_ext.run(self) @@ -83,29 +69,15 @@ def build_extension(self, ext): except Exception: raise BuildFailed() - -# Detect if an alternate interpreter is being used -is_jython = "java" in sys.platform -is_pypy = hasattr(sys, "pypy_version_info") - -# Antlr accelerator is no longer supported on older Python versions -is_old_python = sys.version_info[0:2] <= (3, 5) - -# Force using fallback python parser under some conditions -using_fallback = is_jython or is_pypy or is_old_python - -if 'SYSTEMRDL_SKIP_BINARY_BUILD' in os.environ: - using_fallback = True - -if not using_fallback: - try: - run_setup(with_binary=True) - except BuildFailed: - if 'SYSTEMRDL_REQUIRE_BINARY_BUILD' in os.environ: - # Force failure if binary build is required - raise - else: - using_fallback = True +using_fallback = False +try: + run_setup(with_binary=True) +except BuildFailed: + if 'SYSTEMRDL_REQUIRE_BINARY_BUILD' in os.environ: + # Force failure if binary build is required + raise + else: + using_fallback = True if using_fallback: run_setup(with_binary=False) diff --git a/test/test_parse_accelerator.py b/test/test_parse_accelerator.py index 29252de..07aed74 100644 --- a/test/test_parse_accelerator.py +++ b/test/test_parse_accelerator.py @@ -1,15 +1,10 @@ import os -import sys import unittest from systemrdl.parser import sa_systemrdl class TestInstalled(unittest.TestCase): def test_installed(self): - if sys.version_info[0:2] <= (3, 5): - # Don't care for older versions of Python. Accelerator is no longer supported - return - if 'SYSTEMRDL_DISABLE_ACCELERATOR' not in os.environ: # Ensure that C++ accelerator installed correctly self.assertTrue(sa_systemrdl.USE_CPP_IMPLEMENTATION)