poetry2nix: 1.1.0 -> 1.2.0
This commit is contained in:
parent
7fb6e4af36
commit
9dbedf0200
@ -14,7 +14,7 @@ let
|
|||||||
defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; });
|
defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; });
|
||||||
|
|
||||||
mkEvalPep508 = import ./pep508.nix {
|
mkEvalPep508 = import ./pep508.nix {
|
||||||
inherit lib;
|
inherit lib poetryLib;
|
||||||
stdenv = pkgs.stdenv;
|
stdenv = pkgs.stdenv;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -247,6 +247,7 @@ in
|
|||||||
overrideOverlay = fn: self: super: let
|
overrideOverlay = fn: self: super: let
|
||||||
defaultSet = defaultPoetryOverrides self super;
|
defaultSet = defaultPoetryOverrides self super;
|
||||||
customSet = fn self super;
|
customSet = fn self super;
|
||||||
in defaultSet // customSet;
|
in
|
||||||
|
defaultSet // customSet;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
[
|
[
|
||||||
|
"egg",
|
||||||
"tar",
|
"tar",
|
||||||
"tar.bz2",
|
"tar.bz2",
|
||||||
"tar.gz",
|
"tar.gz",
|
||||||
@ -11,4 +12,4 @@
|
|||||||
"txz",
|
"txz",
|
||||||
"whl",
|
"whl",
|
||||||
"zip"
|
"zip"
|
||||||
]
|
]
|
||||||
|
@ -1,6 +1,12 @@
|
|||||||
{ lib, pkgs }:
|
{ lib, pkgs }:
|
||||||
let
|
let
|
||||||
inherit (import ./semver.nix { inherit lib; }) satisfiesSemver;
|
inherit (import ./semver.nix { inherit lib ireplace; }) satisfiesSemver;
|
||||||
|
inherit (builtins) genList length;
|
||||||
|
|
||||||
|
# Replace a list entry at defined index with set value
|
||||||
|
ireplace = idx: value: list: (
|
||||||
|
genList (i: if i == idx then value else (builtins.elemAt list i)) (length list)
|
||||||
|
);
|
||||||
|
|
||||||
# Returns true if pythonVersion matches with the expression in pythonVersions
|
# Returns true if pythonVersion matches with the expression in pythonVersions
|
||||||
isCompatible = pythonVersion: pythonVersions:
|
isCompatible = pythonVersion: pythonVersions:
|
||||||
|
@ -30,8 +30,9 @@
|
|||||||
supportedRegex = ("^.*?(" + builtins.concatStringsSep "|" supportedExtensions + ")");
|
supportedRegex = ("^.*?(" + builtins.concatStringsSep "|" supportedExtensions + ")");
|
||||||
matchesVersion = fname: builtins.match ("^.*" + builtins.replaceStrings [ "." ] [ "\\." ] version + ".*$") fname != null;
|
matchesVersion = fname: builtins.match ("^.*" + builtins.replaceStrings [ "." ] [ "\\." ] version + ".*$") fname != null;
|
||||||
hasSupportedExtension = fname: builtins.match supportedRegex fname != null;
|
hasSupportedExtension = fname: builtins.match supportedRegex fname != null;
|
||||||
|
isCompatibleEgg = fname: ! lib.strings.hasSuffix ".egg" fname || lib.strings.hasSuffix "py${python.pythonVersion}.egg" fname;
|
||||||
in
|
in
|
||||||
builtins.filter (f: matchesVersion f.file && hasSupportedExtension f.file) files;
|
builtins.filter (f: matchesVersion f.file && hasSupportedExtension f.file && isCompatibleEgg f.file) files;
|
||||||
|
|
||||||
toPath = s: pwd + "/${s}";
|
toPath = s: pwd + "/${s}";
|
||||||
|
|
||||||
@ -48,19 +49,35 @@
|
|||||||
|
|
||||||
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 && ! isEgg f;
|
||||||
|
isEgg = f: lib.strings.hasSuffix ".egg" f.file;
|
||||||
|
|
||||||
binaryDist = selectWheel fileCandidates;
|
binaryDist = selectWheel fileCandidates;
|
||||||
sourceDist = builtins.filter isSdist fileCandidates;
|
sourceDist = builtins.filter isSdist fileCandidates;
|
||||||
lockFileEntry = if (builtins.length sourceDist) > 0 then builtins.head sourceDist else builtins.head binaryDist;
|
eggs = builtins.filter isEgg fileCandidates;
|
||||||
|
|
||||||
|
lockFileEntry = builtins.head (sourceDist ++ binaryDist ++ eggs);
|
||||||
|
|
||||||
|
_isEgg = isEgg lockFileEntry;
|
||||||
|
|
||||||
in
|
in
|
||||||
rec {
|
rec {
|
||||||
inherit (lockFileEntry) file hash;
|
inherit (lockFileEntry) file hash;
|
||||||
name = file;
|
name = file;
|
||||||
format = if lib.strings.hasSuffix ".whl" name then "wheel" else "setuptools";
|
format =
|
||||||
kind = if format == "setuptools" then "source" else (builtins.elemAt (lib.strings.splitString "-" name) 2);
|
if _isEgg then "egg"
|
||||||
|
else if lib.strings.hasSuffix ".whl" name then "wheel"
|
||||||
|
else "setuptools";
|
||||||
|
kind =
|
||||||
|
if _isEgg then python.pythonVersion
|
||||||
|
else if format == "setuptools" then "source"
|
||||||
|
else (builtins.elemAt (lib.strings.splitString "-" name) 2);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
baseBuildInputs = lib.optional (name != "setuptools_scm" && name != "setuptools-scm") pythonPackages.setuptools_scm;
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
buildPythonPackage {
|
buildPythonPackage {
|
||||||
pname = name;
|
pname = name;
|
||||||
version = version;
|
version = version;
|
||||||
@ -70,7 +87,7 @@ buildPythonPackage {
|
|||||||
format = if isLocal then "pyproject" else if isGit then "setuptools" else fileInfo.format;
|
format = if isLocal then "pyproject" else if isGit then "setuptools" else fileInfo.format;
|
||||||
|
|
||||||
nativeBuildInputs = if (!isSource && (getManyLinuxDeps fileInfo.name).str != null) then [ autoPatchelfHook ] else [];
|
nativeBuildInputs = if (!isSource && (getManyLinuxDeps fileInfo.name).str != null) then [ autoPatchelfHook ] else [];
|
||||||
buildInputs = if !isSource then (getManyLinuxDeps fileInfo.name).pkg else [];
|
buildInputs = baseBuildInputs ++ (if !isSource then (getManyLinuxDeps fileInfo.name).pkg else []);
|
||||||
|
|
||||||
propagatedBuildInputs =
|
propagatedBuildInputs =
|
||||||
let
|
let
|
||||||
|
@ -7,14 +7,6 @@ self: super:
|
|||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
addSetupTools = drv: if drv == null then null else drv.overrideAttrs (
|
|
||||||
old: {
|
|
||||||
buildInputs = old.buildInputs ++ [
|
|
||||||
self.setuptools_scm
|
|
||||||
];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
getAttrDefault = attribute: set: default:
|
getAttrDefault = attribute: set: default:
|
||||||
if builtins.hasAttr attribute set
|
if builtins.hasAttr attribute set
|
||||||
then builtins.getAttr attribute set
|
then builtins.getAttr attribute set
|
||||||
@ -22,15 +14,6 @@ let
|
|||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
||||||
asciimatics = super.asciimatics.overrideAttrs (
|
|
||||||
old: {
|
|
||||||
buildInputs = old.buildInputs ++ [
|
|
||||||
self.setuptools_scm
|
|
||||||
];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
av = super.av.overrideAttrs (
|
av = super.av.overrideAttrs (
|
||||||
old: {
|
old: {
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||||
@ -60,10 +43,6 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
configparser = addSetupTools super.configparser;
|
|
||||||
|
|
||||||
cbor2 = addSetupTools super.cbor2;
|
|
||||||
|
|
||||||
cryptography = super.cryptography.overrideAttrs (
|
cryptography = super.cryptography.overrideAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [ pkgs.openssl ];
|
buildInputs = old.buildInputs ++ [ pkgs.openssl ];
|
||||||
@ -106,22 +85,6 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
hypothesis = addSetupTools super.hypothesis;
|
|
||||||
|
|
||||||
importlib-metadata = addSetupTools super.importlib-metadata;
|
|
||||||
|
|
||||||
inflect = super.inflect.overrideAttrs (
|
|
||||||
old: {
|
|
||||||
buildInputs = old.buildInputs ++ [
|
|
||||||
self.setuptools_scm
|
|
||||||
];
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
jsonschema = addSetupTools super.jsonschema;
|
|
||||||
|
|
||||||
keyring = addSetupTools super.keyring;
|
|
||||||
|
|
||||||
lap = super.lap.overrideAttrs (
|
lap = super.lap.overrideAttrs (
|
||||||
old: {
|
old: {
|
||||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
||||||
@ -243,7 +206,7 @@ in
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gfortran ];
|
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.gfortran ];
|
||||||
buildInputs = old.buildInputs ++ [ blas ];
|
buildInputs = old.buildInputs ++ [ blas self.cython ];
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
ln -s ${cfg} site.cfg
|
ln -s ${cfg} site.cfg
|
||||||
@ -262,8 +225,6 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
pluggy = addSetupTools super.pluggy;
|
|
||||||
|
|
||||||
psycopg2 = super.psycopg2.overrideAttrs (
|
psycopg2 = super.psycopg2.overrideAttrs (
|
||||||
old: {
|
old: {
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.postgresql ];
|
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.postgresql ];
|
||||||
@ -276,8 +237,6 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
py = addSetupTools super.py;
|
|
||||||
|
|
||||||
pyarrow = super.pyarrow.overrideAttrs (
|
pyarrow = super.pyarrow.overrideAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [
|
buildInputs = old.buildInputs ++ [
|
||||||
@ -334,16 +293,9 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
pytest = addSetupTools super.pytest;
|
|
||||||
|
|
||||||
pytest-mock = addSetupTools super.pytest-mock;
|
|
||||||
|
|
||||||
python-dateutil = addSetupTools super.python-dateutil;
|
|
||||||
|
|
||||||
python-prctl = super.python-prctl.overrideAttrs (
|
python-prctl = super.python-prctl.overrideAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [
|
buildInputs = old.buildInputs ++ [
|
||||||
self.setuptools_scm
|
|
||||||
pkgs.libcap
|
pkgs.libcap
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -380,8 +332,6 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
six = addSetupTools super.six;
|
|
||||||
|
|
||||||
urwidtrees = super.urwidtrees.overrideAttrs (
|
urwidtrees = super.urwidtrees.overrideAttrs (
|
||||||
old: {
|
old: {
|
||||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
||||||
@ -390,7 +340,7 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
# TODO: Figure out getting rid of this hack
|
# Stop infinite recursion by using bootstrapped pkg from nixpkgs
|
||||||
wheel = (
|
wheel = (
|
||||||
pkgs.python3.pkgs.override {
|
pkgs.python3.pkgs.override {
|
||||||
python = self.python;
|
python = self.python;
|
||||||
@ -401,5 +351,4 @@ in
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
zipp = addSetupTools super.zipp;
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{ lib, stdenv }: python:
|
{ lib, stdenv, poetryLib }: python:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
inherit (poetryLib) ireplace;
|
||||||
|
|
||||||
# Like builtins.substring but with stop being offset instead of length
|
# Like builtins.substring but with stop being offset instead of length
|
||||||
substr = start: stop: s: builtins.substring start (stop - start) s;
|
substr = start: stop: s: builtins.substring start (stop - start) s;
|
||||||
@ -142,7 +143,6 @@ let
|
|||||||
else builtins.fromJSON v
|
else builtins.fromJSON v
|
||||||
);
|
);
|
||||||
hasElem = needle: haystack: builtins.elem needle (builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " haystack));
|
hasElem = needle: haystack: builtins.elem needle (builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " haystack));
|
||||||
# TODO: Implement all operators
|
|
||||||
op = {
|
op = {
|
||||||
"<=" = x: y: (unmarshal x) <= (unmarshal y);
|
"<=" = x: y: (unmarshal x) <= (unmarshal y);
|
||||||
"<" = x: y: (unmarshal x) < (unmarshal y);
|
"<" = x: y: (unmarshal x) < (unmarshal y);
|
||||||
@ -150,8 +150,16 @@ let
|
|||||||
"==" = x: y: x == y;
|
"==" = x: y: x == y;
|
||||||
">=" = x: y: (unmarshal x) >= (unmarshal y);
|
">=" = x: y: (unmarshal x) >= (unmarshal y);
|
||||||
">" = x: y: (unmarshal x) > (unmarshal y);
|
">" = x: y: (unmarshal x) > (unmarshal y);
|
||||||
"~=" = null;
|
"~=" = v: c: let
|
||||||
"===" = null;
|
parts = builtins.splitVersion c;
|
||||||
|
pruned = lib.take ((builtins.length parts) - 1) parts;
|
||||||
|
upper = builtins.toString (
|
||||||
|
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
|
||||||
|
);
|
||||||
|
upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
|
||||||
|
in
|
||||||
|
op.">=" v c && op."<" v upperConstraint;
|
||||||
|
"===" = x: y: x == y;
|
||||||
"in" = x: y: let
|
"in" = x: y: let
|
||||||
values = builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " (unmarshal y));
|
values = builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " (unmarshal y));
|
||||||
in
|
in
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
{ lib }:
|
{ lib, ireplace }:
|
||||||
|
|
||||||
let
|
let
|
||||||
inherit (builtins) elemAt match;
|
inherit (builtins) elemAt match;
|
||||||
|
|
||||||
# Replace a list entry at defined index with set value
|
|
||||||
ireplace = idx: value: list: let
|
|
||||||
inherit (builtins) genList length;
|
|
||||||
in
|
|
||||||
genList (i: if i == idx then value else (elemAt list i)) (length list);
|
|
||||||
|
|
||||||
operators = let
|
operators = let
|
||||||
matchWildCard = s: match "([^\*])(\.[\*])" s;
|
matchWildCard = s: match "([^\*])(\.[\*])" s;
|
||||||
mkComparison = ret: version: v: builtins.compareVersions version v == ret;
|
mkComparison = ret: version: v: builtins.compareVersions version v == ret;
|
||||||
@ -37,10 +31,23 @@ let
|
|||||||
">=" = v: c: operators."==" v c || operators.">" v c;
|
">=" = v: c: operators."==" v c || operators.">" v c;
|
||||||
"<=" = v: c: operators."==" v c || operators."<" v c;
|
"<=" = v: c: operators."==" v c || operators."<" v c;
|
||||||
# Semver specific operators
|
# Semver specific operators
|
||||||
"~" = mkIdxComparison 1; #
|
"~" = mkIdxComparison 1;
|
||||||
"^" = mkIdxComparison 0;
|
"^" = mkIdxComparison 0;
|
||||||
|
"~=" = v: c: let
|
||||||
|
# Prune constraint
|
||||||
|
parts = builtins.splitVersion c;
|
||||||
|
pruned = lib.take ((builtins.length parts) - 1) parts;
|
||||||
|
upper = builtins.toString (
|
||||||
|
(lib.toInt (builtins.elemAt pruned (builtins.length pruned - 1))) + 1
|
||||||
|
);
|
||||||
|
upperConstraint = builtins.concatStringsSep "." (ireplace (builtins.length pruned - 1) upper pruned);
|
||||||
|
in
|
||||||
|
operators.">=" v c && operators."<" v upperConstraint;
|
||||||
# Infix operators
|
# Infix operators
|
||||||
"-" = version: v: operators.">=" version v.vl && operators."<=" version v.vu;
|
"-" = version: v: operators.">=" version v.vl && operators."<=" version v.vu;
|
||||||
|
# Arbitrary equality clause, just run simple comparison
|
||||||
|
"===" = v: c: v == c;
|
||||||
|
#
|
||||||
};
|
};
|
||||||
|
|
||||||
re = {
|
re = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user