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: