Skip to content

Commit

Permalink
Drop support for Python 3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
amykyta3 committed Dec 12, 2024
1 parent 5d3ad4e commit ba258b1
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 64 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
strategy:
matrix:
python-version:
- "3.6"
- "3.7"
- "3.8"
- "3.9"
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
8 changes: 0 additions & 8 deletions setup.cfg

This file was deleted.

56 changes: 14 additions & 42 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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'}
Expand All @@ -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 = {}
Expand All @@ -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)
Expand All @@ -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)
5 changes: 0 additions & 5 deletions test/test_parse_accelerator.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit ba258b1

Please sign in to comment.