mirror of
https://github.com/vale981/poetry2nix
synced 2025-03-04 16:51:40 -05:00
Add Git support
This commit is contained in:
parent
46cc4c74fc
commit
737ed5a372
2 changed files with 18 additions and 5 deletions
|
@ -58,7 +58,12 @@ let
|
|||
builtins.map (
|
||||
pkgMeta: rec {
|
||||
name = pkgMeta.name;
|
||||
value = self.mkPoetryDep (pkgMeta // { files = lockFiles.${name}; });
|
||||
value = self.mkPoetryDep (
|
||||
pkgMeta // {
|
||||
source = getAttrDefault "source" pkgMeta null;
|
||||
files = lockFiles.${name};
|
||||
}
|
||||
);
|
||||
}
|
||||
) compatible
|
||||
);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
{ name
|
||||
, version
|
||||
, files
|
||||
, source
|
||||
, dependencies ? {}
|
||||
, python-versions
|
||||
, supportedExtensions ? lib.importJSON ./extensions.json
|
||||
|
@ -30,6 +31,8 @@
|
|||
in
|
||||
builtins.filter (f: matchesVersion f.file && hasSupportedExtension f.file) files;
|
||||
|
||||
isGit = source != null && source.type == "git";
|
||||
|
||||
fileInfo = let
|
||||
isBdist = f: lib.strings.hasSuffix "whl" f.file;
|
||||
isSdist = f: ! isBdist f;
|
||||
|
@ -51,10 +54,10 @@ buildPythonPackage {
|
|||
|
||||
doCheck = false; # We never get development deps
|
||||
dontStrip = true;
|
||||
format = fileInfo.format;
|
||||
format = if isGit then "setuptools" else fileInfo.format;
|
||||
|
||||
nativeBuildInputs = if (getManyLinuxDeps fileInfo.name).str != null then [ autoPatchelfHook ] else [];
|
||||
buildInputs = (getManyLinuxDeps fileInfo.name).pkg;
|
||||
nativeBuildInputs = if (!isGit && (getManyLinuxDeps fileInfo.name).str != null) then [ autoPatchelfHook ] else [];
|
||||
buildInputs = if !isGit then (getManyLinuxDeps fileInfo.name).pkg else [];
|
||||
|
||||
propagatedBuildInputs =
|
||||
let
|
||||
|
@ -72,7 +75,12 @@ buildPythonPackage {
|
|||
# We need to retrieve kind from the interpreter and the filename of the package
|
||||
# Interpreters should declare what wheel types they're compatible with (python type + ABI)
|
||||
# Here we can then choose a file based on that info.
|
||||
src = fetchFromPypi {
|
||||
src = if isGit then (
|
||||
builtins.fetchGit {
|
||||
inherit (source) url;
|
||||
rev = source.reference;
|
||||
}
|
||||
) else fetchFromPypi {
|
||||
pname = name;
|
||||
inherit (fileInfo) file hash kind;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue