poetry2nix: 1.21.0 -> 1.22.0

main
Lionello Lunesu 2 years ago
parent 5c37ad8722
commit d63606d759
  1. 9
      pkgs/development/tools/poetry2nix/poetry2nix/default.nix
  2. 23
      pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix
  3. 25
      pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-path.py
  4. 52
      pkgs/development/tools/poetry2nix/poetry2nix/hooks/pyproject-without-special-deps.py
  5. 12
      pkgs/development/tools/poetry2nix/poetry2nix/hooks/remove-path-dependencies.sh
  6. 20
      pkgs/development/tools/poetry2nix/poetry2nix/hooks/remove-special-dependencies.sh
  7. 6
      pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix
  8. 76
      pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
  9. 30
      pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/poetry.lock
  10. 4
      pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/pyproject.toml
  11. 4
      pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/src.json

@ -5,7 +5,7 @@
}:
let
# Poetry2nix version
version = "1.21.0";
version = "1.22.0";
inherit (poetryLib) isCompatible readTOML moduleName;
@ -211,7 +211,7 @@ lib.makeScope pkgs.newScope (self: {
__toPluginAble = toPluginAble self;
inherit (hooks) pipBuildHook removePathDependenciesHook poetry2nixFixupHook wheelUnpackHook;
inherit (hooks) pipBuildHook removePathDependenciesHook removeGitDependenciesHook poetry2nixFixupHook wheelUnpackHook;
} // lib.optionalAttrs (! super ? setuptools-scm) {
# The canonical name is setuptools-scm
setuptools-scm = super.setuptools_scm;
@ -313,7 +313,10 @@ lib.makeScope pkgs.newScope (self: {
app = py.pkgs.buildPythonPackage (
passedAttrs // inputAttrs // {
nativeBuildInputs = inputAttrs.nativeBuildInputs ++ [ py.pkgs.removePathDependenciesHook ];
nativeBuildInputs = inputAttrs.nativeBuildInputs ++ [
py.pkgs.removePathDependenciesHook
py.pkgs.removeGitDependenciesHook
];
} // {
pname = moduleName pyProject.tool.poetry.name;
version = pyProject.tool.poetry.version;

@ -21,9 +21,28 @@ in
substitutions = {
inherit pythonInterpreter;
yj = "${buildPackages.yj}/bin/yj";
pyprojectPatchScript = "${./pyproject-without-path.py}";
pyprojectPatchScript = "${./pyproject-without-special-deps.py}";
fields = [ "path" ];
kind = "path";
};
} ./remove-path-dependencies.sh
} ./remove-special-dependencies.sh
)
{ };
removeGitDependenciesHook = callPackage
({}:
makeSetupHook
{
name = "remove-git-dependencies.sh";
deps = [ ];
substitutions = {
inherit pythonInterpreter;
yj = "${buildPackages.yj}/bin/yj";
pyprojectPatchScript = "${./pyproject-without-special-deps.py}";
fields = [ "git" "branch" "rev" "tag" ];
kind = "git";
};
} ./remove-special-dependencies.sh
)
{ };

@ -1,25 +0,0 @@
#!/usr/bin/env python
# Patch out path dependencies from a pyproject.json file
import json
import sys
data = json.load(sys.stdin)
def get_deep(o, path):
for p in path.split('.'):
o = o.get(p, {})
return o
for dep in get_deep(data, 'tool.poetry.dependencies').values():
if isinstance(dep, dict):
try:
del dep['path'];
except KeyError:
pass
else:
dep['version'] = '*'
json.dump(data, sys.stdout, indent=4)

@ -0,0 +1,52 @@
#!/usr/bin/env python
# Patch out special dependencies (git and path) from a pyproject.json file
import argparse
import json
import sys
def main(input, output, fields_to_remove):
data = json.load(input)
try:
deps = data["tool"]["poetry"]["dependencies"]
except KeyError:
pass
else:
for dep in deps.values():
if isinstance(dep, dict):
any_removed = False
for field in fields_to_remove:
any_removed |= dep.pop(field, None) is not None
if any_removed:
dep["version"] = "*"
json.dump(data, output, separators=(",", ":"))
if __name__ == "__main__":
p = argparse.ArgumentParser()
p.add_argument(
"-i",
"--input",
type=argparse.FileType("r"),
default=sys.stdin,
help="Location from which to read input JSON",
)
p.add_argument(
"-o",
"--output",
type=argparse.FileType("w"),
default=sys.stdout,
help="Location to write output JSON",
)
p.add_argument(
"-f",
"--fields-to-remove",
nargs="+",
help="The fields to remove from the dependency's JSON",
)
args = p.parse_args()
main(args.input, args.output, args.fields_to_remove)

@ -1,12 +0,0 @@
remove-path-dependencies-hook() {
if ! test -f pyproject.toml; then
return
fi
# Tell poetry not to resolve the path dependencies. Any version is fine!
@yj@ -tj < pyproject.toml | @pythonInterpreter@ @pyprojectPatchScript@ > pyproject.json
@yj@ -jt < pyproject.json > pyproject.toml
rm pyproject.json
}
postPatchHooks+=(remove-path-dependencies-hook)

@ -0,0 +1,20 @@
remove-@kind@-dependencies-hook() {
if ! test -f pyproject.toml; then
return
fi
echo "Removing @kind@ dependencies"
# Tell poetry not to resolve special dependencies. Any version is fine!
@yj@ -tj < pyproject.toml | \
@pythonInterpreter@ \
@pyprojectPatchScript@ \
--fields-to-remove @fields@ > pyproject.json
@yj@ -jt < pyproject.json > pyproject.toml
rm pyproject.json
echo "Finished removing @kind@ dependencies"
}
postPatchHooks+=(remove-@kind@-dependencies-hook)

@ -119,8 +119,10 @@ pythonPackages.callPackage
pythonPackages.poetry2nixFixupHook
]
++ lib.optional (!isSource && (getManyLinuxDeps fileInfo.name).str != null) autoPatchelfHook
++ lib.optional (format == "pyproject") pythonPackages.removePathDependenciesHook
;
++ lib.optionals (format == "pyproject") [
pythonPackages.removePathDependenciesHook
pythonPackages.removeGitDependenciesHook
];
buildInputs = (
baseBuildInputs

@ -73,7 +73,6 @@ self: super:
astroid = super.astroid.overridePythonAttrs (
old: rec {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ];
doCheck = false;
}
);
@ -162,6 +161,14 @@ self: super:
}
);
cloudflare = super.cloudflare.overridePythonAttrs (
old: {
postPatch = ''
rm -rf examples/*
'';
}
);
colour = super.colour.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.d2to1 ];
@ -184,10 +191,22 @@ self: super:
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ])
++ lib.optional (lib.versionAtLeast old.version "3.4") [ self.setuptools-rust ]
++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) self.python.pythonForBuild.pkgs.cffi;
++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) self.python.pythonForBuild.pkgs.cffi
++ lib.optional (lib.versionAtLeast old.version "3.5")
(with pkgs.rustPlatform; [ cargoSetupHook rust.cargo rust.rustc ]);
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.openssl ];
} // 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 "3.5") rec {
cargoDeps = pkgs.rustPlatform.fetchCargoTarball {
src = old.src;
sourceRoot = "${old.pname}-${old.version}/${cargoRoot}";
name = "${old.pname}-${old.version}";
# This hash could no longer be valid for cryptography versions
# different from 3.5.0
sha256 = "sha256-tQoQfo+TAoqAea86YFxyj/LNQCiViu5ij/3wj7ZnYLI=";
};
cargoRoot = "src/rust";
}
);
@ -345,6 +364,12 @@ self: super:
}
);
filelock = super.filelock.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup()' 'setup(version="${old.version}")'
'';
});
fiona = super.fiona.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.gdal_2 ];
@ -845,7 +870,10 @@ self: super:
# is64bit: unfortunately the build would exhaust all possible memory on i686-linux.
stdenv.buildPlatform.is64bit
# Derivation fails to build since v0.900 if mypyc is enabled.
&& lib.strings.versionOlder old.version "0.900";
&& (
lib.strings.versionOlder old.version "0.900"
|| lib.strings.versionAtLeast old.version "0.910"
);
}
);
@ -968,28 +996,6 @@ self: super:
}
);
# Work around https://github.com/nix-community/poetry2nix/issues/244
# where git deps are not picked up as they should
pip =
if lib.versionAtLeast super.pip.version "20.3" then
super.pip.overridePythonAttrs
(old:
let
pname = "pip";
version = "20.2.4";
in
{
name = pname + "-" + version;
inherit version;
src = pkgs.fetchFromGitHub {
owner = "pypa";
repo = pname;
rev = version;
sha256 = "eMVV4ftgV71HLQsSeaOchYlfaJVgzNrwUynn3SA1/Do=";
name = "${pname}-${version}-source";
};
}) else super.pip;
platformdirs = super.platformdirs.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup()' 'setup(version="${old.version}")'
@ -1201,7 +1207,6 @@ self: super:
pylint = super.pylint.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ];
doCheck = false;
}
);
@ -1369,7 +1374,6 @@ self: super:
postPatch = old.postPatch or "" + ''
sed -i '/\[metadata\]/aversion = ${old.version}' setup.cfg
'';
doCheck = false;
}
);
@ -1700,7 +1704,7 @@ self: super:
if (!enableCuda) then ''
export USE_CUDA=0
'' else ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${cudatoolkit}/targets/x86_64-linux/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${cudatoolkit}/targets/x86_64-linux/lib"
'';
preFixup = lib.optionalString (!enableCuda) ''
# For some reason pytorch retains a reference to libcuda even if it
@ -1739,9 +1743,9 @@ self: super:
];
preConfigure =
if (enableCuda) then ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${self.torch}/${self.python.sitePackages}/torch/lib:${lib.makeLibraryPath [ cudatoolkit "${cudatoolkit}" ]}"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${self.torch}/${self.python.sitePackages}/torch/lib:${lib.makeLibraryPath [ cudatoolkit "${cudatoolkit}" ]}"
'' else ''
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}${self.torch}/${self.python.sitePackages}/torch/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${self.torch}/${self.python.sitePackages}/torch/lib"
'';
}))
{ };
@ -1854,13 +1858,14 @@ self: super:
if lib.versionAtLeast super.zipp.version "2.0.0" then
(
super.zipp.overridePythonAttrs (
old: {
old:
if (old.format or "pyproject") != "wheel" then {
prePatch = ''
substituteInPlace setup.py --replace \
'setuptools.setup()' \
'setuptools.setup(version="${super.zipp.version}")'
'';
}
} else old
)
) else super.zipp
).overridePythonAttrs (
@ -2080,9 +2085,8 @@ self: super:
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.flit-core ];
});
virtualenv = super.virtualenv.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.cfg --replace 'platformdirs>=2,<3' 'platformdirs'
'';
uwsgi = super.uwsgi.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.ncurses ];
sourceRoot = ".";
});
}

@ -274,11 +274,15 @@ python-versions = "*"
[[package]]
name = "filelock"
version = "3.0.12"
version = "3.2.1"
description = "A platform independent file lock."
category = "main"
optional = false
python-versions = "*"
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7"
[package.extras]
docs = ["furo (>=2021.8.17b43)", "sphinx (>=4.1)", "sphinx-autodoc-typehints (>=1.12)"]
testing = ["coverage (>=4)", "pytest (>=4)", "pytest-cov", "pytest-timeout (>=1.4.2)"]
[[package]]
name = "funcsigs"
@ -343,7 +347,7 @@ six = "*"
[[package]]
name = "identify"
version = "2.2.15"
version = "2.3.0"
description = "File identification library for Python"
category = "dev"
optional = false
@ -624,7 +628,7 @@ dev = ["pre-commit", "tox"]
[[package]]
name = "poetry-core"
version = "1.0.6"
version = "1.0.7"
description = "Poetry PEP 517 Build Backend"
category = "main"
optional = false
@ -1004,7 +1008,7 @@ socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"]
[[package]]
name = "virtualenv"
version = "20.8.0"
version = "20.8.1"
description = "Virtual Python Environment builder"
category = "main"
optional = false
@ -1296,8 +1300,8 @@ enum34 = [
{file = "enum34-1.1.10.tar.gz", hash = "sha256:cce6a7477ed816bd2542d03d53db9f0db935dd013b70f336a95c73979289f248"},
]
filelock = [
{file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"},
{file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"},
{file = "filelock-3.2.1-py2.py3-none-any.whl", hash = "sha256:7f07b08d731907441ff40d0c5b81f9512cd968842e0b6264c8bd18a8ce877760"},
{file = "filelock-3.2.1.tar.gz", hash = "sha256:9cdd29c411ab196cf4c35a1da684f7b9da723696cb356efa45bf5eb1ff313ee3"},
]
funcsigs = [
{file = "funcsigs-1.0.2-py2.py3-none-any.whl", hash = "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca"},
@ -1322,8 +1326,8 @@ httpretty = [
{file = "httpretty-0.9.7.tar.gz", hash = "sha256:66216f26b9d2c52e81808f3e674a6fb65d4bf719721394a1a9be926177e55fbe"},
]
identify = [
{file = "identify-2.2.15-py2.py3-none-any.whl", hash = "sha256:de83a84d774921669774a2000bf87ebba46b4d1c04775f4a5d37deff0cf39f73"},
{file = "identify-2.2.15.tar.gz", hash = "sha256:528a88021749035d5a39fe2ba67c0642b8341aaf71889da0e1ed669a429b87f0"},
{file = "identify-2.3.0-py2.py3-none-any.whl", hash = "sha256:d1e82c83d063571bb88087676f81261a4eae913c492dafde184067c584bc7c05"},
{file = "identify-2.3.0.tar.gz", hash = "sha256:fd08c97f23ceee72784081f1ce5125c8f53a02d3f2716dde79a6ab8f1039fea5"},
]
idna = [
{file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"},
@ -1435,8 +1439,8 @@ pluggy = [
{file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"},
]
poetry-core = [
{file = "poetry-core-1.0.6.tar.gz", hash = "sha256:dd3c97003579242236890306836f2acc86d9741e6bea320dda6f844f16b0d845"},
{file = "poetry_core-1.0.6-py2.py3-none-any.whl", hash = "sha256:4ef68b4a55a8a95a60e6a312317e5a2f2af7590cf3d46b6bfe648c1e5f13cc48"},
{file = "poetry-core-1.0.7.tar.gz", hash = "sha256:98c11c755a16ef6c5673c22ca94a3802a7df4746a0853a70b6fae8b9f5cac206"},
{file = "poetry_core-1.0.7-py2.py3-none-any.whl", hash = "sha256:4f8a7f5390d772f42c4c4c3f188e6424b802cb4b57466c6633a1b9ac36f18a43"},
]
pre-commit = [
{file = "pre_commit-2.15.0-py2.py3-none-any.whl", hash = "sha256:a4ed01000afcb484d9eb8d504272e642c4c4099bbad3a6b27e519bd6a3e928a6"},
@ -1589,8 +1593,8 @@ urllib3 = [
{file = "urllib3-1.25.11.tar.gz", hash = "sha256:8d7eaa5a82a1cac232164990f04874c594c9453ec55eef02eab885aa02fc17a2"},
]
virtualenv = [
{file = "virtualenv-20.8.0-py2.py3-none-any.whl", hash = "sha256:a4b987ec31c3c9996cf1bc865332f967fe4a0512c41b39652d6224f696e69da5"},
{file = "virtualenv-20.8.0.tar.gz", hash = "sha256:4da4ac43888e97de9cf4fdd870f48ed864bbfd133d2c46cbdec941fed4a25aef"},
{file = "virtualenv-20.8.1-py2.py3-none-any.whl", hash = "sha256:10062e34c204b5e4ec5f62e6ef2473f8ba76513a9a617e873f1f8fb4a519d300"},
{file = "virtualenv-20.8.1.tar.gz", hash = "sha256:bcc17f0b3a29670dd777d6f0755a4c04f28815395bca279cdcb213b97199a6b8"},
]
wcwidth = [
{file = "wcwidth-0.2.5-py2.py3-none-any.whl", hash = "sha256:beb4802a9cebb9144e99086eff703a642a13d6a0052920003a230f3294bbe784"},

@ -1,6 +1,6 @@
[tool.poetry]
name = "poetry"
version = "1.1.10"
version = "1.1.11"
description = "Python dependency management and packaging made easy."
authors = [
"Sébastien Eustace <sebastien@eustace.io>"
@ -24,7 +24,7 @@ classifiers = [
[tool.poetry.dependencies]
python = "~2.7 || ^3.5"
poetry-core = "~1.0.6"
poetry-core = "~1.0.7"
cleo = "^0.8.1"
clikit = "^0.6.2"
crashtest = { version = "^0.3.0", python = "^3.6" }

@ -1,7 +1,7 @@
{
"owner": "python-poetry",
"repo": "poetry",
"rev": "ebc5484d72fb719a6ffe949cbe95acd98f5c249b",
"sha256": "S2HwolO7cU2c90ZcxPEiGjQ5PrOzZ6US22WLcWUJ0R8=",
"rev": "10d555984485088cf5d55979c1b235286de8e456",
"sha256": "ncZPVqW/z76BNHAZ1+xM1DNqt41z1QSFY9tqsdUbfrg=",
"fetchSubmodules": true
}

Loading…
Cancel
Save