From dda52a4571bc08ad8a6615ce4b87a51df7cf4b3d Mon Sep 17 00:00:00 2001 From: adisbladis Date: Fri, 27 Mar 2020 22:54:24 +0000 Subject: [PATCH] poetry2nix: 1.6.1 -> 1.7.0 --- .../tools/poetry2nix/poetry2nix/bin/poetry2nix | 15 ++++++++++----- .../tools/poetry2nix/poetry2nix/default.nix | 3 ++- .../tools/poetry2nix/poetry2nix/mk-poetry-dep.nix | 2 ++ .../tools/poetry2nix/poetry2nix/overrides.nix | 6 ++++++ 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix b/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix index 95576b987f5c..5f9b21fc285a 100755 --- a/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/bin/poetry2nix @@ -8,11 +8,16 @@ import json import sys -argparser = argparse.ArgumentParser(description="Generate overrides for git hashes",) -argparser.add_argument( +argparser = argparse.ArgumentParser(description="Poetry2nix CLI") + +subparsers = argparser.add_subparsers(dest="subcommand") +subparsers.required = True + +parser_lock = subparsers.add_parser("lock", help="Generate overrides for git hashes",) +parser_lock.add_argument( "--lock", default="poetry.lock", help="Path to input poetry.lock", ) -argparser.add_argument( +parser_lock.add_argument( "--out", default="poetry-git-overlay.nix", help="Output file", ) @@ -92,7 +97,7 @@ if __name__ == "__main__": expr = "\n".join(lines) - with open(args.out, "w") as f: - f.write(expr) + with open(args.out, "w") as fout: + fout.write(expr) print(f"Wrote {args.out}") diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/default.nix b/pkgs/development/tools/poetry2nix/poetry2nix/default.nix index 3a104ba6eaa4..a63b3c5bdd46 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/default.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/default.nix @@ -7,7 +7,7 @@ let inherit (poetryLib) isCompatible readTOML; # Poetry2nix version - version = "1.6.1"; + version = "1.7.0"; /* The default list of poetry2nix override overlays */ defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; }); @@ -79,6 +79,7 @@ let source = pkgMeta.source or null; files = lockFiles.${name}; pythonPackages = self; + sourceSpec = pyProject.tool.poetry.dependencies.${name} or pyProject.tool.poetry.dev-dependencies.${name}; } ); } diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix b/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix index 5f66d24d685c..5e71190d28fe 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix @@ -14,6 +14,7 @@ , pythonPackages , python-versions , pwd +, sourceSpec , supportedExtensions ? lib.importJSON ./extensions.json , ... }: @@ -147,6 +148,7 @@ pythonPackages.callPackage ( builtins.fetchGit { inherit (source) url; rev = source.reference; + ref = sourceSpec.branch or sourceSpec.rev or sourceSpec.tag or "HEAD"; } ) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else fetchFromPypi { pname = name; diff --git a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix index 18afac8147ce..bdbfb22a122e 100644 --- a/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix +++ b/pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix @@ -104,6 +104,12 @@ self: super: } ); + fastparquet = super.fastparquet.overrideAttrs ( + old: { + buildInputs = old.buildInputs ++ [ self.pytest-runner ]; + } + ); + grandalf = super.grandalf.overrideAttrs ( old: { buildInputs = old.buildInputs ++ [ self.pytest-runner ];