From 2eb83293198fcee006f282d929d004ca2b4dd68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Kristian=20Lysh=C3=B8j=20Jensen?= Date: Sat, 10 Jul 2021 13:38:34 +0200 Subject: [PATCH] Add support for local files --- mk-poetry-dep.nix | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mk-poetry-dep.nix b/mk-poetry-dep.nix index f002e23..867f6d9 100644 --- a/mk-poetry-dep.nix +++ b/mk-poetry-dep.nix @@ -47,7 +47,8 @@ pythonPackages.callPackage isSource = source != null; isGit = isSource && source.type == "git"; isUrl = isSource && source.type == "url"; - isLocal = isSource && source.type == "directory"; + isDirectory = isSource && source.type == "directory"; + isFile = isSource && source.type == "file"; isLegacy = isSource && source.type == "legacy"; localDepPath = toPath source.url; @@ -97,7 +98,7 @@ pythonPackages.callPackage "toml" # Toml is an extra for setuptools-scm ]; baseBuildInputs = lib.optional (! lib.elem name skipSetupToolsSCM) pythonPackages.setuptools-scm; - format = if isLocal || isGit || isUrl then "pyproject" else fileInfo.format; + format = if isDirectory || isGit || isUrl then "pyproject" else fileInfo.format; in buildPythonPackage { pname = moduleName name; @@ -121,7 +122,7 @@ pythonPackages.callPackage baseBuildInputs ++ lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) pythonPackages.setuptools ++ lib.optional (!isSource) (getManyLinuxDeps fileInfo.name).pkg - ++ lib.optional isLocal buildSystemPkgs + ++ lib.optional isDirectory buildSystemPkgs ++ lib.optional (!__isBootstrap) pythonPackages.poetry ); @@ -173,8 +174,10 @@ pythonPackages.callPackage { inherit (source) url; } - else if isLocal then + else if isDirectory then (poetryLib.cleanPythonSources { src = localDepPath; }) + else if isFile then + localDepPath else if isLegacy then fetchFromLegacy {