poetry2nix: 1.6.0 -> 1.6.1
This commit is contained in:
parent
c669d2991b
commit
7401afc428
@ -2,10 +2,8 @@
|
||||
, lib ? pkgs.lib
|
||||
, version
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (pkgs) python3;
|
||||
|
||||
in
|
||||
pkgs.stdenv.mkDerivation {
|
||||
pname = "poetry2nix";
|
||||
|
@ -7,7 +7,7 @@ let
|
||||
inherit (poetryLib) isCompatible readTOML;
|
||||
|
||||
# Poetry2nix version
|
||||
version = "1.6.0";
|
||||
version = "1.6.1";
|
||||
|
||||
/* The default list of poetry2nix override overlays */
|
||||
defaultPoetryOverrides = (import ./overrides.nix { inherit pkgs lib; });
|
||||
@ -34,7 +34,8 @@ let
|
||||
, overrides ? [ defaultPoetryOverrides ]
|
||||
, python ? pkgs.python3
|
||||
, pwd ? projectDir
|
||||
}@attrs: let
|
||||
}@attrs:
|
||||
let
|
||||
poetryPkg = poetry.override { inherit python; };
|
||||
|
||||
pyProject = readTOML pyproject;
|
||||
@ -44,6 +45,7 @@ let
|
||||
specialAttrs = [
|
||||
"overrides"
|
||||
"poetrylock"
|
||||
"projectDir"
|
||||
"pwd"
|
||||
];
|
||||
passedAttrs = builtins.removeAttrs attrs specialAttrs;
|
||||
@ -87,7 +89,8 @@ let
|
||||
overlays = builtins.map getFunctorFn (
|
||||
[
|
||||
(
|
||||
self: super: let
|
||||
self: super:
|
||||
let
|
||||
hooks = self.callPackage ./hooks {};
|
||||
in
|
||||
{
|
||||
@ -153,7 +156,8 @@ let
|
||||
, python ? pkgs.python3
|
||||
, pwd ? projectDir
|
||||
, ...
|
||||
}@attrs: let
|
||||
}@attrs:
|
||||
let
|
||||
poetryPython = mkPoetryPackages {
|
||||
inherit pyproject poetrylock overrides python pwd;
|
||||
};
|
||||
@ -164,19 +168,22 @@ let
|
||||
specialAttrs = [
|
||||
"overrides"
|
||||
"poetrylock"
|
||||
"projectDir"
|
||||
"pwd"
|
||||
"pyproject"
|
||||
];
|
||||
passedAttrs = builtins.removeAttrs attrs specialAttrs;
|
||||
|
||||
# Get dependencies and filter out depending on interpreter version
|
||||
getDeps = depAttr: let
|
||||
getDeps = depAttr:
|
||||
let
|
||||
compat = isCompatible py.pythonVersion;
|
||||
deps = pyProject.tool.poetry.${depAttr} or {};
|
||||
depAttrs = builtins.map (d: lib.toLower d) (builtins.attrNames deps);
|
||||
in
|
||||
builtins.map (
|
||||
dep: let
|
||||
dep:
|
||||
let
|
||||
pkg = py.pkgs."${dep}";
|
||||
constraints = deps.${dep}.python or "";
|
||||
isCompat = compat constraints;
|
||||
@ -191,7 +198,6 @@ let
|
||||
inherit pyProject;
|
||||
pythonPackages = py.pkgs;
|
||||
};
|
||||
|
||||
in
|
||||
py.pkgs.buildPythonApplication (
|
||||
passedAttrs // {
|
||||
@ -222,7 +228,6 @@ let
|
||||
|
||||
/* Poetry2nix CLI used to supplement SHA-256 hashes for git dependencies */
|
||||
cli = import ./cli.nix { inherit pkgs lib version; };
|
||||
|
||||
in
|
||||
{
|
||||
inherit mkPoetryEnv mkPoetryApplication mkPoetryPackages cli version;
|
||||
@ -236,7 +241,8 @@ in
|
||||
*/
|
||||
defaultPoetryOverrides = {
|
||||
__functor = defaultPoetryOverrides;
|
||||
overrideOverlay = fn: self: super: let
|
||||
overrideOverlay = fn: self: super:
|
||||
let
|
||||
defaultSet = defaultPoetryOverrides self super;
|
||||
customSet = fn self super;
|
||||
in
|
||||
|
@ -3,7 +3,6 @@
|
||||
, makeSetupHook
|
||||
, yj
|
||||
}:
|
||||
|
||||
let
|
||||
pythonInterpreter = python.pythonForBuild.interpreter;
|
||||
in
|
||||
|
@ -9,7 +9,8 @@ let
|
||||
);
|
||||
|
||||
# Compare a semver expression with a version
|
||||
isCompatible = version: let
|
||||
isCompatible = version:
|
||||
let
|
||||
operators = {
|
||||
"||" = cond1: cond2: cond1 || cond2;
|
||||
"," = cond1: cond2: cond1 && cond2; # , means &&
|
||||
@ -88,7 +89,8 @@ let
|
||||
getBuildSystemPkgs =
|
||||
{ pythonPackages
|
||||
, pyProject
|
||||
}: let
|
||||
}:
|
||||
let
|
||||
buildSystem = lib.getAttrFromPath [ "build-system" "build-backend" ] pyProject;
|
||||
drvAttr = builtins.elemAt (builtins.split "\\.|:" buildSystem) 0;
|
||||
in
|
||||
@ -97,7 +99,8 @@ let
|
||||
);
|
||||
|
||||
# Find gitignore files recursively in parent directory stopping with .git
|
||||
findGitIgnores = path: let
|
||||
findGitIgnores = path:
|
||||
let
|
||||
parent = path + "/..";
|
||||
gitIgnore = path + "/.gitignore";
|
||||
isGitRoot = builtins.pathExists (path + "/.git");
|
||||
@ -113,7 +116,8 @@ let
|
||||
- Filters pycache/pyc files
|
||||
- Uses cleanSourceFilter to filter out .git/.hg, .o/.so, editor backup files & nix result symlinks
|
||||
*/
|
||||
cleanPythonSources = { src }: let
|
||||
cleanPythonSources = { src }:
|
||||
let
|
||||
gitIgnores = findGitIgnores src;
|
||||
pycacheFilter = name: type:
|
||||
(type == "directory" && ! lib.strings.hasInfix "__pycache__" name)
|
||||
@ -127,7 +131,6 @@ let
|
||||
inherit src;
|
||||
};
|
||||
};
|
||||
|
||||
in
|
||||
{
|
||||
inherit
|
||||
|
@ -22,9 +22,7 @@ pythonPackages.callPackage (
|
||||
{ preferWheel ? false
|
||||
, ...
|
||||
}@args:
|
||||
|
||||
let
|
||||
|
||||
inherit (poetryLib) isCompatible getManyLinuxDeps fetchFromPypi;
|
||||
|
||||
inherit (import ./pep425.nix {
|
||||
@ -68,7 +66,6 @@ pythonPackages.callPackage (
|
||||
lockFileEntry = builtins.head entries;
|
||||
|
||||
_isEgg = isEgg lockFileEntry;
|
||||
|
||||
in
|
||||
rec {
|
||||
inherit (lockFileEntry) file hash;
|
||||
@ -92,7 +89,6 @@ pythonPackages.callPackage (
|
||||
baseBuildInputs = lib.optional (! lib.elem name skipSetupToolsSCM) pythonPackages.setuptools-scm;
|
||||
|
||||
format = if isLocal then "pyproject" else if isGit then "setuptools" else fileInfo.format;
|
||||
|
||||
in
|
||||
|
||||
buildPythonPackage {
|
||||
@ -123,7 +119,8 @@ pythonPackages.callPackage (
|
||||
compat = isCompatible python.pythonVersion;
|
||||
deps = lib.filterAttrs (n: v: v) (
|
||||
lib.mapAttrs (
|
||||
n: v: let
|
||||
n: v:
|
||||
let
|
||||
constraints = v.python or "";
|
||||
in
|
||||
compat constraints
|
||||
|
@ -195,14 +195,14 @@ self: super:
|
||||
);
|
||||
|
||||
matplotlib = super.matplotlib.overrideAttrs (
|
||||
old: let
|
||||
old:
|
||||
let
|
||||
enableGhostscript = old.passthru.enableGhostscript or false;
|
||||
enableGtk3 = old.passthru.enableTk or false;
|
||||
enableQt = old.passthru.enableQt or false;
|
||||
enableTk = old.passthru.enableTk or false;
|
||||
|
||||
inherit (pkgs.darwin.apple_sdk.frameworks) Cocoa;
|
||||
|
||||
in
|
||||
{
|
||||
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${pkgs.libcxx}/include/c++/v1";
|
||||
@ -266,7 +266,8 @@ self: super:
|
||||
);
|
||||
|
||||
numpy = super.numpy.overrideAttrs (
|
||||
old: let
|
||||
old:
|
||||
let
|
||||
blas = old.passthru.args.blas or pkgs.openblasCompat;
|
||||
blasImplementation = lib.nameFromURL blas.name "-";
|
||||
cfg = pkgs.writeTextFile {
|
||||
@ -306,7 +307,8 @@ self: super:
|
||||
);
|
||||
|
||||
peewee = super.peewee.overridePythonAttrs (
|
||||
old: let
|
||||
old:
|
||||
let
|
||||
withPostgres = old.passthru.withPostgres or false;
|
||||
withMysql = old.passthru.withMysql or false;
|
||||
in
|
||||
@ -667,6 +669,7 @@ self: super:
|
||||
);
|
||||
|
||||
zipp =
|
||||
(
|
||||
if lib.versionAtLeast super.zipp.version "2.0.0" then (
|
||||
super.zipp.overridePythonAttrs (
|
||||
old: {
|
||||
@ -677,6 +680,13 @@ self: super:
|
||||
'';
|
||||
}
|
||||
)
|
||||
) else super.zipp;
|
||||
) else super.zipp
|
||||
).overridePythonAttrs (
|
||||
old: {
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
||||
self.toml
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ lib, stdenv, python, isLinux ? stdenv.isLinux }:
|
||||
|
||||
let
|
||||
inherit (lib.strings) hasSuffix hasInfix splitString removeSuffix;
|
||||
|
||||
@ -94,12 +93,10 @@ let
|
||||
if isLinux
|
||||
then chooseLinux files
|
||||
else chooseOSX files;
|
||||
|
||||
in
|
||||
if (builtins.length filtered == 0)
|
||||
then []
|
||||
else choose (filtered);
|
||||
|
||||
in
|
||||
{
|
||||
inherit selectWheel toWheelAttrs isPyVersionCompatible;
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ lib, stdenv, poetryLib }: python:
|
||||
|
||||
let
|
||||
inherit (poetryLib) ireplace;
|
||||
|
||||
@ -37,7 +36,8 @@ let
|
||||
);
|
||||
|
||||
# Make a tree out of expression groups (parens)
|
||||
findSubExpressions = expr: let
|
||||
findSubExpressions = expr:
|
||||
let
|
||||
acc = builtins.foldl' findSubExpressionsFun {
|
||||
exprs = [];
|
||||
expr = expr;
|
||||
@ -51,7 +51,8 @@ let
|
||||
in
|
||||
acc.exprs ++ tailExprs;
|
||||
|
||||
parseExpressions = exprs: let
|
||||
parseExpressions = exprs:
|
||||
let
|
||||
splitCond = (
|
||||
s: builtins.map
|
||||
(x: stripStr (if builtins.typeOf x == "list" then (builtins.elemAt x 0) else x))
|
||||
@ -71,7 +72,6 @@ let
|
||||
);
|
||||
|
||||
parse = expr: builtins.filter (x: x != null) (builtins.map mapfn (splitCond expr));
|
||||
|
||||
in
|
||||
builtins.foldl' (
|
||||
acc: v: acc ++ (
|
||||
@ -81,7 +81,8 @@ let
|
||||
|
||||
# Transform individual expressions to structured expressions
|
||||
# This function also performs variable substitution, replacing environment markers with their explicit values
|
||||
transformExpressions = exprs: let
|
||||
transformExpressions = exprs:
|
||||
let
|
||||
variables = {
|
||||
os_name = (
|
||||
if python.pname == "jython" then "java"
|
||||
@ -121,7 +122,6 @@ let
|
||||
stripStr
|
||||
substituteVar
|
||||
];
|
||||
|
||||
in
|
||||
if builtins.typeOf exprs == "set" then (
|
||||
if exprs.type == "expr" then (
|
||||
@ -145,7 +145,8 @@ let
|
||||
) else builtins.map transformExpressions exprs;
|
||||
|
||||
# Recursively eval all expressions
|
||||
evalExpressions = exprs: let
|
||||
evalExpressions = exprs:
|
||||
let
|
||||
unmarshal = v: (
|
||||
# TODO: Handle single quoted values
|
||||
if v == "True" then true
|
||||
@ -160,7 +161,8 @@ let
|
||||
"==" = x: y: x == y;
|
||||
">=" = x: y: (unmarshal x) >= (unmarshal y);
|
||||
">" = x: y: (unmarshal x) > (unmarshal y);
|
||||
"~=" = v: c: let
|
||||
"~=" = v: c:
|
||||
let
|
||||
parts = builtins.splitVersion c;
|
||||
pruned = lib.take ((builtins.length parts) - 1) parts;
|
||||
upper = builtins.toString (
|
||||
@ -170,7 +172,8 @@ let
|
||||
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));
|
||||
in
|
||||
builtins.elem (unmarshal x) values;
|
||||
@ -190,7 +193,8 @@ let
|
||||
) else builtins.map evalExpressions exprs;
|
||||
|
||||
# Now that we have performed an eval all that's left to do is to concat the graph into a single bool
|
||||
reduceExpressions = exprs: let
|
||||
reduceExpressions = exprs:
|
||||
let
|
||||
cond = {
|
||||
"and" = x: y: x && y;
|
||||
"or" = x: y: x || y;
|
||||
@ -225,7 +229,6 @@ let
|
||||
cond = "and";
|
||||
} exprs
|
||||
).value;
|
||||
|
||||
in
|
||||
e: builtins.foldl' (acc: v: v acc) e [
|
||||
findSubExpressions
|
||||
|
@ -1,18 +1,19 @@
|
||||
{ lib, ireplace }:
|
||||
|
||||
let
|
||||
inherit (builtins) elemAt match;
|
||||
|
||||
operators = let
|
||||
matchWildCard = s: match "([^\*])(\.[\*])" s;
|
||||
mkComparison = ret: version: v: builtins.compareVersions version v == ret;
|
||||
mkIdxComparison = idx: version: v: let
|
||||
mkIdxComparison = idx: version: v:
|
||||
let
|
||||
ver = builtins.splitVersion v;
|
||||
minor = builtins.toString (lib.toInt (elemAt ver idx) + 1);
|
||||
upper = builtins.concatStringsSep "." (ireplace idx minor ver);
|
||||
in
|
||||
operators.">=" version v && operators."<" version upper;
|
||||
dropWildcardPrecision = f: version: constraint: let
|
||||
dropWildcardPrecision = f: version: constraint:
|
||||
let
|
||||
m = matchWildCard constraint;
|
||||
hasWildcard = m != null;
|
||||
c = if hasWildcard then (elemAt m 0) else constraint;
|
||||
@ -33,7 +34,8 @@ let
|
||||
# Semver specific operators
|
||||
"~" = mkIdxComparison 1;
|
||||
"^" = mkIdxComparison 0;
|
||||
"~=" = v: c: let
|
||||
"~=" = v: c:
|
||||
let
|
||||
# Prune constraint
|
||||
parts = builtins.splitVersion c;
|
||||
pruned = lib.take ((builtins.length parts) - 1) parts;
|
||||
@ -55,7 +57,8 @@ let
|
||||
version = "([0-9\.\*x]+)";
|
||||
};
|
||||
|
||||
parseConstraint = constraint: let
|
||||
parseConstraint = constraint:
|
||||
let
|
||||
constraintStr = builtins.replaceStrings [ " " ] [ "" ] constraint;
|
||||
# The common prefix operators
|
||||
mPre = match "${re.operators} *${re.version}" constraintStr;
|
||||
@ -78,10 +81,10 @@ let
|
||||
else throw "Constraint \"${constraintStr}\" could not be parsed"
|
||||
);
|
||||
|
||||
satisfiesSemver = version: constraint: let
|
||||
satisfiesSemver = version: constraint:
|
||||
let
|
||||
inherit (parseConstraint constraint) op v;
|
||||
in
|
||||
if constraint == "*" then true else operators."${op}" version v;
|
||||
|
||||
in
|
||||
{ inherit satisfiesSemver; }
|
||||
|
Loading…
Reference in New Issue
Block a user