drop py3.6. Misc housekeeping
This commit is contained in:
56
.github/workflows/build.yml
vendored
56
.github/workflows/build.yml
vendored
@@ -19,10 +19,9 @@ jobs:
|
||||
strategy:
|
||||
matrix:
|
||||
python-version:
|
||||
- 3.6
|
||||
- 3.7
|
||||
- 3.8
|
||||
- 3.9
|
||||
- "3.7"
|
||||
- "3.8"
|
||||
- "3.9"
|
||||
- "3.10"
|
||||
- "3.11"
|
||||
- "3.12"
|
||||
@@ -30,20 +29,17 @@ 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
|
||||
|
||||
- python-version: "3.8"
|
||||
os: ubuntu-22.04
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python 3.7 to bootstrap py3.6
|
||||
if: ${{ matrix.python-version == '3.6' }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
@@ -51,22 +47,11 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -U -r tests/requirements.txt
|
||||
|
||||
# Python 3.6 cannot install directly from a pyproject.toml
|
||||
# Instead, build a wheel from py3.7 and then install it
|
||||
- name: Install via wheel
|
||||
if: ${{ matrix.python-version == '3.6' }}
|
||||
run: |
|
||||
python3.7 -m pip install build
|
||||
python3.7 -m build
|
||||
python --version
|
||||
python -m pip install ./dist/*.whl
|
||||
python -m pip install -r tests/requirements.txt
|
||||
|
||||
- name: Install
|
||||
if: ${{ matrix.python-version != '3.6' }}
|
||||
run: |
|
||||
python -m pip install .
|
||||
python -m pip install ".[cli]"
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
@@ -95,7 +80,7 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
COVERALLS_PARALLEL: true
|
||||
run: |
|
||||
python -m pip install -U coveralls>=3.0.0
|
||||
python -m pip install coveralls>=3.0.0
|
||||
coveralls --service=github --finish
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
@@ -110,11 +95,11 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -U pylint
|
||||
python -m pip install -r tests/requirements.txt
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
python -m pip install .
|
||||
python -m pip install ".[cli]"
|
||||
|
||||
- name: Run Lint
|
||||
run: |
|
||||
@@ -132,7 +117,11 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install mypy types-setuptools
|
||||
python -m pip install -r tests/requirements.txt
|
||||
|
||||
- name: Install
|
||||
run: |
|
||||
python -m pip install ".[cli]"
|
||||
|
||||
- name: Type Check
|
||||
run: |
|
||||
@@ -156,13 +145,14 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install -U build
|
||||
python -m pip install build
|
||||
|
||||
- name: Build sdist
|
||||
run: python -m build
|
||||
|
||||
- uses: actions/upload-artifact@v3
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: dist
|
||||
path: |
|
||||
dist/*.tar.gz
|
||||
dist/*.whl
|
||||
@@ -180,9 +170,9 @@ jobs:
|
||||
# Only publish when a GitHub Release is created.
|
||||
if: github.event_name == 'release'
|
||||
steps:
|
||||
- uses: actions/download-artifact@v3
|
||||
- uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: artifact
|
||||
name: dist
|
||||
path: dist
|
||||
|
||||
- uses: pypa/gh-action-pypi-publish@release/v1
|
||||
|
||||
@@ -5,9 +5,9 @@ build-backend = "setuptools.build_meta"
|
||||
[project]
|
||||
name = "peakrdl-regblock"
|
||||
dynamic = ["version"]
|
||||
requires-python = ">=3.6"
|
||||
requires-python = ">=3.7"
|
||||
dependencies = [
|
||||
"systemrdl-compiler >= 1.27.0, < 2",
|
||||
"systemrdl-compiler >= 1.29.0, < 2",
|
||||
"Jinja2>=2.11",
|
||||
]
|
||||
|
||||
@@ -27,13 +27,6 @@ classifiers = [
|
||||
"Development Status :: 4 - Beta",
|
||||
"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",
|
||||
"Programming Language :: Python :: 3.10",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Programming Language :: Python :: 3 :: Only",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
|
||||
|
||||
@@ -1,38 +1,19 @@
|
||||
from typing import TYPE_CHECKING, Dict, Type, List, Any
|
||||
from typing import TYPE_CHECKING, Dict, Type
|
||||
import functools
|
||||
import sys
|
||||
|
||||
from peakrdl.plugins.exporter import ExporterSubcommandPlugin #pylint: disable=import-error
|
||||
from peakrdl.config import schema #pylint: disable=import-error
|
||||
from peakrdl.plugins.exporter import ExporterSubcommandPlugin
|
||||
from peakrdl.config import schema
|
||||
from peakrdl.plugins.entry_points import get_entry_points
|
||||
|
||||
from .exporter import RegblockExporter
|
||||
from .cpuif import CpuifBase, apb3, apb4, axi4lite, passthrough, avalon
|
||||
from .udps import ALL_UDPS
|
||||
from . import entry_points
|
||||
|
||||
if TYPE_CHECKING:
|
||||
import argparse
|
||||
from systemrdl.node import AddrmapNode
|
||||
|
||||
|
||||
class Choice(schema.String):
|
||||
"""
|
||||
Schema that matches against a specific set of allowed strings
|
||||
|
||||
Base PeakRDL does not have this schema yet. Polyfill here for now until it
|
||||
is added and widely available.
|
||||
"""
|
||||
def __init__(self, choices: List[str]) -> None:
|
||||
super().__init__()
|
||||
self.choices = choices
|
||||
|
||||
def extract(self, data: Any, path: str, err_ctx: str) -> Any:
|
||||
s = super().extract(data, path, err_ctx)
|
||||
if s not in self.choices:
|
||||
raise schema.SchemaException(f"{err_ctx}: Value '{s}' is not a valid choice. Must be one of: {','.join(self.choices)}")
|
||||
return s
|
||||
|
||||
|
||||
class Exporter(ExporterSubcommandPlugin):
|
||||
short_desc = "Generate a SystemVerilog control/status register (CSR) block"
|
||||
|
||||
@@ -40,7 +21,7 @@ class Exporter(ExporterSubcommandPlugin):
|
||||
|
||||
cfg_schema = {
|
||||
"cpuifs": {"*": schema.PythonObjectImport()},
|
||||
"default_reset": Choice(["rst", "rst_n", "arst", "arst_n"]),
|
||||
"default_reset": schema.Choice(["rst", "rst_n", "arst", "arst_n"]),
|
||||
}
|
||||
|
||||
@functools.lru_cache()
|
||||
@@ -60,7 +41,7 @@ class Exporter(ExporterSubcommandPlugin):
|
||||
}
|
||||
|
||||
# Load any cpuifs specified via entry points
|
||||
for ep, dist in entry_points.get_entry_points("peakrdl_regblock.cpuif"):
|
||||
for ep, dist in get_entry_points("peakrdl_regblock.cpuif"):
|
||||
name = ep.name
|
||||
cpuif = ep.load()
|
||||
if name in cpuifs:
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
import sys
|
||||
from typing import List, Tuple, TYPE_CHECKING, Optional
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from importlib.metadata import EntryPoint, Distribution
|
||||
|
||||
if sys.version_info >= (3,10,0):
|
||||
from importlib import metadata
|
||||
|
||||
def _get_entry_points(group_name: str) -> List[Tuple['EntryPoint', Optional['Distribution']]]:
|
||||
eps = []
|
||||
for ep in metadata.entry_points().select(group=group_name):
|
||||
eps.append((ep, ep.dist))
|
||||
return eps
|
||||
|
||||
def _get_name_from_dist(dist: 'Distribution') -> str:
|
||||
return dist.name
|
||||
|
||||
elif sys.version_info >= (3,8,0): # pragma: no cover
|
||||
from importlib import metadata
|
||||
|
||||
def _get_entry_points(group_name: str) -> List[Tuple['EntryPoint', Optional['Distribution']]]:
|
||||
eps = [] # type: List[Tuple[EntryPoint, Optional[Distribution]]]
|
||||
dist_names = set()
|
||||
for dist in metadata.distributions():
|
||||
# Due to a bug in importlib.metadata's distributions iterator, in
|
||||
# some cases editable installs will cause duplicate dist entries.
|
||||
# Filter this out.
|
||||
dist_name = get_name_from_dist(dist)
|
||||
if dist_name in dist_names:
|
||||
continue
|
||||
dist_names.add(dist_name)
|
||||
|
||||
for ep in dist.entry_points:
|
||||
if ep.group == group_name:
|
||||
eps.append((ep, dist))
|
||||
return eps
|
||||
|
||||
def _get_name_from_dist(dist: 'Distribution') -> str:
|
||||
return dist.metadata["Name"]
|
||||
|
||||
else: # pragma: no cover
|
||||
import pkg_resources
|
||||
|
||||
def _get_entry_points(group_name: str) -> List[Tuple['EntryPoint', Optional['Distribution']]]:
|
||||
eps = []
|
||||
for ep in pkg_resources.iter_entry_points(group_name):
|
||||
eps.append((ep, ep.dist))
|
||||
return eps # type: ignore
|
||||
|
||||
def _get_name_from_dist(dist: 'Distribution') -> str:
|
||||
return dist.project_name # type: ignore
|
||||
|
||||
|
||||
def get_entry_points(group_name: str) -> List[Tuple['EntryPoint', Optional['Distribution']]]:
|
||||
return _get_entry_points(group_name)
|
||||
|
||||
def get_name_from_dist(dist: 'Distribution') -> str:
|
||||
return _get_name_from_dist(dist)
|
||||
@@ -1,6 +1,6 @@
|
||||
[mypy]
|
||||
ignore_missing_imports = True
|
||||
strict_optional = False
|
||||
#ignore_missing_imports = True
|
||||
#strict_optional = False
|
||||
disallow_incomplete_defs = True
|
||||
disallow_untyped_defs = True
|
||||
warn_unused_configs = True
|
||||
|
||||
@@ -12,16 +12,15 @@ source .venv/bin/activate
|
||||
# Install test dependencies
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Run static type checking prior to installing to avoid sloppy type hints of
|
||||
# systemrdl package
|
||||
mypy ../src/peakrdl_regblock
|
||||
|
||||
# Install dut
|
||||
pip install -U ..
|
||||
pip install -e "../[cli]"
|
||||
|
||||
# Run lint
|
||||
pylint --rcfile pylint.rc ../src/peakrdl_regblock
|
||||
|
||||
# Run static type checking
|
||||
mypy ../src/peakrdl_regblock
|
||||
|
||||
# Run unit tests
|
||||
pytest --workers auto --cov=peakrdl_regblock --synth-tool skip
|
||||
|
||||
|
||||
Reference in New Issue
Block a user