poetry2nix: 1.6.1 -> 1.7.0

This commit is contained in:
adisbladis 2020-03-27 22:54:24 +00:00
parent bee6c1a445
commit dda52a4571
No known key found for this signature in database
GPG Key ID: 110BFAD44C6249B7
4 changed files with 20 additions and 6 deletions

View File

@ -8,11 +8,16 @@ import json
import sys import sys
argparser = argparse.ArgumentParser(description="Generate overrides for git hashes",) argparser = argparse.ArgumentParser(description="Poetry2nix CLI")
argparser.add_argument(
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", "--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", "--out", default="poetry-git-overlay.nix", help="Output file",
) )
@ -92,7 +97,7 @@ if __name__ == "__main__":
expr = "\n".join(lines) expr = "\n".join(lines)
with open(args.out, "w") as f: with open(args.out, "w") as fout:
f.write(expr) fout.write(expr)
print(f"Wrote {args.out}") print(f"Wrote {args.out}")

View File

@ -7,7 +7,7 @@ let
inherit (poetryLib) isCompatible readTOML; inherit (poetryLib) isCompatible readTOML;
# Poetry2nix version # Poetry2nix version
version = "1.6.1"; version = "1.7.0";
/* The default list of poetry2nix override overlays */ /* The default list of poetry2nix override overlays */
defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; }); defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; });
@ -79,6 +79,7 @@ let
source = pkgMeta.source or null; source = pkgMeta.source or null;
files = lockFiles.${name}; files = lockFiles.${name};
pythonPackages = self; pythonPackages = self;
sourceSpec = pyProject.tool.poetry.dependencies.${name} or pyProject.tool.poetry.dev-dependencies.${name};
} }
); );
} }

View File

@ -14,6 +14,7 @@
, pythonPackages , pythonPackages
, python-versions , python-versions
, pwd , pwd
, sourceSpec
, supportedExtensions ? lib.importJSON ./extensions.json , supportedExtensions ? lib.importJSON ./extensions.json
, ... , ...
}: }:
@ -147,6 +148,7 @@ pythonPackages.callPackage (
builtins.fetchGit { builtins.fetchGit {
inherit (source) url; inherit (source) url;
rev = source.reference; rev = source.reference;
ref = sourceSpec.branch or sourceSpec.rev or sourceSpec.tag or "HEAD";
} }
) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else fetchFromPypi { ) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else fetchFromPypi {
pname = name; pname = name;

View File

@ -104,6 +104,12 @@ self: super:
} }
); );
fastparquet = super.fastparquet.overrideAttrs (
old: {
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
}
);
grandalf = super.grandalf.overrideAttrs ( grandalf = super.grandalf.overrideAttrs (
old: { old: {
buildInputs = old.buildInputs ++ [ self.pytest-runner ]; buildInputs = old.buildInputs ++ [ self.pytest-runner ];