about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFabian Affolter <mail@fabian-affolter.ch>2022-10-08 10:47:05 +0200
committerFabian Affolter <mail@fabian-affolter.ch>2022-10-08 10:47:05 +0200
commit43d10b6690b80eb1aa900398513191b7e5fbafdd (patch)
treeadca5bd87352765005dd70c0ed4b36ad669decfe
parent6c2364b16041edc71dc64a38b4318ed28229a55f (diff)
python310Packages.cairo-lang: use pythonRelaxDepsHook
-rw-r--r--pkgs/development/python-modules/cairo-lang/default.nix69
1 files 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 ];
   };
 }