Remove all remaining code references to nmigen and the namespace.

Closes #741.
This commit is contained in:
Catherine 2023-01-31 13:49:13 +00:00
parent 29502442fb
commit f133646e9b
68 changed files with 11 additions and 456 deletions

View file

@ -89,12 +89,7 @@ def extend(cls):
def get_linter_options(filename):
first_line = linecache.getline(filename, 1)
if first_line:
match = re.match(r"^#\s*nmigen:\s*((?:\w+=\w+\s*)(?:,\s*\w+=\w+\s*)*)\n$", first_line)
if match:
warnings.warn_explicit("Use `# amaranth:` annotation instead of `# nmigen:`",
DeprecationWarning, filename, 1)
else:
match = re.match(r"^#\s*amaranth:\s*((?:\w+=\w+\s*)(?:,\s*\w+=\w+\s*)*)\n$", first_line)
match = re.match(r"^#\s*amaranth:\s*((?:\w+=\w+\s*)(?:,\s*\w+=\w+\s*)*)\n$", first_line)
if match:
return dict(map(lambda s: s.strip().split("=", 2), match.group(1).split(",")))
return dict()

View file

@ -68,20 +68,14 @@ class Platform(ResourceManager, metaclass=ABCMeta):
if filename.endswith(suffixes):
yield filename
@property
def _deprecated_toolchain_env_vars(self):
return (
f"NMIGEN_ENV_{self.toolchain}",
f"AMARANTH_ENV_{self.toolchain}",
)
@property
def _toolchain_env_var(self):
return f"AMARANTH_ENV_{tool_env_var(self.toolchain)}"
# TODO(amaranth-0.5): remove
@property
def _all_toolchain_env_vars(self):
return self._deprecated_toolchain_env_vars + (self._toolchain_env_var,)
return (f"AMARANTH_ENV_{self.toolchain}", self._toolchain_env_var,)
def build(self, elaboratable, name="top",
build_dir="build", do_build=True,
@ -327,17 +321,14 @@ class TemplatedPlatform(Platform):
# expected_type parameter is used to assert the type of kwargs, passing `None` will disable
# type checking.
def _extract_override(var, *, expected_type):
deprecated_var_env = "NMIGEN_{}".format(var)
var_env = "AMARANTH_{}".format(var)
if deprecated_var_env in os.environ or var_env in os.environ:
if var_env in os.environ:
# On Windows, there is no way to define an "empty but set" variable; it is tempting
# to use a quoted empty string, but it doesn't do what one would expect. Recognize
# this as a useful pattern anyway, and treat `set VAR=""` on Windows the same way
# `export VAR=` is treated on Linux.
if var_env in os.environ:
var_env_value = os.environ[var_env]
elif deprecated_var_env in os.environ:
var_env_value = os.environ[deprecated_var_env]
return re.sub(r'^\"\"$', "", var_env_value)
elif var in kwargs:
if not isinstance(kwargs[var], expected_type) and not expected_type is None:

View file

@ -9,15 +9,19 @@ Next version
Support for Python 3.6 has been dropped, and support for Python 3.11 has been added.
Features deprecated in version 0.3 have been removed.
Features deprecated in version 0.3 have been removed. In particular, the ``nmigen.*`` namespace is not provided, ``# nmigen:`` annotations are not recognized, and ``NMIGEN_*`` envronment variables are not used.
Migrating from version 0.3
--------------------------
Apply the following changes to code written against Amaranth 0.2 to migrate it to version 0.3:
* Update shell environment to use ``AMARANTH_*`` environment variables instead of ``NMIGEN_*`` environment variables.
* Update shell environment to use ``AMARANTH_ENV_<TOOLCHAIN>`` (with all-uppercase ``<TOOLCHAIN>``name) environment variable names instead of ``AMARANTH_ENV_<Toolchain>`` or ``NMIGEN_ENV_<Toolchain>`` (with mixed-case ``<Toolchain>`` name).
While code that uses the features listed as deprecated below will work in Amaranth 0.3, they will be removed in the next version.
Language changes
----------------
@ -89,6 +93,7 @@ Language changes
* Added: :class:`ValueCastable`.
* Deprecated: :class:`ast.UserValue`; use :class:`ValueCastable` instead.
* Added: Division and modulo operators can be used with a negative divisor.
* Deprecated: ``# nmigen:`` linter instructions at the beginning of file; use ``# amaranth:`` instead.
Standard library changes
@ -121,6 +126,7 @@ Toolchain changes
* Deprecated: :class:`test.utils.FHDLTestCase`, with no replacement.
* Deprecated: :func:`back.rtlil.convert()` and :func:`back.verilog.convert()` without an explicit `ports=` argument.
* Changed: VCD output now uses a top-level "bench" module that contains testbench only signals.
* Deprecated: ``NMIGEN_*`` environment variables; use ``AMARANTH_*`` environment variables instead.
Platform integration changes

View file

@ -1,7 +0,0 @@
from amaranth import *
from amaranth import __all__
import warnings
warnings.warn("instead of nmigen, use amaranth",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.asserts import *
import warnings
warnings.warn("instead of nmigen.asserts, use amaranth.asserts",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.back import *
import warnings
warnings.warn("instead of nmigen.back, use amaranth.back",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.back.cxxrtl import *
from amaranth.back.cxxrtl import __all__
import warnings
warnings.warn("instead of nmigen.back.cxxrtl, use amaranth.back.cxxrtl",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.back.pysim import *
from amaranth.back.pysim import __all__
import warnings
warnings.warn("instead of nmigen.back.pysim, use amaranth.back.pysim",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.back.rtlil import *
from amaranth.back.rtlil import __all__
import warnings
warnings.warn("instead of nmigen.back.rtlil, use amaranth.back.rtlil",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.back.verilog import *
from amaranth.back.verilog import __all__
import warnings
warnings.warn("instead of nmigen.back.verilog, use amaranth.back.verilog",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.build import *
import warnings
warnings.warn("instead of nmigen.build, use amaranth.build",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.build.dsl import *
from amaranth.build.dsl import __all__
import warnings
warnings.warn("instead of nmigen.build.dsl, use amaranth.build.dsl",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.build.plat import *
from amaranth.build.plat import __all__
import warnings
warnings.warn("instead of nmigen.build.plat, use amaranth.build.plat",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.build.res import *
from amaranth.build.res import __all__
import warnings
warnings.warn("instead of nmigen.build.res, use amaranth.build.res",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.build.run import *
from amaranth.build.run import __all__
import warnings
warnings.warn("instead of nmigen.build.run, use amaranth.build.run",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.cli import main, main_parser, main_runner
from amaranth.cli import __all__
import warnings
warnings.warn("instead of nmigen.cli, use amaranth.cli",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.compat import *
import warnings
warnings.warn("instead of nmigen.compat, use amaranth.compat",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.compat.fhdl import *
import warnings
warnings.warn("instead of nmigen.compat.fhdl, use amaranth.compat.fhdl",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.fhdl.bitcontainer import *
from amaranth.compat.fhdl.bitcontainer import __all__
import warnings
warnings.warn("instead of nmigen.compat.fhdl.bitcontainer, use amaranth.compat.fhdl.bitcontainer",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.compat.fhdl.conv_output import *
import warnings
warnings.warn("instead of nmigen.compat.fhdl.conv_output, use amaranth.compat.fhdl.conv_output",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.fhdl.decorators import *
from amaranth.compat.fhdl.decorators import __all__
import warnings
warnings.warn("instead of nmigen.compat.fhdl.decorators, use amaranth.compat.fhdl.decorators",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.fhdl.module import *
from amaranth.compat.fhdl.module import __all__
import warnings
warnings.warn("instead of nmigen.compat.fhdl.module, use amaranth.compat.fhdl.module",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.fhdl.specials import *
from amaranth.compat.fhdl.specials import __all__
import warnings
warnings.warn("instead of nmigen.compat.fhdl.specials, use amaranth.compat.fhdl.specials",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.fhdl.structure import *
from amaranth.compat.fhdl.structure import __all__
import warnings
warnings.warn("instead of nmigen.compat.fhdl.structure, use amaranth.compat.fhdl.structure",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.compat.fhdl.verilog import *
import warnings
warnings.warn("instead of nmigen.compat.fhdl.verilog, use amaranth.compat.fhdl.verilog",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.compat.genlib import *
import warnings
warnings.warn("instead of nmigen.compat.genlib, use amaranth.compat.genlib",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.genlib.cdc import *
from amaranth.compat.genlib.cdc import __all__
import warnings
warnings.warn("instead of nmigen.compat.genlib.cdc, use amaranth.compat.genlib.cdc",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.genlib.coding import *
from amaranth.compat.genlib.coding import __all__
import warnings
warnings.warn("instead of nmigen.compat.genlib.coding, use amaranth.compat.genlib.coding",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.genlib.fifo import *
from amaranth.compat.genlib.fifo import __all__
import warnings
warnings.warn("instead of nmigen.compat.genlib.fifo, use amaranth.compat.genlib.fifo",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.genlib.fsm import *
from amaranth.compat.genlib.fsm import __all__
import warnings
warnings.warn("instead of nmigen.compat.genlib.fsm, use amaranth.compat.genlib.fsm",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.compat.genlib.record import *
import warnings
warnings.warn("instead of nmigen.compat.genlib.record, use amaranth.compat.genlib.record",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.genlib.resetsync import *
from amaranth.compat.genlib.resetsync import __all__
import warnings
warnings.warn("instead of nmigen.compat.genlib.resetsync, use amaranth.compat.genlib.resetsync",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.genlib.roundrobin import *
from amaranth.compat.genlib.roundrobin import __all__
import warnings
warnings.warn("instead of nmigen.compat.genlib.roundrobin, use amaranth.compat.genlib.roundrobin",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.compat.sim import *
from amaranth.compat.sim import __all__
import warnings
warnings.warn("instead of nmigen.compat.sim, use amaranth.compat.sim",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl import *
from amaranth.hdl import __all__
import warnings
warnings.warn("instead of nmigen.hdl, use amaranth.hdl",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl.ast import *
from amaranth.hdl.ast import __all__
import warnings
warnings.warn("instead of nmigen.hdl.ast, use amaranth.hdl.ast",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl.cd import *
from amaranth.hdl.cd import __all__
import warnings
warnings.warn("instead of nmigen.hdl.cd, use amaranth.hdl.cd",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl.dsl import *
from amaranth.hdl.dsl import __all__
import warnings
warnings.warn("instead of nmigen.hdl.dsl, use amaranth.hdl.dsl",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl.ir import *
from amaranth.hdl.ir import __all__
import warnings
warnings.warn("instead of nmigen.hdl.ir, use amaranth.hdl.ir",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl.mem import *
from amaranth.hdl.mem import __all__
import warnings
warnings.warn("instead of nmigen.hdl.mem, use amaranth.hdl.mem",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl.rec import *
from amaranth.hdl.rec import __all__
import warnings
warnings.warn("instead of nmigen.hdl.rec, use amaranth.hdl.rec",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.hdl.xfrm import *
from amaranth.hdl.xfrm import __all__
import warnings
warnings.warn("instead of nmigen.hdl.xfrm, use amaranth.hdl.xfrm",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.lib import *
import warnings
warnings.warn("instead of nmigen.lib, use amaranth.lib",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.lib.cdc import *
from amaranth.lib.cdc import __all__
import warnings
warnings.warn("instead of nmigen.lib.cdc, use amaranth.lib.cdc",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.lib.coding import *
from amaranth.lib.coding import __all__
import warnings
warnings.warn("instead of nmigen.lib.coding, use amaranth.lib.coding",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.lib.fifo import *
from amaranth.lib.fifo import __all__
import warnings
warnings.warn("instead of nmigen.lib.fifo, use amaranth.lib.fifo",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.lib.io import *
from amaranth.lib.io import __all__
import warnings
warnings.warn("instead of nmigen.lib.io, use amaranth.lib.io",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.lib.scheduler import *
from amaranth.lib.scheduler import __all__
import warnings
warnings.warn("instead of nmigen.lib.scheduler, use amaranth.lib.scheduler",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.rpc import *
from amaranth.rpc import __all__
import warnings
warnings.warn("instead of nmigen.rpc, use amaranth.rpc",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.sim import *
from amaranth.sim import __all__
import warnings
warnings.warn("instead of nmigen.sim, use amaranth.sim",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.sim.core import *
from amaranth.sim.core import __all__
import warnings
warnings.warn("instead of nmigen.sim.core, use amaranth.sim.core",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.sim.pysim import *
from amaranth.sim.pysim import __all__
import warnings
warnings.warn("instead of nmigen.sim.pysim, use amaranth.sim.pysim",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.test import *
import warnings
warnings.warn("instead of nmigen.test, use amaranth.test",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.test.utils import *
from amaranth.test.utils import __all__
import warnings
warnings.warn("instead of nmigen.test.utils, use amaranth.test.utils",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.tracer import *
from amaranth.tracer import __all__
import warnings
warnings.warn("instead of nmigen.tracer, use amaranth.tracer",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.utils import *
from amaranth.utils import __all__
import warnings
warnings.warn("instead of nmigen.utils, use amaranth.utils",
DeprecationWarning, stacklevel=2)

View file

@ -1,6 +0,0 @@
from amaranth.vendor import *
import warnings
warnings.warn("instead of nmigen.vendor, use amaranth.vendor",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.intel import *
from amaranth.vendor.intel import __all__
import warnings
warnings.warn("instead of nmigen.vendor.intel, use amaranth.vendor.intel",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.lattice_ecp5 import *
from amaranth.vendor.lattice_ecp5 import __all__
import warnings
warnings.warn("instead of nmigen.vendor.lattice_ecp5, use amaranth.vendor.lattice_ecp5",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.lattice_ice40 import *
from amaranth.vendor.lattice_ice40 import __all__
import warnings
warnings.warn("instead of nmigen.vendor.lattice_ice40, use amaranth.vendor.lattice_ice40",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.lattice_machxo2 import *
from amaranth.vendor.lattice_machxo2 import __all__
import warnings
warnings.warn("instead of nmigen.vendor.lattice_machxo2, use amaranth.vendor.lattice_machxo2",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.lattice_machxo_2_3l import *
from amaranth.vendor.lattice_machxo_2_3l import __all__
import warnings
warnings.warn("instead of nmigen.vendor.lattice_machxo_2_3l, use amaranth.vendor.lattice_machxo_2_3l",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.quicklogic import *
from amaranth.vendor.quicklogic import __all__
import warnings
warnings.warn("instead of nmigen.vendor.quicklogic, use amaranth.vendor.quicklogic",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.xilinx import *
from amaranth.vendor.xilinx import __all__
import warnings
warnings.warn("instead of nmigen.vendor.xilinx, use amaranth.vendor.xilinx",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.xilinx_7series import *
from amaranth.vendor.xilinx_7series import __all__
import warnings
warnings.warn("instead of nmigen.vendor.xilinx_7series, use amaranth.vendor.xilinx_7series",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.xilinx_spartan_3_6 import *
from amaranth.vendor.xilinx_spartan_3_6 import __all__
import warnings
warnings.warn("instead of nmigen.vendor.xilinx_spartan_3_6, use amaranth.vendor.xilinx_spartan_3_6",
DeprecationWarning, stacklevel=2)

View file

@ -1,7 +0,0 @@
from amaranth.vendor.xilinx_ultrascale import *
from amaranth.vendor.xilinx_ultrascale import __all__
import warnings
warnings.warn("instead of nmigen.vendor.xilinx_ultrascale, use amaranth.vendor.xilinx_ultrascale",
DeprecationWarning, stacklevel=2)

View file

@ -54,7 +54,6 @@ setup(
entry_points={
"console_scripts": [
"amaranth-rpc = amaranth.rpc:main",
"nmigen-rpc = nmigen.rpc:main",
]
},
project_urls={