Merge pull request #187319 from RaitoBezarius/cairo-lang

This commit is contained in:
Sandro 2022-08-24 21:12:21 +02:00 committed by GitHub
commit f5f58f2cef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 185 additions and 0 deletions

View file

@ -0,0 +1,96 @@
{ lib
, fetchzip
, buildPythonPackage
, setuptools
, ecdsa
, fastecdsa
, sympy
, frozendict
, marshmallow
, marshmallow-enum
, marshmallow-dataclass
, marshmallow-oneofschema
, pipdeptree
, eth-hash
, web3
, aiohttp
, cachetools
, mpmath
, numpy
, prometheus-client
, typeguard
, lark
, pyyaml
, pytest-asyncio
, pytest
, pytestCheckHook
, gmp
}:
buildPythonPackage rec {
pname = "cairo-lang";
version = "0.9.1";
src = fetchzip {
url = "https://github.com/starkware-libs/cairo-lang/releases/download/v${version}/cairo-lang-${version}.zip";
sha256 = "sha256-i4030QLG6PssfKD5FO4VrZxap19obMZ3Aa77p5MXlNY=";
};
# 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" '''
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'
'';
buildInputs = [ gmp ];
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
eth-hash.optional-dependencies.pycryptodome
pyyaml
];
checkInputs = [
pytestCheckHook
];
# 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";
description = "Tooling for Cairo language";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ raitobezarius ];
};
}

View file

@ -80,6 +80,8 @@ buildPythonPackage rec {
runHook postCheck
'';
doCheck = false;
pythonImportsCheck = [ "ipfshttpclient" ];
meta = with lib; {

View file

@ -0,0 +1,83 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, aiohttp
, eth-abi
, eth-account
, eth-hash
, eth-typing
, eth-utils
, eth-rlp
, hexbytes
, ipfshttpclient
, jsonschema
, lru-dict
, protobuf
, requests
, typing-extensions
, websockets
# , eth-tester
# , py-geth
, pytestCheckHook
, pythonOlder
}:
buildPythonPackage rec {
pname = "web3";
version = "5.30.0";
disabled = pythonOlder "3.6";
src = fetchFromGitHub {
owner = "ethereum";
repo = "web3.py";
rev = "v${version}";
sha256 = "sha256-HajumvOG18r7TslkmCfI0iiLsEddevGrRZQFWICGeYE=";
};
postPatch = ''
substituteInPlace setup.py \
--replace "eth-account>=0.5.7,<0.6.0" "eth-account>=0.5.7,<0.7" \
--replace "eth-utils>=1.9.5,<2.0.0" "eth-utils>=1.9.5,<3" \
--replace "eth-rlp<0.3" "eth-rlp<0.4" \
--replace "websockets>=9.1,<10" "websockets>=9.1,<11" \
--replace "eth-abi>=2.0.0b6,<3.0.0" "eth-abi>=2.0.0b6,<4" \
--replace "eth-typing>=2.0.0,<3.0.0" "eth-typing>=2.0.0,<4"
'';
propagatedBuildInputs = [
aiohttp
eth-abi
eth-account
eth-hash
eth-hash.optional-dependencies.pycryptodome
eth-rlp
eth-typing
eth-utils
hexbytes
ipfshttpclient
jsonschema
lru-dict
protobuf
requests
websockets
] ++ lib.optional (pythonOlder "3.8") [ typing-extensions ];
# TODO: package eth-tester
#checkInputs = [
# eth-tester
# eth-tester.optional-dependencies.py-evm
# py-geth
# pytestCheckHook
#];
doCheck = false;
pythonImportsCheck = [ "web3" ];
meta = with lib; {
description = "Web3 library for interactions";
homepage = "https://github.com/ethereum/web3";
license = licenses.mit;
maintainers = with maintainers; [ raitobezarius ];
};
}

View file

@ -1587,6 +1587,8 @@ in {
inherit (self) python numpy boost;
});
cairo-lang = callPackage ../development/python-modules/cairo-lang { };
cairocffi = callPackage ../development/python-modules/cairocffi { };
cairosvg = callPackage ../development/python-modules/cairosvg { };
@ -11525,6 +11527,8 @@ in {
weasyprint = callPackage ../development/python-modules/weasyprint { };
web3 = callPackage ../development/python-modules/web3 { };
webargs = callPackage ../development/python-modules/webargs { };
webassets = callPackage ../development/python-modules/webassets { };