Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for Python 3.8+ #45

Merged
merged 2 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions amaranth_soc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Extract version for this package from the environment package metadata. This used to be a lot
# more difficult in earlier Python versions, and the `__version__` field is a legacy of that time.
import importlib.metadata
try:
try:
from importlib import metadata as importlib_metadata # py3.8+ stdlib
except ImportError:
import importlib_metadata # py3.7- shim
__version__ = importlib_metadata.version(__package__)
except ImportError:
# No importlib_metadata. This shouldn't normally happen, but some people prefer not installing
# packages via pip at all, instead using PYTHONPATH directly or copying the package files into
# `lib/pythonX.Y/site-packages`. Although not a recommended way, we still try to support it.
__version__ = importlib.metadata.version(__package__)
except importlib.metadata.PackageNotFoundError:
# No importlib metadata for this package. This shouldn't normally happen, but some people
# prefer not installing packages via pip at all. Although not recommended we still support it.
__version__ = "unknown" # :nocov:
del importlib
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ description = "System on Chip toolkit for Amaranth HDL"
authors = [{name = "Amaranth HDL contributors"}]
license = {file = "LICENSE.txt"}

requires-python = "~=3.8"
dependencies = [
"importlib_metadata; python_version<'3.8'",
# this version requirement needs to be synchronized with the one in .github/workflows/main.yml
"amaranth>=0.3,<0.5",
]
Expand Down