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

View file

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