Add Git support

This commit is contained in:
adisbladis 2019-12-27 19:16:55 +00:00
parent 46cc4c74fc
commit 737ed5a372
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7
2 changed files with 18 additions and 5 deletions

View file

@ -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
); );

View file

@ -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;
}; };