Fix mypy dependencies
This commit is contained in:
parent
5f14fab320
commit
cf19b5725f
5 changed files with 76 additions and 10 deletions
|
|
@ -10,3 +10,5 @@ The build uses Python 2 for legacy build scripts. Python 2, marked insecure in n
|
|||
|
||||
- `oils-for-unix-0.37.0.nix` - from-source Oils
|
||||
- `mypy-0.780.nix` - mypy 0.780 (last version to support --py2) built without mypyc
|
||||
- `mypy-extensions-0.4.4.nix` - mypy-extensions pinned to <0.5.0 for mypy 0.780 compatibility
|
||||
- `typed-ast-1.5.5.nix` - typed-ast for Python 2 AST parsing (removed from nixpkgs)
|
||||
|
|
|
|||
|
|
@ -2,17 +2,24 @@
|
|||
lib,
|
||||
fetchFromGitHub,
|
||||
python3,
|
||||
# Injected dependencies
|
||||
mypy-extensions,
|
||||
typed-ast,
|
||||
}:
|
||||
|
||||
python3.pkgs.buildPythonPackage rec {
|
||||
# mypy 0.780 is the last version with --py2 support
|
||||
# Built without mypyc so mycpp can extend its classes
|
||||
python3.pkgs.buildPythonPackage (finalAttrs: {
|
||||
pname = "mypy";
|
||||
# This is the version oils-for-unix uses for mycpp Python-to-C++ translation
|
||||
version = "0.780";
|
||||
|
||||
pyproject = true;
|
||||
build-system = [ python3.pkgs.setuptools ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python";
|
||||
repo = "mypy";
|
||||
rev = "v${version}";
|
||||
rev = "v${finalAttrs.version}";
|
||||
# Fetch submodules to include typeshed (required for type stubs)
|
||||
fetchSubmodules = true;
|
||||
hash = "sha256-czwCx6ZjCu3CrVmbI6NbstzWM0GvuPTWJiiUhXSznu4=";
|
||||
|
|
@ -27,14 +34,18 @@ python3.pkgs.buildPythonPackage rec {
|
|||
# Skip tests to speed up build
|
||||
doCheck = false;
|
||||
|
||||
dependencies = with python3.pkgs; [
|
||||
# Skip runtime dependency check since we're using pinned older versions
|
||||
pythonRuntimeDepsCheck = false;
|
||||
dontCheckRuntimeDeps = true;
|
||||
|
||||
dependencies = [
|
||||
mypy-extensions
|
||||
typing-extensions
|
||||
typed-ast
|
||||
python3.pkgs.typing-extensions
|
||||
];
|
||||
|
||||
# Ensure we're not pulling in a compiled version
|
||||
pythonImportsCheck = [ "mypy" ];
|
||||
|
||||
meta.license = lib.licenses.mit;
|
||||
}
|
||||
})
|
||||
|
|
|
|||
23
mypy-extensions-0.4.4.nix
Normal file
23
mypy-extensions-0.4.4.nix
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
python3,
|
||||
}:
|
||||
|
||||
# mypy 0.780 requires mypy-extensions <0.5.0
|
||||
python3.pkgs.buildPythonPackage (finalAttrs: {
|
||||
pname = "mypy-extensions";
|
||||
version = "0.4.4";
|
||||
pyproject = true;
|
||||
build-system = [ python3.pkgs.setuptools ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python";
|
||||
repo = "mypy_extensions";
|
||||
rev = finalAttrs.version;
|
||||
hash = "sha256-eZdEJJA6HOf1iQLV9H9qqETEByCgIH6oy+wwffGJVuQ=";
|
||||
};
|
||||
|
||||
pythonImportsCheck = [ "mypy_extensions" ];
|
||||
meta.license = lib.licenses.mit;
|
||||
})
|
||||
|
|
@ -14,13 +14,16 @@
|
|||
which,
|
||||
time,
|
||||
readline,
|
||||
# Python dependencies for mycpp
|
||||
mypy-extensions ? callPackage ./mypy-extensions-0.4.4.nix { python3 = python310; },
|
||||
typed-ast ? callPackage ./typed-ast-1.5.5.nix { python3 = python310; },
|
||||
mypy-for-mycpp ? callPackage ./mypy-0.780.nix {
|
||||
python3 = python310;
|
||||
inherit mypy-extensions typed-ast;
|
||||
},
|
||||
}:
|
||||
|
||||
let
|
||||
# mypy 0.780 is the last version with --py2 support
|
||||
# built without mypyc so mycpp can extend its classes
|
||||
mypy-for-mycpp = callPackage ./mypy-0.780.nix { python3 = python310; };
|
||||
|
||||
python = python310.withPackages (ps: [
|
||||
mypy-for-mycpp
|
||||
ps.typing-extensions
|
||||
|
|
|
|||
27
typed-ast-1.5.5.nix
Normal file
27
typed-ast-1.5.5.nix
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
lib,
|
||||
fetchFromGitHub,
|
||||
python3,
|
||||
}:
|
||||
|
||||
# typed-ast was removed from nixpkgs but is needed for mypy 0.780
|
||||
python3.pkgs.buildPythonPackage (finalAttrs: {
|
||||
pname = "typed-ast";
|
||||
version = "1.5.5";
|
||||
pyproject = true;
|
||||
build-system = [ python3.pkgs.setuptools ];
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "python";
|
||||
repo = "typed_ast";
|
||||
rev = finalAttrs.version;
|
||||
hash = "sha256-A/FA6ngu8/bbpKW9coJ7unm9GQezGuDhgBWjOhAxm2o=";
|
||||
};
|
||||
|
||||
# GCC 15 uses C23 by default where false/true/bool are keywords
|
||||
# Force C11 to build this legacy package
|
||||
env.NIX_CFLAGS_COMPILE = "-std=c11";
|
||||
|
||||
pythonImportsCheck = [ "typed_ast" ];
|
||||
meta.license = lib.licenses.asl20;
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue