From 43d10b6690b80eb1aa900398513191b7e5fbafdd Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sat, 8 Oct 2022 10:47:05 +0200 Subject: python310Packages.cairo-lang: use pythonRelaxDepsHook --- .../python-modules/cairo-lang/default.nix | 69 ++++++++++++++-------- 1 file changed, 43 insertions(+), 26 deletions(-) diff --git a/pkgs/development/python-modules/cairo-lang/default.nix b/pkgs/development/python-modules/cairo-lang/default.nix index 00a9361c27f8b..ec11772fb50f8 100644 --- a/pkgs/development/python-modules/cairo-lang/default.nix +++ b/pkgs/development/python-modules/cairo-lang/default.nix @@ -1,35 +1,40 @@ { lib -, fetchzip +, aiohttp , buildPythonPackage -, setuptools +, cachetools , ecdsa +, eth-hash , fastecdsa -, sympy +, fetchzip , frozendict +, gmp +, lark , marshmallow -, marshmallow-enum , marshmallow-dataclass +, marshmallow-enum , marshmallow-oneofschema -, pipdeptree -, eth-hash -, web3 -, aiohttp -, cachetools , mpmath , numpy +, pipdeptree , prometheus-client -, typeguard -, lark -, pyyaml -, pytest-asyncio , pytest +, pytest-asyncio , pytestCheckHook -, gmp +, pythonOlder +, pythonRelaxDepsHook +, pyyaml +, setuptools +, sympy +, typeguard +, web3 }: buildPythonPackage rec { pname = "cairo-lang"; version = "0.10.0"; + format = "setuptools"; + + disabled = pythonOlder "3.7"; src = fetchzip { url = "https://github.com/starkware-libs/cairo-lang/releases/download/v${version}/cairo-lang-${version}.zip"; @@ -37,13 +42,9 @@ buildPythonPackage rec { }; # TODO: remove a substantial part when https://github.com/starkware-libs/cairo-lang/pull/88/files is merged. - # TODO: pytest and pytest-asyncio must be removed as they are check inputs in fact. postPatch = '' substituteInPlace requirements.txt \ - --replace 'frozendict==1.2' 'frozendict>=1.2' \ - --replace 'lark-parser' 'lark' \ - --replace 'pytest-asyncio' ''' \ - --replace "pytest" ''' + --replace "lark-parser" "lark" substituteInPlace starkware/cairo/lang/compiler/parser_transformer.py \ --replace 'value, meta' 'meta, value' \ @@ -52,7 +53,13 @@ buildPythonPackage rec { --replace 'standard' 'basic' ''; - buildInputs = [ gmp ]; + nativeBuildInputs = [ + pythonRelaxDepsHook + ]; + + buildInputs = [ + gmp + ]; propagatedBuildInputs = [ aiohttp @@ -74,23 +81,33 @@ buildPythonPackage rec { lark web3 eth-hash - eth-hash.optional-dependencies.pycryptodome pyyaml - ]; + ] ++ eth-hash.optional-dependencies.pycryptodome; checkInputs = [ + pytest-asyncio pytestCheckHook ]; + pythonRelaxDeps = [ + "frozendict" + ]; + + pythonRemoveDeps = [ + # TODO: pytest and pytest-asyncio must be removed as they are check inputs + "pytest" + "pytest-asyncio" + ]; + # There seems to be no test included in the ZIP releaseā€¦ # Cloning from GitHub is harder because they use a custom CMake setup # TODO(raitobezarius): upstream was pinged out of band about it. doCheck = false; - meta = { - homepage = "https://github.com/starkware/cairo-lang"; + meta = with lib; { description = "Tooling for Cairo language"; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ raitobezarius ]; + homepage = "https://github.com/starkware/cairo-lang"; + license = licenses.mit; + maintainers = with maintainers; [ raitobezarius ]; }; } -- cgit 1.4.1