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