poetry2nix: 1.12.0 -> 1.13.0
This commit is contained in:
parent
e6ec27be98
commit
0eeedc732c
|
@ -20,11 +20,58 @@ let
|
|||
|
||||
# Experimental withPlugins functionality
|
||||
toPluginAble = (import ./plugins.nix { inherit pkgs lib; }).toPluginAble;
|
||||
|
||||
mkInputAttrs =
|
||||
{ py
|
||||
, pyProject
|
||||
, attrs
|
||||
, includeBuildSystem ? true
|
||||
}:
|
||||
let
|
||||
getInputs = attr: attrs.${attr} or [ ];
|
||||
|
||||
# Get dependencies and filter out depending on interpreter version
|
||||
getDeps = depAttr:
|
||||
let
|
||||
compat = isCompatible (poetryLib.getPythonVersion py);
|
||||
deps = pyProject.tool.poetry.${depAttr} or { };
|
||||
depAttrs = builtins.map (d: lib.toLower d) (builtins.attrNames deps);
|
||||
in
|
||||
(
|
||||
builtins.map
|
||||
(
|
||||
dep:
|
||||
let
|
||||
pkg = py.pkgs."${moduleName dep}";
|
||||
constraints = deps.${dep}.python or "";
|
||||
isCompat = compat constraints;
|
||||
in
|
||||
if isCompat then pkg else null
|
||||
)
|
||||
depAttrs
|
||||
);
|
||||
|
||||
buildSystemPkgs = poetryLib.getBuildSystemPkgs {
|
||||
inherit pyProject;
|
||||
pythonPackages = py.pkgs;
|
||||
};
|
||||
|
||||
mkInput = attr: extraInputs: getInputs attr ++ extraInputs;
|
||||
|
||||
in
|
||||
{
|
||||
buildInputs = mkInput "buildInputs" (if includeBuildSystem then buildSystemPkgs else [ ]);
|
||||
propagatedBuildInputs = mkInput "propagatedBuildInputs" (getDeps "dependencies") ++ ([ py.pkgs.setuptools ]);
|
||||
nativeBuildInputs = mkInput "nativeBuildInputs" [ ];
|
||||
checkInputs = mkInput "checkInputs" (getDeps "dev-dependencies");
|
||||
};
|
||||
|
||||
|
||||
in
|
||||
lib.makeScope pkgs.newScope (self: {
|
||||
|
||||
# Poetry2nix version
|
||||
version = "1.12.0";
|
||||
version = "1.13.0";
|
||||
|
||||
/*
|
||||
Returns an attrset { python, poetryPackages, pyProject, poetryLock } for the given pyproject/lockfile.
|
||||
|
@ -61,7 +108,7 @@ lib.makeScope pkgs.newScope (self: {
|
|||
# Filter packages by their PEP508 markers & pyproject interpreter version
|
||||
partitions =
|
||||
let
|
||||
supportsPythonVersion = pkgMeta: if pkgMeta ? marker then (evalPep508 pkgMeta.marker) else true;
|
||||
supportsPythonVersion = pkgMeta: if pkgMeta ? marker then (evalPep508 pkgMeta.marker) else true && isCompatible (poetryLib.getPythonVersion python) pkgMeta.python-versions;
|
||||
in
|
||||
lib.partition supportsPythonVersion poetryLock.package;
|
||||
compatible = partitions.right;
|
||||
|
@ -91,7 +138,7 @@ lib.makeScope pkgs.newScope (self: {
|
|||
);
|
||||
}
|
||||
)
|
||||
compatible
|
||||
(lib.reverseList compatible)
|
||||
);
|
||||
in
|
||||
lockPkgs;
|
||||
|
@ -106,9 +153,13 @@ lib.makeScope pkgs.newScope (self: {
|
|||
in
|
||||
{
|
||||
mkPoetryDep = self.callPackage ./mk-poetry-dep.nix {
|
||||
inherit pkgs lib python poetryLib;
|
||||
inherit pkgs lib python poetryLib evalPep508;
|
||||
};
|
||||
poetry = poetryPkg;
|
||||
|
||||
# Use poetry-core from the poetry build (pep517/518 build-system)
|
||||
poetry-core = if __isBootstrap then null else poetryPkg.passthru.python.pkgs.poetry-core;
|
||||
poetry = if __isBootstrap then null else poetryPkg;
|
||||
|
||||
# The canonical name is setuptools-scm
|
||||
setuptools-scm = super.setuptools_scm;
|
||||
|
||||
|
@ -126,10 +177,13 @@ lib.makeScope pkgs.newScope (self: {
|
|||
);
|
||||
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) overlays;
|
||||
py = python.override { inherit packageOverrides; self = py; };
|
||||
|
||||
inputAttrs = mkInputAttrs { inherit py pyProject; attrs = { }; includeBuildSystem = false; };
|
||||
|
||||
in
|
||||
{
|
||||
python = py;
|
||||
poetryPackages = map (pkg: py.pkgs.${moduleName pkg.name}) compatible;
|
||||
poetryPackages = builtins.foldl' (acc: v: acc ++ v) [ ] (lib.attrValues inputAttrs);
|
||||
poetryLock = poetryLock;
|
||||
inherit pyProject;
|
||||
};
|
||||
|
@ -219,32 +273,12 @@ lib.makeScope pkgs.newScope (self: {
|
|||
];
|
||||
passedAttrs = builtins.removeAttrs attrs specialAttrs;
|
||||
|
||||
# Get dependencies and filter out depending on interpreter version
|
||||
getDeps = depAttr:
|
||||
let
|
||||
compat = isCompatible (poetryLib.getPythonVersion py);
|
||||
deps = pyProject.tool.poetry.${depAttr} or { };
|
||||
depAttrs = builtins.map (d: lib.toLower d) (builtins.attrNames deps);
|
||||
in
|
||||
builtins.map
|
||||
(
|
||||
dep:
|
||||
let
|
||||
pkg = py.pkgs."${moduleName dep}";
|
||||
constraints = deps.${dep}.python or "";
|
||||
isCompat = compat constraints;
|
||||
in
|
||||
if isCompat then pkg else null
|
||||
)
|
||||
depAttrs;
|
||||
getInputs = attr: attrs.${attr} or [ ];
|
||||
mkInput = attr: extraInputs: getInputs attr ++ extraInputs;
|
||||
buildSystemPkgs = poetryLib.getBuildSystemPkgs {
|
||||
inherit pyProject;
|
||||
pythonPackages = py.pkgs;
|
||||
};
|
||||
inputAttrs = mkInputAttrs { inherit py pyProject attrs; };
|
||||
|
||||
app = py.pkgs.buildPythonPackage (
|
||||
passedAttrs // {
|
||||
passedAttrs // inputAttrs // {
|
||||
nativeBuildInputs = inputAttrs.nativeBuildInputs ++ [ py.pkgs.removePathDependenciesHook ];
|
||||
} // {
|
||||
pname = moduleName pyProject.tool.poetry.name;
|
||||
version = pyProject.tool.poetry.version;
|
||||
|
||||
|
@ -256,11 +290,6 @@ lib.makeScope pkgs.newScope (self: {
|
|||
# provides python modules
|
||||
namePrefix = "";
|
||||
|
||||
buildInputs = mkInput "buildInputs" buildSystemPkgs;
|
||||
propagatedBuildInputs = mkInput "propagatedBuildInputs" (getDeps "dependencies") ++ ([ py.pkgs.setuptools ]);
|
||||
nativeBuildInputs = mkInput "nativeBuildInputs" [ pkgs.yj py.pkgs.removePathDependenciesHook ];
|
||||
checkInputs = mkInput "checkInputs" (getDeps "dev-dependencies");
|
||||
|
||||
passthru = {
|
||||
python = py;
|
||||
dependencyEnv = (
|
||||
|
@ -274,7 +303,8 @@ lib.makeScope pkgs.newScope (self: {
|
|||
) { inherit app; };
|
||||
};
|
||||
|
||||
meta = lib.optionalAttrs (lib.hasAttr "description" pyProject.tool.poetry) {
|
||||
meta = lib.optionalAttrs (lib.hasAttr "description" pyProject.tool.poetry)
|
||||
{
|
||||
inherit (pyProject.tool.poetry) description;
|
||||
} // lib.optionalAttrs (lib.hasAttr "homepage" pyProject.tool.poetry) {
|
||||
inherit (pyProject.tool.poetry) homepage;
|
||||
|
|
|
@ -35,7 +35,8 @@ let
|
|||
# See https://docs.python.org/3.8/library/site.html for info on such .pth files
|
||||
# These add another site package path for each line
|
||||
touch poetry2nix-editable.pth
|
||||
${lib.concatMapStringsSep "\n" (src: ''
|
||||
${lib.concatMapStringsSep "\n"
|
||||
(src: ''
|
||||
echo "${toString src}" >> poetry2nix-editable.pth
|
||||
'')
|
||||
(lib.attrValues editablePackageSources)}
|
||||
|
|
|
@ -24,7 +24,8 @@ in
|
|||
pyprojectPatchScript = "${./pyproject-without-path.py}";
|
||||
};
|
||||
} ./remove-path-dependencies.sh
|
||||
) { };
|
||||
)
|
||||
{ };
|
||||
|
||||
pipBuildHook = callPackage
|
||||
(
|
||||
|
@ -37,7 +38,8 @@ in
|
|||
inherit pythonInterpreter pythonSitePackages;
|
||||
};
|
||||
} ./pip-build-hook.sh
|
||||
) { };
|
||||
)
|
||||
{ };
|
||||
|
||||
poetry2nixFixupHook = callPackage
|
||||
(
|
||||
|
@ -47,7 +49,8 @@ in
|
|||
name = "fixup-hook.sh";
|
||||
deps = [ ];
|
||||
} ./fixup-hook.sh
|
||||
) { };
|
||||
)
|
||||
{ };
|
||||
|
||||
# When the "wheel" package itself is a wheel the nixpkgs hook (which pulls in "wheel") leads to infinite recursion
|
||||
# It doesn't _really_ depend on wheel though, it just copies the wheel.
|
||||
|
@ -58,7 +61,8 @@ in
|
|||
name = "wheel-unpack-hook.sh";
|
||||
deps = [ ];
|
||||
} ./wheel-unpack-hook.sh
|
||||
) { };
|
||||
)
|
||||
{ };
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -156,12 +156,10 @@ let
|
|||
let
|
||||
missingBuildBackendError = "No build-system.build-backend section in pyproject.toml. "
|
||||
+ "Add such a section as described in https://python-poetry.org/docs/pyproject/#poetry-and-pep-517";
|
||||
buildSystem = lib.attrByPath [ "build-system" "build-backend" ] (throw missingBuildBackendError) pyProject;
|
||||
drvAttr = moduleName (builtins.elemAt (builtins.split "\\.|:" buildSystem) 0);
|
||||
requires = lib.attrByPath [ "build-system" "requires" ] (throw missingBuildBackendError) pyProject;
|
||||
requiredPkgs = builtins.map (n: lib.elemAt (builtins.match "([^!=<>~\[]+).*" n) 0) requires;
|
||||
in
|
||||
if buildSystem == "" then [ ] else (
|
||||
[ pythonPackages.${drvAttr} or (throw "unsupported build system ${buildSystem}") ]
|
||||
);
|
||||
builtins.map (drvAttr: pythonPackages.${drvAttr} or (throw "unsupported build system requirement ${drvAttr}")) requiredPkgs;
|
||||
|
||||
# Find gitignore files recursively in parent directory stopping with .git
|
||||
findGitIgnores = path:
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
, lib
|
||||
, python
|
||||
, buildPythonPackage
|
||||
, pythonPackages
|
||||
, poetryLib
|
||||
, evalPep508
|
||||
}:
|
||||
{ name
|
||||
, version
|
||||
|
@ -53,7 +53,9 @@ pythonPackages.callPackage
|
|||
pyProjectPath = localDepPath + "/pyproject.toml";
|
||||
pyProject = poetryLib.readTOML pyProjectPath;
|
||||
in
|
||||
if builtins.pathExists pyProjectPath then poetryLib.getBuildSystemPkgs {
|
||||
if builtins.pathExists pyProjectPath then
|
||||
poetryLib.getBuildSystemPkgs
|
||||
{
|
||||
inherit pythonPackages pyProject;
|
||||
} else [ ];
|
||||
|
||||
|
@ -127,8 +129,9 @@ pythonPackages.callPackage
|
|||
n: v:
|
||||
let
|
||||
constraints = v.python or "";
|
||||
pep508Markers = v.markers or "";
|
||||
in
|
||||
compat constraints
|
||||
compat constraints && evalPep508 pep508Markers
|
||||
)
|
||||
dependencies
|
||||
);
|
||||
|
@ -150,15 +153,18 @@ pythonPackages.callPackage
|
|||
# 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 =
|
||||
if isGit then (
|
||||
if isGit then
|
||||
(
|
||||
builtins.fetchGit {
|
||||
inherit (source) url;
|
||||
rev = source.reference;
|
||||
ref = sourceSpec.branch or sourceSpec.rev or sourceSpec.tag or "HEAD";
|
||||
}
|
||||
) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else fetchFromPypi {
|
||||
) else if isLocal then (poetryLib.cleanPythonSources { src = localDepPath; }) else
|
||||
fetchFromPypi {
|
||||
pname = name;
|
||||
inherit (fileInfo) file hash kind;
|
||||
};
|
||||
}
|
||||
) { }
|
||||
)
|
||||
{ }
|
||||
|
|
|
@ -68,9 +68,29 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
cairocffi = super.cairocffi.overridePythonAttrs (
|
||||
old: {
|
||||
inherit (pkgs.python3.pkgs.cairocffi) patches;
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
}
|
||||
);
|
||||
|
||||
cairosvg = super.cairosvg.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
}
|
||||
);
|
||||
|
||||
cssselect2 = super.cssselect2.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
}
|
||||
);
|
||||
|
||||
cffi =
|
||||
# cffi is bundled with pypy
|
||||
if self.python.implementation == "pypy" then null else (
|
||||
if self.python.implementation == "pypy" then null else
|
||||
(
|
||||
super.cffi.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ pkgs.libffi ];
|
||||
|
@ -104,6 +124,13 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
dictdiffer = super.dictdiffer.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [ self.setuptools ];
|
||||
}
|
||||
);
|
||||
|
||||
django = (
|
||||
super.django.overridePythonAttrs (
|
||||
old: {
|
||||
|
@ -139,6 +166,24 @@ self: super:
|
|||
# Environment markers are not always included (depending on how a dep was defined)
|
||||
enum34 = if self.pythonAtLeast "3.4" then null else super.enum34;
|
||||
|
||||
eth-hash = super.eth-hash.overridePythonAttrs {
|
||||
preConfigure = ''
|
||||
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
|
||||
'';
|
||||
};
|
||||
|
||||
eth-keyfile = super.eth-keyfile.overridePythonAttrs {
|
||||
preConfigure = ''
|
||||
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
|
||||
'';
|
||||
};
|
||||
|
||||
eth-keys = super.eth-keys.overridePythonAttrs {
|
||||
preConfigure = ''
|
||||
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
|
||||
'';
|
||||
};
|
||||
|
||||
faker = super.faker.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
|
@ -272,6 +317,19 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
# disable the removal of pyproject.toml, required because of setuptools_scm
|
||||
jaraco-functools = super.jaraco-functools.overridePythonAttrs (
|
||||
old: {
|
||||
dontPreferSetupPy = true;
|
||||
}
|
||||
);
|
||||
|
||||
jsonpickle = super.jsonpickle.overridePythonAttrs (
|
||||
old: {
|
||||
dontPreferSetupPy = true;
|
||||
}
|
||||
);
|
||||
|
||||
jupyter = super.jupyter.overridePythonAttrs (
|
||||
old: rec {
|
||||
# jupyter is a meta-package. Everything relevant comes from the
|
||||
|
@ -281,6 +339,17 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
keyring = super.keyring.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
self.toml
|
||||
];
|
||||
postPatch = ''
|
||||
substituteInPlace setup.py --replace 'setuptools.setup()' 'setuptools.setup(version="${old.version}")'
|
||||
'';
|
||||
}
|
||||
);
|
||||
|
||||
kiwisolver = super.kiwisolver.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
|
@ -408,7 +477,8 @@ self: super:
|
|||
);
|
||||
|
||||
molecule =
|
||||
if lib.versionOlder super.molecule.version "3.0.0" then (super.molecule.overridePythonAttrs (
|
||||
if lib.versionOlder super.molecule.version "3.0.0" then
|
||||
(super.molecule.overridePythonAttrs (
|
||||
old: {
|
||||
patches = (old.patches or [ ]) ++ [
|
||||
# Fix build with more recent setuptools versions
|
||||
|
@ -420,10 +490,21 @@ self: super:
|
|||
];
|
||||
buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ];
|
||||
}
|
||||
)) else super.molecule.overridePythonAttrs (old: {
|
||||
)) else
|
||||
super.molecule.overridePythonAttrs (old: {
|
||||
buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ];
|
||||
});
|
||||
|
||||
mongomock = super.mongomock.overridePythonAttrs (oa: {
|
||||
buildInputs = oa.buildInputs ++ [ self.pbr ];
|
||||
});
|
||||
|
||||
multiaddr = super.multiaddr.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
}
|
||||
);
|
||||
|
||||
netcdf4 = super.netcdf4.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [
|
||||
|
@ -456,7 +537,8 @@ self: super:
|
|||
name = "site.cfg";
|
||||
text = (
|
||||
lib.generators.toINI
|
||||
{ } {
|
||||
{ }
|
||||
{
|
||||
${blasImplementation} = {
|
||||
include_dirs = "${blas}/include";
|
||||
library_dirs = "${blas}/lib";
|
||||
|
@ -516,6 +598,29 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
poetry-core = super.poetry-core.overridePythonAttrs (old: {
|
||||
# "Vendor" dependencies (for build-system support)
|
||||
postPatch = ''
|
||||
echo "import sys" >> poetry/__init__.py
|
||||
for path in ''${PYTHONPATH//:/ }; do echo $path; done | uniq | while read path; do
|
||||
echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
|
||||
done
|
||||
'';
|
||||
|
||||
# Propagating dependencies leads to issues downstream
|
||||
# We've already patched poetry to prefer "vendored" dependencies
|
||||
postFixup = ''
|
||||
rm $out/nix-support/propagated-build-inputs
|
||||
'';
|
||||
});
|
||||
|
||||
# disable the removal of pyproject.toml, required because of setuptools_scm
|
||||
portend = super.portend.overridePythonAttrs (
|
||||
old: {
|
||||
dontPreferSetupPy = true;
|
||||
}
|
||||
);
|
||||
|
||||
psycopg2 = super.psycopg2.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs
|
||||
|
@ -533,7 +638,9 @@ self: super:
|
|||
);
|
||||
|
||||
pyarrow =
|
||||
if lib.versionAtLeast super.pyarrow.version "0.16.0" then super.pyarrow.overridePythonAttrs (
|
||||
if lib.versionAtLeast super.pyarrow.version "0.16.0" then
|
||||
super.pyarrow.overridePythonAttrs
|
||||
(
|
||||
old:
|
||||
let
|
||||
parseMinor = drv: lib.concatStringsSep "." (lib.take 2 (lib.splitVersion drv.version));
|
||||
|
@ -542,7 +649,8 @@ self: super:
|
|||
# instead of "python". Below we inspect function arguments to maintain compatibilitiy.
|
||||
_arrow-cpp = pkgs.arrow-cpp.override (
|
||||
builtins.intersectAttrs
|
||||
(lib.functionArgs pkgs.arrow-cpp.override) { python = self.python; python3 = self.python; }
|
||||
(lib.functionArgs pkgs.arrow-cpp.override)
|
||||
{ python = self.python; python3 = self.python; }
|
||||
);
|
||||
|
||||
ARROW_HOME = _arrow-cpp;
|
||||
|
@ -581,7 +689,8 @@ self: super:
|
|||
|
||||
dontUseCmakeConfigure = true;
|
||||
}
|
||||
) else super.pyarrow.overridePythonAttrs (
|
||||
) else
|
||||
super.pyarrow.overridePythonAttrs (
|
||||
old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||
self.cython
|
||||
|
@ -653,12 +762,14 @@ self: super:
|
|||
-e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \
|
||||
-e "/\/include\/smpeg/d" \
|
||||
-i buildconfig/config_unix.py
|
||||
${lib.concatMapStrings (dep: ''
|
||||
${lib.concatMapStrings
|
||||
(dep: ''
|
||||
sed \
|
||||
-e "/origincdirs =/a\ origincdirs += ['${lib.getDev dep}/include']" \
|
||||
-e "/origlibdirs =/a\ origlibdirs += ['${lib.getLib dep}/lib']" \
|
||||
-i buildconfig/config_unix.py
|
||||
'') buildInputs
|
||||
'')
|
||||
buildInputs
|
||||
}
|
||||
LOCALBASE=/ ${self.python.interpreter} buildconfig/config.py
|
||||
'';
|
||||
|
@ -884,6 +995,12 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
rlp = super.rlp.overridePythonAttrs {
|
||||
preConfigure = ''
|
||||
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
|
||||
'';
|
||||
};
|
||||
|
||||
scipy = super.scipy.overridePythonAttrs (
|
||||
old:
|
||||
if old.format != "wheel" then {
|
||||
|
@ -927,7 +1044,8 @@ self: super:
|
|||
);
|
||||
|
||||
shellingham =
|
||||
if lib.versionAtLeast super.shellingham.version "1.3.2" then (
|
||||
if lib.versionAtLeast super.shellingham.version "1.3.2" then
|
||||
(
|
||||
super.shellingham.overridePythonAttrs (
|
||||
old: {
|
||||
format = "pyproject";
|
||||
|
@ -943,6 +1061,13 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
# disable the removal of pyproject.toml, required because of setuptools_scm
|
||||
tempora = super.tempora.overridePythonAttrs (
|
||||
old: {
|
||||
dontPreferSetupPy = true;
|
||||
}
|
||||
);
|
||||
|
||||
tensorflow = super.tensorflow.overridePythonAttrs (
|
||||
old: {
|
||||
postInstall = ''
|
||||
|
@ -959,6 +1084,12 @@ self: super:
|
|||
}
|
||||
);
|
||||
|
||||
tinycss2 = super.tinycss2.overridePythonAttrs (
|
||||
old: {
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
}
|
||||
);
|
||||
|
||||
# nix uses a dash, poetry uses an underscore
|
||||
typing_extensions = super.typing_extensions or self.typing-extensions;
|
||||
|
||||
|
@ -1004,6 +1135,20 @@ self: super:
|
|||
python = self.python;
|
||||
}).wheel;
|
||||
};
|
||||
|
||||
weasyprint = super.weasyprint.overridePythonAttrs (
|
||||
old: {
|
||||
inherit (pkgs.python3.pkgs.weasyprint) patches;
|
||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
||||
}
|
||||
);
|
||||
|
||||
web3 = super.web3.overridePythonAttrs {
|
||||
preConfigure = ''
|
||||
substituteInPlace setup.py --replace \'setuptools-markdown\' ""
|
||||
'';
|
||||
};
|
||||
|
||||
wheel =
|
||||
let
|
||||
isWheel = super.wheel.src.isWheel or false;
|
||||
|
@ -1026,9 +1171,10 @@ self: super:
|
|||
in
|
||||
if isWheel then wheelPackage else sourcePackage;
|
||||
|
||||
zipp =
|
||||
zipp = if super.zipp == null then null else
|
||||
(
|
||||
if lib.versionAtLeast super.zipp.version "2.0.0" then
|
||||
(
|
||||
if lib.versionAtLeast super.zipp.version "2.0.0" then (
|
||||
super.zipp.overridePythonAttrs (
|
||||
old: {
|
||||
prePatch = ''
|
||||
|
|
|
@ -71,7 +71,8 @@ let
|
|||
withPython = ver: abi: x: (isPyVersionCompatible ver x.pyVer) && (isPyAbiCompatible abi x.abi);
|
||||
withPlatform =
|
||||
if isLinux
|
||||
then (
|
||||
then
|
||||
(
|
||||
x: x.platform == "manylinux1_${stdenv.platform.kernelArch}"
|
||||
|| x.platform == "manylinux2010_${stdenv.platform.kernelArch}"
|
||||
|| x.platform == "manylinux2014_${stdenv.platform.kernelArch}"
|
||||
|
|
|
@ -8,7 +8,8 @@ let
|
|||
# Strip leading/trailing whitespace from string
|
||||
stripStr = s: lib.elemAt (builtins.split "^ *" (lib.elemAt (builtins.split " *$" s) 0)) 2;
|
||||
findSubExpressionsFun = acc: c: (
|
||||
if c == "(" then (
|
||||
if c == "(" then
|
||||
(
|
||||
let
|
||||
posNew = acc.pos + 1;
|
||||
isOpen = acc.openP == 0;
|
||||
|
@ -20,7 +21,8 @@ let
|
|||
pos = posNew;
|
||||
openP = acc.openP + 1;
|
||||
}
|
||||
) else if c == ")" then (
|
||||
) else if c == ")" then
|
||||
(
|
||||
let
|
||||
openP = acc.openP - 1;
|
||||
exprs = findSubExpressions (substr acc.startPos acc.pos acc.expr);
|
||||
|
@ -35,8 +37,9 @@ let
|
|||
);
|
||||
|
||||
# Make a tree out of expression groups (parens)
|
||||
findSubExpressions = expr:
|
||||
findSubExpressions = expr':
|
||||
let
|
||||
expr = " " + expr';
|
||||
acc = builtins.foldl'
|
||||
findSubExpressionsFun
|
||||
{
|
||||
|
@ -113,7 +116,7 @@ let
|
|||
python_full_version = python.version;
|
||||
implementation_name = python.implementation;
|
||||
implementation_version = python.version;
|
||||
extra = "";
|
||||
# extra = "";
|
||||
};
|
||||
substituteVar = value: if builtins.hasAttr value variables then (builtins.toJSON variables."${value}") else value;
|
||||
processVar = value: builtins.foldl' (acc: v: v acc) value [
|
||||
|
@ -121,22 +124,24 @@ let
|
|||
substituteVar
|
||||
];
|
||||
in
|
||||
if builtins.typeOf exprs == "set" then (
|
||||
if exprs.type == "expr" then (
|
||||
if builtins.typeOf exprs == "set" then
|
||||
(
|
||||
if exprs.type == "expr" then
|
||||
(
|
||||
let
|
||||
mVal = ''[a-zA-Z0-9\'"_\. ]+'';
|
||||
mOp = "in|[!=<>]+";
|
||||
e = stripStr exprs.value;
|
||||
m = builtins.map stripStr (builtins.match ''^(${mVal}) *(${mOp}) *(${mVal})$'' e);
|
||||
m0 = processVar (builtins.elemAt m 0);
|
||||
m2 = processVar (builtins.elemAt m 2);
|
||||
in
|
||||
{
|
||||
type = "expr";
|
||||
value = {
|
||||
op = builtins.elemAt m 1;
|
||||
values = [
|
||||
(processVar (builtins.elemAt m 0))
|
||||
(processVar (builtins.elemAt m 2))
|
||||
];
|
||||
# HACK: We don't know extra at eval time, so we assume the expression is always true
|
||||
op = if m0 == "extra" then "true" else builtins.elemAt m 1;
|
||||
values = [ m0 m2 ];
|
||||
};
|
||||
}
|
||||
) else exprs
|
||||
|
@ -153,6 +158,7 @@ let
|
|||
);
|
||||
hasElem = needle: haystack: builtins.elem needle (builtins.filter (x: builtins.typeOf x == "string") (builtins.split " " haystack));
|
||||
op = {
|
||||
"true" = x: y: true;
|
||||
"<=" = x: y: (unmarshal x) <= (unmarshal y);
|
||||
"<" = x: y: (unmarshal x) < (unmarshal y);
|
||||
"!=" = x: y: x != y;
|
||||
|
@ -177,8 +183,10 @@ let
|
|||
builtins.elem (unmarshal x) values;
|
||||
};
|
||||
in
|
||||
if builtins.typeOf exprs == "set" then (
|
||||
if exprs.type == "expr" then (
|
||||
if builtins.typeOf exprs == "set" then
|
||||
(
|
||||
if exprs.type == "expr" then
|
||||
(
|
||||
let
|
||||
expr = exprs;
|
||||
result = (op."${expr.value.op}") (builtins.elemAt expr.value.values 0) (builtins.elemAt expr.value.values 1);
|
||||
|
@ -198,17 +206,21 @@ let
|
|||
"or" = x: y: x || y;
|
||||
};
|
||||
reduceExpressionsFun = acc: v: (
|
||||
if builtins.typeOf v == "set" then (
|
||||
if v.type == "value" then (
|
||||
if builtins.typeOf v == "set" then
|
||||
(
|
||||
if v.type == "value" then
|
||||
(
|
||||
acc // {
|
||||
value = cond."${acc.cond}" acc.value v.value;
|
||||
}
|
||||
) else if v.type == "bool" then (
|
||||
) else if v.type == "bool" then
|
||||
(
|
||||
acc // {
|
||||
cond = v.value;
|
||||
}
|
||||
) else throw "Unsupported type"
|
||||
) else if builtins.typeOf v == "list" then (
|
||||
) else if builtins.typeOf v == "list" then
|
||||
(
|
||||
let
|
||||
ret = builtins.foldl'
|
||||
reduceExpressionsFun
|
||||
|
|
|
@ -14,12 +14,18 @@ poetry2nix.mkPoetryApplication {
|
|||
|
||||
# "Vendor" dependencies (for build-system support)
|
||||
postPatch = ''
|
||||
echo "import sys" >> poetry/__init__.py
|
||||
for path in ''${PYTHONPATH//:/ }; do echo $path; done | uniq | while read path; do
|
||||
echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
|
||||
done
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
# Figure out the location of poetry.core
|
||||
# As poetry.core is using the same root import name as the poetry package and the python module system wont look for the root
|
||||
# in the separate second location we need to link poetry.core to poetry
|
||||
ln -s $(python -c 'import poetry.core; import os.path; print(os.path.dirname(poetry.core.__file__))') $out/${python.sitePackages}/poetry/core
|
||||
|
||||
mkdir -p "$out/share/bash-completion/completions"
|
||||
"$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
|
||||
mkdir -p "$out/share/zsh/vendor-completions"
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "poetry"
|
||||
version = "1.0.10"
|
||||
version = "1.1.0"
|
||||
description = "Python dependency management and packaging made easy."
|
||||
authors = [
|
||||
"Sébastien Eustace <sebastien@eustace.io>"
|
||||
|
@ -22,40 +22,43 @@ classifiers = [
|
|||
|
||||
# Requirements
|
||||
[tool.poetry.dependencies]
|
||||
python = "~2.7 || ^3.4"
|
||||
cleo = "^0.7.6"
|
||||
clikit = "^0.4.2"
|
||||
python = "~2.7 || ^3.5"
|
||||
|
||||
poetry-core = "^1.0.0"
|
||||
cleo = "^0.8.1"
|
||||
clikit = "^0.6.2"
|
||||
crashtest = { version = "^0.3.0", python = "^3.6" }
|
||||
requests = "^2.18"
|
||||
cachy = "^0.3.0"
|
||||
requests-toolbelt = "^0.8.0"
|
||||
jsonschema = "^3.1"
|
||||
pyrsistent = "^0.14.2"
|
||||
pyparsing = "^2.2"
|
||||
requests-toolbelt = "^0.9.1"
|
||||
cachecontrol = { version = "^0.12.4", extras = ["filecache"] }
|
||||
pkginfo = "^1.4"
|
||||
html5lib = "^1.0"
|
||||
shellingham = "^1.1"
|
||||
tomlkit = "^0.5.11"
|
||||
tomlkit = ">=0.7.0,<1.0.0"
|
||||
pexpect = "^4.7.0"
|
||||
packaging = "^20.4"
|
||||
virtualenv = { version = "^20.0.26" }
|
||||
|
||||
# The typing module is not in the stdlib in Python 2.7 and 3.4
|
||||
typing = { version = "^3.6", python = "~2.7 || ~3.4" }
|
||||
# The typing module is not in the stdlib in Python 2.7
|
||||
typing = { version = "^3.6", python = "~2.7" }
|
||||
|
||||
# Use pathlib2 for Python 2.7 and 3.4
|
||||
pathlib2 = { version = "^2.3", python = "~2.7 || ~3.4" }
|
||||
# Use pathlib2 for Python 2.7
|
||||
pathlib2 = { version = "^2.3", python = "~2.7" }
|
||||
# Use futures on Python 2.7
|
||||
futures = { version = "^3.3.0", python = "~2.7" }
|
||||
# Use glob2 for Python 2.7 and 3.4
|
||||
glob2 = { version = "^0.6", python = "~2.7 || ~3.4" }
|
||||
# Use virtualenv for Python 2.7 since venv does not exist
|
||||
virtualenv = { version = "^16.7.9", python = "~2.7" }
|
||||
glob2 = { version = "^0.6", python = "~2.7" }
|
||||
# functools32 is needed for Python 2.7
|
||||
functools32 = { version = "^3.2.3", python = "~2.7" }
|
||||
keyring = [
|
||||
{ version = "^18.0.1", python = "~2.7 || ~3.4" },
|
||||
{ version = "^20.0.1", python = "^3.5" }
|
||||
{ version = "^18.0.1", python = "~2.7" },
|
||||
{ version = "^20.0.1", python = "~3.5" },
|
||||
{ version = "^21.2.0", python = "^3.6" }
|
||||
]
|
||||
# Use subprocess32 for Python 2.7 and 3.4
|
||||
subprocess32 = { version = "^3.5", python = "~2.7 || ~3.4" }
|
||||
importlib-metadata = {version = "~1.1.3", python = "<3.8"}
|
||||
# Use subprocess32 for Python 2.7
|
||||
subprocess32 = { version = "^3.5", python = "~2.7" }
|
||||
importlib-metadata = {version = "^1.6.0", python = "<3.8"}
|
||||
|
||||
[tool.poetry.dev-dependencies]
|
||||
pytest = [
|
||||
|
@ -63,62 +66,33 @@ pytest = [
|
|||
{version = "^5.4.3", python = ">=3.5"}
|
||||
]
|
||||
pytest-cov = "^2.5"
|
||||
mkdocs = { version = "^1.0", python = "~2.7.9 || ^3.4" }
|
||||
pymdown-extensions = "^6.0"
|
||||
pygments = "^2.2"
|
||||
pytest-mock = "^1.9"
|
||||
pygments-github-lexers = "^0.0.5"
|
||||
black = { version = "^19.10b0", python = "^3.6" }
|
||||
pre-commit = "^1.10"
|
||||
pre-commit = { version = "^2.6", python = "^3.6.1" }
|
||||
tox = "^3.0"
|
||||
pytest-sugar = "^0.9.2"
|
||||
httpretty = "^0.9.6"
|
||||
markdown-include = "^0.5.1"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
poetry = "poetry.console:main"
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["intreehooks"]
|
||||
build-backend = "intreehooks:loader"
|
||||
|
||||
[tool.intreehooks]
|
||||
build-backend = "poetry.masonry.api"
|
||||
requires = ["poetry-core>=1.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
|
||||
[tool.isort]
|
||||
line_length = 88
|
||||
profile = "black"
|
||||
force_single_line = true
|
||||
atomic = true
|
||||
include_trailing_comma = true
|
||||
lines_after_imports = 2
|
||||
lines_between_types = 1
|
||||
multi_line_output = 3
|
||||
use_parentheses = true
|
||||
not_skip = "__init__.py"
|
||||
src_paths = ["poetry", "tests"]
|
||||
skip_glob = ["*/setup.py"]
|
||||
filter_files = true
|
||||
|
||||
known_first_party = "poetry"
|
||||
known_third_party = [
|
||||
"cachecontrol",
|
||||
"cachy",
|
||||
"cleo",
|
||||
"clikit",
|
||||
"html5lib",
|
||||
"httpretty",
|
||||
"jsonschema",
|
||||
"keyring",
|
||||
"pexpect",
|
||||
"pkginfo",
|
||||
"pyparsing",
|
||||
"pytest",
|
||||
"requests",
|
||||
"requests_toolbelt",
|
||||
"shellingham",
|
||||
"tomlkit",
|
||||
]
|
||||
|
||||
|
||||
[tool.black]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"owner": "python-poetry",
|
||||
"repo": "poetry",
|
||||
"rev": "d3c9049a18ae33baacfcb5c698777282f2f58128",
|
||||
"sha256": "00qfzjjs6clh93gfl1px3ma9km8qxl3f4z819nmyl58zc8ni3zyv"
|
||||
"rev": "539d7f732c34c821258a9853cd3078cbda34a717",
|
||||
"sha256": "0kl23dkq9n112z1pqjg6f1wv3qk77ij6q5glg15lwrj7yrl9k65c",
|
||||
"fetchSubmodules": true
|
||||
}
|
Loading…
Reference in New Issue