21 buildPythonPackage rec {
24 # python setup.py --version
26 disabled = pythonOlder "3.6";
28 src = fetchFromGitHub {
29 owner = "amaranth-lang";
31 rev = "39a83f4d995d16364cc9b99da646ff8db6394166";
32 sha256 = "P9AG3t30eGeeCN5+t7mjhRoOWIGZVzWQji9eYXphjA0=";
37 name = "fix-for-setuptools-64.0.2-preparation.patch";
38 url = "https://github.com/amaranth-lang/amaranth/commit/64771a065a280fa683c1e6692383bec4f59f20fa.patch";
39 hash = "sha256-Rsh9vVvUQj9nIcrsRirmR6XwFrfZ2VMaYJ4RCQ8sBE0=";
40 # This commit removes support for Python 3.6, which is unnecessary to fix
41 # the build when using new setuptools. Include only one file, which has a
42 # harmless comment change so that the subsequent patch applies cleanly.
43 includes = ["amaranth/_toolchain/cxx.py"];
46 name = "fix-for-setuptools-64.0.2.patch";
47 url = "https://github.com/amaranth-lang/amaranth/pull/722/commits/e5a56b07c568e5f4cc2603eefebd14c5cc4e13d8.patch";
48 hash = "sha256-C8FyMSKHA7XsEMpO9eYNZx/X5rGaK7p3eXP+jSb6wVg=";
52 SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}";
59 propagatedBuildInputs = [
64 lib.optional (pythonOlder "3.9") importlib-resources ++
65 lib.optional (pythonOlder "3.8") importlib-metadata;
75 substituteInPlace setup.py \
76 --replace "Jinja2~=2.11" "Jinja2>=2.11" \
77 --replace "pyvcd~=0.2.2" "pyvcd"
79 # jinja2.contextfunction was removed in jinja2 v3.1
80 substituteInPlace amaranth/build/plat.py \
81 --replace "@jinja2.contextfunction" "@jinja2.pass_context"
84 pythonImportsCheck = [ "amaranth" ];
87 description = "A modern hardware definition language and toolchain based on Python";
88 homepage = "https://amaranth-lang.org/docs/amaranth";
89 license = licenses.bsd2;
90 maintainers = with maintainers; [ emily thoughtpolice ];