2022-09-09 14:08:57 +00:00
|
|
|
{ lib
|
2022-10-21 18:38:19 +00:00
|
|
|
, aiohttp
|
2022-09-09 14:08:57 +00:00
|
|
|
, buildPythonPackage
|
2022-10-21 18:38:19 +00:00
|
|
|
, cachetools
|
2022-09-09 14:08:57 +00:00
|
|
|
, ecdsa
|
2022-10-21 18:38:19 +00:00
|
|
|
, eth-hash
|
2022-09-09 14:08:57 +00:00
|
|
|
, fastecdsa
|
2022-10-21 18:38:19 +00:00
|
|
|
, fetchzip
|
2022-09-09 14:08:57 +00:00
|
|
|
, frozendict
|
2022-10-21 18:38:19 +00:00
|
|
|
, gmp
|
|
|
|
, lark
|
2022-09-09 14:08:57 +00:00
|
|
|
, marshmallow
|
|
|
|
, marshmallow-dataclass
|
2022-10-21 18:38:19 +00:00
|
|
|
, marshmallow-enum
|
2022-09-09 14:08:57 +00:00
|
|
|
, marshmallow-oneofschema
|
|
|
|
, mpmath
|
|
|
|
, numpy
|
2022-10-21 18:38:19 +00:00
|
|
|
, pipdeptree
|
2022-09-09 14:08:57 +00:00
|
|
|
, prometheus-client
|
|
|
|
, pytest
|
2022-10-21 18:38:19 +00:00
|
|
|
, pytest-asyncio
|
2022-09-09 14:08:57 +00:00
|
|
|
, pytestCheckHook
|
2022-10-21 18:38:19 +00:00
|
|
|
, pythonOlder
|
|
|
|
, pythonRelaxDepsHook
|
|
|
|
, pyyaml
|
|
|
|
, setuptools
|
|
|
|
, sympy
|
|
|
|
, typeguard
|
|
|
|
, web3
|
2022-09-09 14:08:57 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cairo-lang";
|
|
|
|
version = "0.10.0";
|
2022-10-21 18:38:19 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/starkware-libs/cairo-lang/releases/download/v${version}/cairo-lang-${version}.zip";
|
|
|
|
sha256 = "sha256-+PE7RSKEGADbue63FoT6UBOwURJs7lBNkL7aNlpSxP8=";
|
|
|
|
};
|
|
|
|
|
|
|
|
# TODO: remove a substantial part when https://github.com/starkware-libs/cairo-lang/pull/88/files is merged.
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
2022-10-21 18:38:19 +00:00
|
|
|
--replace "lark-parser" "lark"
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
substituteInPlace starkware/cairo/lang/compiler/parser_transformer.py \
|
|
|
|
--replace 'value, meta' 'meta, value' \
|
|
|
|
--replace 'value: Tuple[CommaSeparatedWithNotes], meta' 'meta, value: Tuple[CommaSeparatedWithNotes]'
|
|
|
|
substituteInPlace starkware/cairo/lang/compiler/parser.py \
|
|
|
|
--replace 'standard' 'basic'
|
|
|
|
'';
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pythonRelaxDepsHook
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
gmp
|
|
|
|
];
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
aiohttp
|
|
|
|
cachetools
|
|
|
|
setuptools
|
|
|
|
ecdsa
|
|
|
|
fastecdsa
|
|
|
|
sympy
|
|
|
|
mpmath
|
|
|
|
numpy
|
|
|
|
typeguard
|
|
|
|
frozendict
|
|
|
|
prometheus-client
|
|
|
|
marshmallow
|
|
|
|
marshmallow-enum
|
|
|
|
marshmallow-dataclass
|
|
|
|
marshmallow-oneofschema
|
|
|
|
pipdeptree
|
|
|
|
lark
|
|
|
|
web3
|
|
|
|
eth-hash
|
|
|
|
pyyaml
|
2022-10-21 18:38:19 +00:00
|
|
|
] ++ eth-hash.optional-dependencies.pycryptodome;
|
2022-09-09 14:08:57 +00:00
|
|
|
|
|
|
|
checkInputs = [
|
2022-10-21 18:38:19 +00:00
|
|
|
pytest-asyncio
|
2022-09-09 14:08:57 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"frozendict"
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonRemoveDeps = [
|
|
|
|
# TODO: pytest and pytest-asyncio must be removed as they are check inputs
|
|
|
|
"pytest"
|
|
|
|
"pytest-asyncio"
|
|
|
|
];
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
# 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;
|
|
|
|
|
2022-10-21 18:38:19 +00:00
|
|
|
meta = with lib; {
|
2022-09-09 14:08:57 +00:00
|
|
|
description = "Tooling for Cairo language";
|
2022-10-21 18:38:19 +00:00
|
|
|
homepage = "https://github.com/starkware/cairo-lang";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ raitobezarius ];
|
2022-09-09 14:08:57 +00:00
|
|
|
};
|
|
|
|
}
|