2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, fetchFromGitHub
|
|
|
|
, setuptools
|
2021-05-20 23:08:51 +00:00
|
|
|
, setuptools-scm
|
2020-04-24 23:36:52 +00:00
|
|
|
, pyvcd
|
|
|
|
, jinja2
|
2021-02-13 14:23:35 +00:00
|
|
|
, importlib-resources
|
|
|
|
, importlib-metadata
|
2021-05-20 23:08:51 +00:00
|
|
|
, git
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# for tests
|
2020-09-25 04:45:31 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, symbiyosys
|
|
|
|
, yices
|
2021-07-14 22:03:04 +00:00
|
|
|
, yosys
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2022-01-13 20:06:32 +00:00
|
|
|
pname = "amaranth";
|
|
|
|
version = "0.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
# python setup.py --version
|
2022-01-13 20:06:32 +00:00
|
|
|
realVersion = "0.3";
|
2020-09-25 04:45:31 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-01-13 20:06:32 +00:00
|
|
|
owner = "amaranth-lang";
|
|
|
|
repo = "amaranth";
|
|
|
|
rev = "39a83f4d995d16364cc9b99da646ff8db6394166";
|
|
|
|
sha256 = "P9AG3t30eGeeCN5+t7mjhRoOWIGZVzWQji9eYXphjA0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}";
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
git
|
|
|
|
setuptools-scm
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-13 14:23:35 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
jinja2
|
2021-07-14 22:03:04 +00:00
|
|
|
pyvcd
|
|
|
|
setuptools
|
2021-02-13 14:23:35 +00:00
|
|
|
] ++
|
|
|
|
lib.optional (pythonOlder "3.9") importlib-resources ++
|
|
|
|
lib.optional (pythonOlder "3.8") importlib-metadata;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
symbiyosys
|
|
|
|
yices
|
|
|
|
yosys
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
2021-12-06 16:07:01 +00:00
|
|
|
--replace "Jinja2~=2.11" "Jinja2>=2.11" \
|
|
|
|
--replace "pyvcd~=0.2.2" "pyvcd"
|
2022-06-16 17:23:12 +00:00
|
|
|
|
|
|
|
# jinja2.contextfunction was removed in jinja2 v3.1
|
|
|
|
substituteInPlace amaranth/build/plat.py \
|
|
|
|
--replace "@jinja2.contextfunction" "@jinja2.pass_context"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
pythonImportsCheck = [ "amaranth" ];
|
2021-07-14 22:03:04 +00:00
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
2022-01-13 20:06:32 +00:00
|
|
|
description = "A modern hardware definition language and toolchain based on Python";
|
|
|
|
homepage = "https://amaranth-lang.org/docs/amaranth";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd2;
|
2022-01-13 20:06:32 +00:00
|
|
|
maintainers = with maintainers; [ emily thoughtpolice ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|