diff --git a/pkgs/development/python-modules/amaranth/default.nix b/pkgs/development/python-modules/amaranth/default.nix index 1a096f01606f..0bf6d2515ef2 100644 --- a/pkgs/development/python-modules/amaranth/default.nix +++ b/pkgs/development/python-modules/amaranth/default.nix @@ -4,6 +4,7 @@ pythonOlder, fetchFromGitHub, pdm-backend, + jschon, pyvcd, jinja2, importlib-resources, @@ -20,14 +21,14 @@ buildPythonPackage rec { pname = "amaranth"; format = "pyproject"; - version = "0.4.5"; + version = "0.5.0"; disabled = pythonOlder "3.8"; src = fetchFromGitHub { owner = "amaranth-lang"; repo = "amaranth"; rev = "refs/tags/v${version}"; - hash = "sha256-g9dn6gUTdFHz9GMWHERsRLWHoI3E7vjuQDK0usbZO7g="; + hash = "sha256-+EV2NgYSuCbYTQKeBUN+/D0attfrJ3cso7U6RjLEIbg="; }; nativeBuildInputs = [ @@ -37,6 +38,7 @@ buildPythonPackage rec { dependencies = [ + jschon jinja2 pyvcd ] diff --git a/pkgs/development/python-modules/fx2/default.nix b/pkgs/development/python-modules/fx2/default.nix index 52711cead2d0..29809ebdfa5f 100644 --- a/pkgs/development/python-modules/fx2/default.nix +++ b/pkgs/development/python-modules/fx2/default.nix @@ -5,6 +5,7 @@ fetchFromGitHub, sdcc, libusb1, + setuptools-scm, crcmod, }: @@ -20,7 +21,10 @@ buildPythonPackage rec { hash = "sha256-PtWxjT+97+EeNMN36zOT1+ost/w3lRRkaON3Cl3dpp4="; }; - nativeBuildInputs = [ sdcc ]; + nativeBuildInputs = [ + setuptools-scm + sdcc + ]; propagatedBuildInputs = [ libusb1 diff --git a/pkgs/development/python-modules/jschon/default.nix b/pkgs/development/python-modules/jschon/default.nix new file mode 100644 index 000000000000..8a1686095fbf --- /dev/null +++ b/pkgs/development/python-modules/jschon/default.nix @@ -0,0 +1,75 @@ +{ lib +, buildPythonPackage +, fetchFromGitHub +, setuptools +, wheel +, rfc3986 +, pytestCheckHook +, hypothesis +, requests +, pytest-httpserver +, pytest-xdist +}: + +buildPythonPackage rec { + pname = "jschon"; + version = "0.11.1"; + pyproject = true; + + src = fetchFromGitHub { + owner = "marksparkza"; + repo = "jschon"; + rev = "v${version}"; + hash = "sha256-uOvEIEUEILsoLuV5U9AJCQAlT4iHQhsnSt65gfCiW0k="; + fetchSubmodules = true; + }; + + build-system = [ + setuptools + wheel + ]; + + dependencies = [ + rfc3986 + ]; + + pythonImportsCheck = [ + "jschon" + "jschon.catalog" + "jschon.vocabulary" + "jschon.exc" + "jschon.exceptions" + "jschon.formats" + "jschon.json" + "jschon.jsonpatch" + "jschon.jsonpointer" + "jschon.jsonschema" + "jschon.output" + "jschon.uri" + "jschon.utils" + ]; + + nativeCheckInputs = [ + pytestCheckHook + hypothesis + requests + pytest-httpserver + #pytest-benchmark # not needed for distribution + pytest-xdist # not used upstream, but massive speedup + ]; + + disabledTestPaths = [ + "tests/test_benchmarks.py" + ]; + + # used in checks + __darwinAllowLocalNetworking = true; + + meta = with lib; { + description = "An object-oriented JSON Schema implementation for Python"; + homepage = "https://github.com/marksparkza/jschon"; + changelog = "https://github.com/marksparkza/jschon/blob/${src.rev}/CHANGELOG.rst"; + license = licenses.mit; + maintainers = with maintainers; [ pbsds ]; + }; +} diff --git a/pkgs/tools/misc/glasgow/default.nix b/pkgs/tools/misc/glasgow/default.nix index 4821ad923ef8..373a1d38889e 100644 --- a/pkgs/tools/misc/glasgow/default.nix +++ b/pkgs/tools/misc/glasgow/default.nix @@ -5,40 +5,49 @@ , yosys , icestorm , nextpnr +, unstableGitUpdater }: python3.pkgs.buildPythonApplication rec { pname = "glasgow"; - version = "unstable-2023-09-20"; - # python -m setuptools_scm - realVersion = "0.1.dev1798+g${lib.substring 0 7 src.rev}"; + version = "0-unstable-2024-06-27"; + # from `pdm show` + realVersion = let + tag = builtins.elemAt (lib.splitString "-" version) 0; + rev = lib.substring 0 7 src.rev; + in "${tag}.1.dev2085+g${rev}"; + + pyproject = true; src = fetchFromGitHub { owner = "GlasgowEmbedded"; repo = "glasgow"; - rev = "e9a9801d5be3dcba0ee188dd8a6e9115e337795d"; - sha256 = "sha256-ztB3I/jrDSm1gKB1e5igivUVloq+YYhkshDlWg75NMA="; + rev = "a599e3caa64c2e445358894fd050e16917f2ee42"; + sha256 = "sha256-5qg0/j1MgwHMOjySBY5cKuQqlqltV5cXcR/Ap6J9vys="; }; nativeBuildInputs = [ - python3.pkgs.setuptools-scm + python3.pkgs.pdm-backend sdcc ]; propagatedBuildInputs = with python3.pkgs; [ - aiohttp + typing-extensions amaranth - appdirs - bitarray - crc + packaging + platformdirs fx2 libusb1 - packaging pyvcd - setuptools + aiohttp ]; - nativeCheckInputs = [ yosys icestorm nextpnr ]; + nativeCheckInputs = [ + python3.pkgs.unittestCheckHook + yosys + icestorm + nextpnr + ]; enableParallelBuilding = true; @@ -46,7 +55,7 @@ python3.pkgs.buildPythonApplication rec { make -C firmware LIBFX2=${python3.pkgs.fx2}/share/libfx2 cp firmware/glasgow.ihex software/glasgow cd software - export SETUPTOOLS_SCM_PRETEND_VERSION="${realVersion}" + export PDM_BUILD_SCM_VERSION="${realVersion}" ''; # installCheck tries to build_ext again @@ -54,16 +63,16 @@ python3.pkgs.buildPythonApplication rec { postInstall = '' mkdir -p $out/etc/udev/rules.d - cp $src/config/99-glasgow.rules $out/etc/udev/rules.d + cp $src/config/*.rules $out/etc/udev/rules.d ''; - checkPhase = '' + preCheck = '' + export PYTHONWARNINGS="ignore::DeprecationWarning" # tests attempt to cache bitstreams # for linux: export XDG_CACHE_HOME=$TMPDIR # for darwin: export HOME=$TMPDIR - ${python3.interpreter} -W ignore::DeprecationWarning test.py ''; makeWrapperArgs = [ @@ -72,6 +81,10 @@ python3.pkgs.buildPythonApplication rec { "--set" "NEXTPNR_ICE40" "${nextpnr}/bin/nextpnr-ice40" ]; + passthru.updateScript = unstableGitUpdater { + hardcodeZeroVersion = true; + }; + meta = with lib; { description = "Software for Glasgow, a digital interface multitool"; homepage = "https://github.com/GlasgowEmbedded/Glasgow"; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 38bbca5f4992..91535cf14e94 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6210,6 +6210,8 @@ self: super: with self; { jschema-to-python = callPackage ../development/python-modules/jschema-to-python { }; + jschon = callPackage ../development/python-modules/jschon { }; + jsmin = callPackage ../development/python-modules/jsmin { }; json5 = callPackage ../development/python-modules/json5 { };