3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #195316 from adisbladis/poetry2nix-1_34_0

poetry2nix: 1.33.0 -> 1.34.1
This commit is contained in:
adisbladis 2022-10-10 19:58:02 +13:00 committed by GitHub
commit 39490a5f24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 247 additions and 63 deletions

View file

@ -5,7 +5,7 @@
}:
let
# Poetry2nix version
version = "1.33.0";
version = "1.34.1";
inherit (poetryLib) isCompatible readTOML normalizePackageName normalizePackageSet;
@ -27,6 +27,7 @@ let
, attrs
, includeBuildSystem ? true
, groups ? [ ]
, checkGroups ? [ "dev" ]
}:
let
getInputs = attr: attrs.${attr} or [ ];
@ -73,7 +74,8 @@ let
nativeBuildInputs = mkInput "nativeBuildInputs" [ ];
checkInputs = mkInput "checkInputs" (
getDeps (pyProject.tool.poetry."dev-dependencies" or { }) # <poetry-1.2.0
++ getDeps (pyProject.tool.poetry.group."dev".dependencies or { }) # >=poetry-1.2.0
# >=poetry-1.2.0 dependency groups
++ lib.flatten (map (g: getDeps (pyProject.tool.poetry.group.${g}.dependencies or { })) checkGroups)
);
};
@ -131,6 +133,7 @@ lib.makeScope pkgs.newScope (self: {
, editablePackageSources ? { }
, pyProject ? readTOML pyproject
, groups ? [ ]
, checkGroups ? [ "dev" ]
}:
let
/* The default list of poetry2nix override overlays */
@ -182,36 +185,31 @@ lib.makeScope pkgs.newScope (self: {
builtins.map
(
pkgMeta:
if builtins.elem pkgMeta.name nixpkgsBuildSystems then {
name = pkgMeta.name;
value = super."${pkgMeta.name}";
} else rec {
name = normalizePackageName pkgMeta.name;
let normalizedName = normalizePackageName pkgMeta.name; in
{
name = normalizedName;
value = self.mkPoetryDep (
pkgMeta // {
inherit pwd preferWheels;
source = pkgMeta.source or null;
files = lockFiles.${name};
files = lockFiles.${normalizedName};
pythonPackages = self;
sourceSpec =
let
normalizedName = normalizePackageName pkgMeta.name;
in
(
(normalizePackageSet pyProject.tool.poetry.dependencies or { }).${normalizedName}
or (normalizePackageSet pyProject.tool.poetry.dev-dependencies or { }).${normalizedName}
or (normalizePackageSet pyProject.tool.poetry.group.dev.dependencies { }).${normalizedName} # Poetry 1.2.0+
or { }
);
sourceSpec = (
(normalizePackageSet pyProject.tool.poetry.dependencies or { }).${normalizedName}
or (normalizePackageSet pyProject.tool.poetry.dev-dependencies or { }).${normalizedName}
or (normalizePackageSet pyProject.tool.poetry.group.dev.dependencies { }).${normalizedName} # Poetry 1.2.0+
or { }
);
}
);
}
)
(lib.reverseList compatible)
);
buildSystems = builtins.listToAttrs (builtins.map (x: { name = x; value = super.${x}; }) nixpkgsBuildSystems);
in
lockPkgs // {
lockPkgs // buildSystems // {
# Create a dummy null package for the current project in case any dependencies depend on the root project (issue #307)
${pyProject.tool.poetry.name} = null;
};
@ -262,7 +260,7 @@ lib.makeScope pkgs.newScope (self: {
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) overlays;
py = python.override { inherit packageOverrides; self = py; };
inputAttrs = mkInputAttrs { inherit py pyProject groups; attrs = { }; includeBuildSystem = false; };
inputAttrs = mkInputAttrs { inherit py pyProject groups checkGroups; attrs = { }; includeBuildSystem = false; };
requiredPythonModules = python.pkgs.requiredPythonModules;
/* Include all the nested dependencies which are required for each package.
@ -364,11 +362,12 @@ lib.makeScope pkgs.newScope (self: {
, pwd ? projectDir
, preferWheels ? false
, groups ? [ ]
, checkGroups ? [ "dev" ]
, ...
}@attrs:
let
poetryPython = self.mkPoetryPackages {
inherit pyproject poetrylock overrides python pwd preferWheels groups;
inherit pyproject poetrylock overrides python pwd preferWheels groups checkGroups;
};
py = poetryPython.python;
@ -383,7 +382,7 @@ lib.makeScope pkgs.newScope (self: {
];
passedAttrs = builtins.removeAttrs attrs specialAttrs;
inputAttrs = mkInputAttrs { inherit py pyProject attrs groups; };
inputAttrs = mkInputAttrs { inherit py pyProject attrs groups checkGroups; };
app = py.pkgs.buildPythonPackage (
passedAttrs // inputAttrs // {

View file

@ -7,6 +7,7 @@
"flitBuildHook",
"cython",
"hatchling",
"hatch-vcs",
"setuptools",
"setuptools-scm"
]

View file

@ -790,6 +790,7 @@
"setuptools"
],
"apipkg": [
"hatch-vcs",
"hatchling",
"setuptools"
],
@ -1918,8 +1919,12 @@
],
"black": [
{
"buildSystem": "hatch-fancy-pypi-readme",
"from": "22.10.0"
"buildSystem": "setuptools",
"until": "22.10.0"
},
{
"buildSystem": "setuptools-scm",
"until": "22.10.0"
},
{
"buildSystem": "hatchling",
@ -1929,12 +1934,17 @@
"buildSystem": "hatch-vcs",
"from": "22.10.0"
},
"setuptools",
"setuptools-scm"
{
"buildSystem": "hatch-fancy-pypi-readme",
"from": "22.10.0"
}
],
"black-macchiato": [
"setuptools"
],
"blacken-docs": [
"setuptools"
],
"bleach": [
"setuptools"
],
@ -3367,7 +3377,8 @@
"setuptools"
],
"dbus-fast": [
"poetry-core"
"poetry-core",
"setuptools"
],
"dbus-next": [
"setuptools"
@ -3977,6 +3988,10 @@
"setuptools-scm"
],
"docformatter": [
{
"buildSystem": "poetry-core",
"from": "1.5.0"
},
"setuptools"
],
"docker": [
@ -4452,6 +4467,9 @@
"eradicate": [
"setuptools"
],
"erppeek": [
"setuptools"
],
"escapism": [
"setuptools"
],
@ -4664,7 +4682,8 @@
],
"fastapi-mail": [
"poetry-core",
"setuptools"
"setuptools",
"hatchling"
],
"fastapi-restful": [
"poetry"
@ -6861,6 +6880,9 @@
"itemloaders": [
"setuptools"
],
"iteration-utilities": [
"setuptools"
],
"itsdangerous": [
"setuptools"
],
@ -6989,6 +7011,9 @@
"jinja2": [
"setuptools"
],
"jinja2-ansible-filters": [
"setuptools"
],
"jinja2-git": [
"poetry-core",
"setuptools"
@ -7198,7 +7223,14 @@
"setuptools"
],
"jupyter-core": [
"setuptools"
{
"buildSystem": "hatchling",
"from": "4.11.0"
},
{
"buildSystem": "setuptools",
"until": "4.11.0"
}
],
"jupyter-lsp": [
"setuptools"
@ -7958,6 +7990,9 @@
"manhole": [
"setuptools"
],
"manage-fastapi": [
"poetry"
],
"manimpango": [
"cython",
"setuptools"
@ -8243,6 +8278,9 @@
"migen": [
"setuptools"
],
"mike": [
"setuptools"
],
"milc": [
"setuptools"
],
@ -8326,6 +8364,9 @@
"mkdocs-gen-files": [
"poetry"
],
"mkdocs-git-revision-date-localized-plugin": [
"setuptools"
],
"mkdocs-gitlab": [
"setuptools"
],
@ -8339,6 +8380,9 @@
"mkdocs-macros": [
"setuptools"
],
"mkdocs-macros-plugin": [
"setuptools"
],
"mkdocs-material": [
"setuptools"
],
@ -8354,6 +8398,9 @@
"mkdocs-swagger-ui-tag": [
"setuptools"
],
"mkdocs-table-reader-plugin": [
"setuptools"
],
"mkdocstrings": [
"pdm-pep517",
"setuptools"
@ -8661,6 +8708,9 @@
"poetry-core",
"setuptools"
],
"mypy-boto3-cognito": [
"setuptools"
],
"mypy-boto3-cognito-idp": [
"setuptools"
],
@ -8774,15 +8824,37 @@
"setuptools"
],
"nbconvert": [
"setuptools"
{
"buildSystem": "setuptools",
"until": "7.0.0"
},
{
"buildSystem": "hatchling",
"from": "7.0.0"
}
],
"nbdime": [
"setuptools",
"setuptools-scm"
],
"nbformat": [
"flit-core",
"setuptools"
{
"buildSystem": "setuptools",
"until": "5.4.0"
},
{
"buildSystem": "flit-core",
"from": "5.4.0",
"until": "5.6.0"
},
{
"buildSystem": "hatchling",
"from": "5.6.0"
},
{
"buildSystem": "hatch-nodejs-version",
"from": "5.6.0"
}
],
"nbmerge": [
"setuptools"
@ -10084,6 +10156,7 @@
"setuptools"
],
"pipdeptree": [
"hatch-vcs",
"hatchling",
"setuptools"
],
@ -10363,9 +10436,15 @@
"prayer-times-calculator": [
"setuptools"
],
"pre-commit": [
"setuptools"
],
"pre-commit-hooks": [
"setuptools"
],
"pre-commit-po-hooks": [
"setuptools"
],
"precis-i18n": [
"setuptools"
],
@ -11058,6 +11137,9 @@
"pydeps": [
"setuptools"
],
"pydeprecate": [
"setuptools"
],
"pydes": [
"setuptools"
],
@ -11389,6 +11471,7 @@
"setuptools"
],
"pyhamcrest": [
"hatch-vcs",
"hatchling",
"setuptools"
],
@ -13718,6 +13801,9 @@
"flit-core",
"setuptools"
],
"pyyaml-include": [
"setuptools"
],
"pyzbar": [
"setuptools"
],
@ -13725,6 +13811,7 @@
"setuptools"
],
"pyzmq": [
"packaging",
"setuptools"
],
"pyzufall": [
@ -14676,8 +14763,14 @@
"setuptools"
],
"seaborn": [
"flit-core",
"setuptools"
{
"buildSystem": "setuptools",
"until": "0.12.0"
},
{
"buildSystem": "flit-core",
"from": "0.12.0"
}
],
"seabreeze": [
"cython",
@ -16653,6 +16746,9 @@
"types-colorama": [
"setuptools"
],
"types-cryptography": [
"setuptools"
],
"types-dateutil": [
"setuptools"
],
@ -17048,6 +17144,7 @@
"setuptools-scm"
],
"vector": [
"hatch-vcs",
"hatchling"
],
"vega": [
@ -17087,6 +17184,9 @@
"versiontools": [
"setuptools"
],
"verspec": [
"setuptools"
],
"vertica-python": [
"setuptools"
],

View file

@ -130,9 +130,21 @@ lib.composeManyExtensions [
self.dopy
self.ncclient
];
} // lib.optionalAttrs (lib.versionOlder old.version "5.0") {
prePatch = pkgs.python.pkgs.ansible.prePatch or "";
postInstall = pkgs.python.pkgs.ansible.postInstall or "";
}
);
ansible-base = super.ansible-base.overridePythonAttrs (
old:
{
prePatch = ''sed -i "s/\[python, /[/" lib/ansible/executor/task_executor.py'';
postInstall = ''
for m in docs/man/man1/*; do
install -vD $m -t $out/share/man/man1
done
'';
}
// lib.optionalAttrs (lib.versionOlder old.version "2.4") {
prePatch = ''sed -i "s,/usr/,$out," lib/ansible/constants.py'';
}
);
@ -194,7 +206,6 @@ lib.composeManyExtensions [
}.${version} or (
lib.warn "Unknown bcrypt version: '${version}'. Please update getCargoHash." lib.fakeHash
);
sha256 = getCargoHash super.bcrypt.version;
in
super.bcrypt.overridePythonAttrs (
old: {
@ -206,7 +217,7 @@ lib.composeManyExtensions [
(old.nativeBuildInputs or [ ])
++ lib.optionals (lib.versionAtLeast old.version "4")
(with pkgs.rustPlatform; [ rust.rustc rust.cargo cargoSetupHook self.setuptools-rust ]);
} // lib.optionalAttrs (lib.versionAtLeast old.version "4") rec {
} // lib.optionalAttrs (lib.versionAtLeast old.version "4") {
cargoDeps =
pkgs.rustPlatform.fetchCargoTarball
{
@ -269,6 +280,10 @@ lib.composeManyExtensions [
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools ];
});
cerberus = super.cerberus.overridePythonAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools ];
});
cssselect2 = super.cssselect2.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ];
@ -341,6 +356,10 @@ lib.composeManyExtensions [
}
);
copier = super.copier.overrideAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.git ];
});
cryptography =
let
getCargoHash = version: {
@ -355,8 +374,9 @@ lib.composeManyExtensions [
lib.warn "Unknown cryptography version: '${version}'. Please update getCargoHash." lib.fakeHash
);
sha256 = getCargoHash super.cryptography.version;
isWheel = lib.hasSuffix ".whl" super.cryptography.src;
scrypto =
if lib.versionAtLeast super.cryptography.version "35" && sha256 == null then
if isWheel then
(
super.cryptography.override { preferWheel = true; }
) else super.cryptography;
@ -367,7 +387,7 @@ lib.composeManyExtensions [
nativeBuildInputs = (old.nativeBuildInputs or [ ])
++ lib.optional (lib.versionAtLeast old.version "3.4") [ self.setuptools-rust ]
++ lib.optional (!self.isPyPy) pyBuildPackages.cffi
++ lib.optional (lib.versionAtLeast old.version "3.5")
++ lib.optional (lib.versionAtLeast old.version "3.5" && !isWheel)
(with pkgs.rustPlatform; [ cargoSetupHook rust.cargo rust.rustc ]);
buildInputs = (old.buildInputs or [ ])
++ [ (if lib.versionAtLeast old.version "37" then pkgs.openssl_3 else pkgs.openssl_1_1) ]
@ -375,7 +395,7 @@ lib.composeManyExtensions [
propagatedBuildInputs = old.propagatedBuildInputs or [ ] ++ [ self.cffi ];
} // lib.optionalAttrs (lib.versionAtLeast old.version "3.4" && lib.versionOlder old.version "3.5") {
CRYPTOGRAPHY_DONT_BUILD_RUST = "1";
} // lib.optionalAttrs (lib.versionAtLeast old.version "35" && sha256 != null) rec {
} // lib.optionalAttrs (lib.versionAtLeast old.version "3.5" && !isWheel) rec {
cargoDeps =
pkgs.rustPlatform.fetchCargoTarball {
src = old.src;
@ -806,6 +826,12 @@ lib.composeManyExtensions [
}
);
ipython = super.ipython.overridePythonAttrs (
old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools ];
}
);
isort = super.isort.overridePythonAttrs (
old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools ];
@ -884,7 +910,7 @@ lib.composeManyExtensions [
);
jupyter-packaging = super.jupyter-packaging.overridePythonAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.wheel ];
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ self.setuptools self.wheel ];
});
jupyterlab-widgets = super.jupyterlab-widgets.overridePythonAttrs (
@ -1059,6 +1085,9 @@ lib.composeManyExtensions [
self.setuptools-scm-git-archive
];
# Clang doesn't understand -fno-strict-overflow, and matplotlib builds with -Werror
hardeningDisable = if stdenv.isDarwin then [ "strictoverflow" ] else [ ];
passthru = old.passthru or { } // passthru;
MPLSETUPCFG = pkgs.writeText "mplsetup.cfg" (lib.generators.toINI { } passthru.config);
@ -1251,6 +1280,8 @@ lib.composeManyExtensions [
};
in
{
# fails to build with format=pyproject and setuptools >= 65
format = if (old.format == "poetry2nix") then "setuptools" else old.format;
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.gfortran ];
buildInputs = (old.buildInputs or [ ]) ++ [ blas ];
enableParallelBuilding = true;
@ -1271,9 +1302,10 @@ lib.composeManyExtensions [
);
open3d = super.open3d.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ (with pkgs; [
udev
]);
buildInputs = (old.buildInputs or [ ]) ++ [
pkgs.udev
pkgs.libusb1
];
# TODO(Sem Mulder): Add overridable flags for CUDA/PyTorch/Tensorflow support.
autoPatchelfIgnoreMissingDeps = true;
});
@ -1441,8 +1473,6 @@ lib.composeManyExtensions [
{
# "Vendor" dependencies (for build-system support)
postPatch = ''
find .
echo "import sys" >> ${initFile}
for path in $propagatedBuildInputs; do
echo "sys.path.insert(0, \"$path\")" >> ${initFile}
@ -1715,6 +1745,10 @@ lib.composeManyExtensions [
}
);
pyrealsense2 = super.pyrealsense2.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.libusb1.out ];
});
pyrfr = super.pyrfr.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.swig ];
});
@ -2271,6 +2305,43 @@ lib.composeManyExtensions [
}).wheel;
};
watchfiles =
let
# Watchfiles does not include Cargo.lock in tarball released on PyPi for versions up to 0.17.0
getRepoHash = version: {
"0.17.0" = "1swpf265h9qq30cx55iy6jjirba3wml16wzb68k527ynrxr7hvqx";
"0.16.1" = "1ss6gzcr6js2d2sddgz1p52gyiwpqmgrxm8r6wim7gnm4wvhav8a";
"0.15.0" = "14k3avrj7v794kk4mk2xggn40a4s0zg8iq8wmyyyrf7va6hz29hf";
"0.14.1" = "1pgfbhxrvr3dw46x9piqj3ydxgn4lkrfp931q0cajinrpv4acfay";
"0.14" = "0lml67ilyly0i632pffdy1gd07404vx90xnkw8q6wf6xp5afmkka";
"0.13" = "0rkz8yr01mmxm2lcmbnr9i5c7n371mksij7v3ws0aqlrh3kgww02";
"0.12" = "16788a0d8n1bb705f0k3dvav2fmbbl6pcikwpgarl1l3fcfff8kl";
"0.11" = "0vx56h9wfxj7x3aq7jign4rnlfm7x9nhjwmsv8p22acbzbs10dgv";
"0.10" = "0ypdy9sq4211djqh4ni5ap9l7whq9hw0vhsxjfl3a0a4czlldxqp";
}.${version};
sha256 = getRepoHash super.watchfiles.version;
in
super.watchfiles.overridePythonAttrs (old: rec {
src = pkgs.fetchFromGitHub {
owner = "samuelcolvin";
repo = "watchfiles";
rev = "v${old.version}";
inherit sha256;
};
cargoDeps = pkgs.rustPlatform.importCargoLock {
lockFile = "${src.out}/Cargo.lock";
};
buildInputs = (old.buildInputs or [ ]) ++ lib.optionals stdenv.isDarwin [
pkgs.darwin.apple_sdk.frameworks.Security
pkgs.darwin.apple_sdk.frameworks.CoreServices
pkgs.libiconv
];
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
pkgs.rustPlatform.cargoSetupHook
pkgs.rustPlatform.maturinBuildHook
];
});
weasyprint = super.weasyprint.overridePythonAttrs (
old: {
inherit (pkgs.python3.pkgs.weasyprint) patches;
@ -2528,6 +2599,12 @@ lib.composeManyExtensions [
'root_dirs.extend(jupyter_path())' \
'root_dirs.extend(jupyter_path() + [os.path.join("@out@", "share", "jupyter")])' \
--subst-var out
'' + lib.optionalString (lib.versionAtLeast self.nbconvert.version "7.0") ''
substituteInPlace \
./hatch_build.py \
--replace \
'if self.target_name not in ["wheel", "sdist"]:' \
'if True:'
'';
});
}

View file

@ -3,18 +3,15 @@ let
inherit (lib.strings) escapeRegex hasPrefix hasSuffix hasInfix splitString removePrefix removeSuffix;
targetMachine = poetryLib.getTargetMachine stdenv;
# The 'cpxy" as determined by `python.version`
#
# e.g "2.7.17" -> "cp27"
# "3.5.9" -> "cp35"
pythonTag =
pythonVer =
let
ver = builtins.splitVersion python.version;
major = builtins.elemAt ver 0;
minor = builtins.elemAt ver 1;
tags = [ "cp" "py" ];
in
"cp${major}${minor}";
abiTag = "${pythonTag}m";
{ inherit major minor tags; };
abiTag = "cp${pythonVer.major}${pythonVer.minor}m";
#
# Parses wheel file returning an attribute set
@ -50,14 +47,24 @@ let
then [ ]
else (builtins.filter (x: hasInfix v x.file) candidates) ++ (findBestMatches vs candidates);
# pyver = "cpXX"
# x = "cpXX" | "py2" | "py3" | "py2.py3"
isPyVersionCompatible = pyver: x:
# x = "cpXX" | "py2" | "py3" | "py2.py3"
isPyVersionCompatible = pyver@{ major, minor, tags }: x:
let
normalize = y: ''cp${removePrefix "cp" (removePrefix "py" y)}'';
isCompat = p: x: hasPrefix (normalize x) p;
isCompat = m:
builtins.elem m.tag tags
&& m.major == major
&& builtins.compareVersions minor m.minor >= 0;
parseMarker = v:
let
tag = builtins.substring 0 2 v;
major = builtins.substring 2 1 v;
end = builtins.substring 3 3 v;
minor = if builtins.stringLength end > 0 then end else "0";
in
{ inherit major minor tag; };
markers = splitString "." x;
in
lib.lists.any (isCompat pyver) (splitString "." x);
lib.lists.any isCompat (map parseMarker markers);
#
# Selects the best matching wheel file from a list of files
@ -95,7 +102,7 @@ let
let
f = toWheelAttrs x.file;
in
(withPython pythonTag abiTag f) && (withPlatforms f);
(withPython pythonVer abiTag f) && (withPlatforms f);
filtered = builtins.filter filterWheel filesWithoutSources;
choose = files:
let

View file

@ -19,7 +19,7 @@ let
inherit (drv) src version meta;
buildInputs = drv.buildInputs ++ drv.propagatedBuildInputs ++ buildInputs;
nativeBuildInputs = drv.nativeBuildInputs ++ nativeBuildInputs;
nativeBuildInputs = builtins.filter (x: x.name != "python-output-dist-hook") (drv.nativeBuildInputs ++ nativeBuildInputs);
dontConfigure = true;
dontBuild = true;