poetry2nix: 1.12.0 -> 1.13.0

wip/yesman
adisbladis 4 years ago
parent e6ec27be98
commit 0eeedc732c
No known key found for this signature in database
GPG Key ID: 110BFAD44C6249B7
  1. 108
      pkgs/development/tools/poetry2nix/poetry2nix/default.nix
  2. 35
      pkgs/development/tools/poetry2nix/poetry2nix/editable.nix
  3. 12
      pkgs/development/tools/poetry2nix/poetry2nix/hooks/default.nix
  4. 8
      pkgs/development/tools/poetry2nix/poetry2nix/lib.nix
  5. 32
      pkgs/development/tools/poetry2nix/poetry2nix/mk-poetry-dep.nix
  6. 352
      pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
  7. 13
      pkgs/development/tools/poetry2nix/poetry2nix/pep425.nix
  8. 170
      pkgs/development/tools/poetry2nix/poetry2nix/pep508.nix
  9. 6
      pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/default.nix
  10. 1911
      pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/poetry.lock
  11. 84
      pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/pyproject.toml
  12. 7
      pkgs/development/tools/poetry2nix/poetry2nix/pkgs/poetry/src.json

@ -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,9 +303,10 @@ lib.makeScope pkgs.newScope (self: {
) { inherit app; };
};
meta = lib.optionalAttrs (lib.hasAttr "description" pyProject.tool.poetry) {
inherit (pyProject.tool.poetry) description;
} // lib.optionalAttrs (lib.hasAttr "homepage" 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;
} // {
inherit (py.meta) platforms;

@ -29,25 +29,26 @@ let
# A python package that contains simple .egg-info and .pth files for an editable installation
editablePackage = python.pkgs.toPythonModule (pkgs.runCommandNoCC "${name}-editable"
{ } ''
mkdir -p "$out/${python.sitePackages}"
cd "$out/${python.sitePackages}"
mkdir -p "$out/${python.sitePackages}"
cd "$out/${python.sitePackages}"
# 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: ''
echo "${toString src}" >> poetry2nix-editable.pth
'')
(lib.attrValues editablePackageSources)}
# 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: ''
echo "${toString src}" >> poetry2nix-editable.pth
'')
(lib.attrValues editablePackageSources)}
# Create a very simple egg so pkg_resources can find this package
# See https://setuptools.readthedocs.io/en/latest/formats.html for more info on the egg format
mkdir "${name}.egg-info"
cd "${name}.egg-info"
ln -s ${pkgInfoFile} PKG-INFO
${lib.optionalString (pyProject.tool.poetry ? plugins) ''
ln -s ${entryPointsFile} entry_points.txt
''}
# Create a very simple egg so pkg_resources can find this package
# See https://setuptools.readthedocs.io/en/latest/formats.html for more info on the egg format
mkdir "${name}.egg-info"
cd "${name}.egg-info"
ln -s ${pkgInfoFile} PKG-INFO
${lib.optionalString (pyProject.tool.poetry ? plugins) ''
ln -s ${entryPointsFile} entry_points.txt
''}
''
);
in

@ -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,9 +53,11 @@ pythonPackages.callPackage
pyProjectPath = localDepPath + "/pyproject.toml";
pyProject = poetryLib.readTOML pyProjectPath;
in
if builtins.pathExists pyProjectPath then poetryLib.getBuildSystemPkgs {
inherit pythonPackages pyProject;
} else [ ];
if builtins.pathExists pyProjectPath then
poetryLib.getBuildSystemPkgs
{
inherit pythonPackages pyProject;
} else [ ];
fileInfo =
let
@ -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 (
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 {
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 {
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,21 +477,33 @@ self: super:
);
molecule =
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
(pkgs.fetchpatch {
url = "https://github.com/ansible-community/molecule/commit/c9fee498646a702c77b5aecf6497cff324acd056.patch";
sha256 = "1g1n45izdz0a3c9akgxx14zhdw6c3dkb48j8pq64n82fa6ndl1b7";
excludes = [ "pyproject.toml" ];
})
];
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
(pkgs.fetchpatch {
url = "https://github.com/ansible-community/molecule/commit/c9fee498646a702c77b5aecf6497cff324acd056.patch";
sha256 = "1g1n45izdz0a3c9akgxx14zhdw6c3dkb48j8pq64n82fa6ndl1b7";
excludes = [ "pyproject.toml" ];
})
];
buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ];
}
)) else
super.molecule.overridePythonAttrs (old: {
buildInputs = old.buildInputs ++ [ self.setuptools-scm-git-archive ];
}
)) 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: {
@ -456,15 +537,16 @@ self: super:
name = "site.cfg";
text = (
lib.generators.toINI
{ } {
${blasImplementation} = {
include_dirs = "${blas}/include";
library_dirs = "${blas}/lib";
} // lib.optionalAttrs (blasImplementation == "mkl") {
mkl_libs = "mkl_rt";
lapack_libs = "";
};
}
{ }
{
${blasImplementation} = {
include_dirs = "${blas}/include";
library_dirs = "${blas}/lib";
} // lib.optionalAttrs (blasImplementation == "mkl") {
mkl_libs = "mkl_rt";
lapack_libs = "";
};
}
);
};
in
@ -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,61 +638,65 @@ self: super:
);
pyarrow =
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));
# Starting with nixpkgs revision f149c7030a7, pyarrow takes "python3" as an argument
# 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; }
);
ARROW_HOME = _arrow-cpp;
arrowCppVersion = parseMinor pkgs.arrow-cpp;
pyArrowVersion = parseMinor super.pyarrow;
errorMessage = "arrow-cpp version (${arrowCppVersion}) mismatches pyarrow version (${pyArrowVersion})";
in
if arrowCppVersion != pyArrowVersion then throw errorMessage else {
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));
# Starting with nixpkgs revision f149c7030a7, pyarrow takes "python3" as an argument
# 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; }
);
ARROW_HOME = _arrow-cpp;
arrowCppVersion = parseMinor pkgs.arrow-cpp;
pyArrowVersion = parseMinor super.pyarrow;
errorMessage = "arrow-cpp version (${arrowCppVersion}) mismatches pyarrow version (${pyArrowVersion})";
in
if arrowCppVersion != pyArrowVersion then throw errorMessage else {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.cython
pkgs.pkgconfig
pkgs.cmake
];
nativeBuildInputs = old.nativeBuildInputs ++ [
self.cython
pkgs.pkgconfig
pkgs.cmake
];
preBuild = ''
export PYARROW_PARALLEL=$NIX_BUILD_CORES
'';
preBuild = ''
export PYARROW_PARALLEL=$NIX_BUILD_CORES
'';
PARQUET_HOME = _arrow-cpp;
inherit ARROW_HOME;
PARQUET_HOME = _arrow-cpp;
inherit ARROW_HOME;
buildInputs = old.buildInputs ++ [
pkgs.arrow-cpp
];
buildInputs = old.buildInputs ++ [
pkgs.arrow-cpp
];
PYARROW_BUILD_TYPE = "release";
PYARROW_WITH_PARQUET = true;
PYARROW_CMAKE_OPTIONS = [
"-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib"
PYARROW_BUILD_TYPE = "release";
PYARROW_WITH_PARQUET = true;
PYARROW_CMAKE_OPTIONS = [
"-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib"
# This doesn't use setup hook to call cmake so we need to workaround #54606
# ourselves
"-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
];
# This doesn't use setup hook to call cmake so we need to workaround #54606
# ourselves
"-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
];
dontUseCmakeConfigure = true;
}
) else super.pyarrow.overridePythonAttrs (
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.cython
];
}
);
dontUseCmakeConfigure = true;
}
) else
super.pyarrow.overridePythonAttrs (
old: {
nativeBuildInputs = old.nativeBuildInputs ++ [
self.cython
];
}
);
pycairo = (
drv: (
@ -647,20 +756,22 @@ self: super:
# Tests fail because of no audio device and display.
doCheck = false;
preConfigure = ''
sed \
-e "s/origincdirs = .*/origincdirs = []/" \
-e "s/origlibdirs = .*/origlibdirs = []/" \
-e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \
-e "/\/include\/smpeg/d" \
-i buildconfig/config_unix.py
${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
}
LOCALBASE=/ ${self.python.interpreter} buildconfig/config.py
sed \
-e "s/origincdirs = .*/origincdirs = []/" \
-e "s/origlibdirs = .*/origlibdirs = []/" \
-e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \
-e "/\/include\/smpeg/d" \
-i buildconfig/config_unix.py
${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
}
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,13 +1044,14 @@ self: super:
);
shellingham =
if lib.versionAtLeast super.shellingham.version "1.3.2" then (
super.shellingham.overridePythonAttrs (
old: {
format = "pyproject";
}
)
) else super.shellingham;
if lib.versionAtLeast super.shellingham.version "1.3.2" then
(
super.shellingham.overridePythonAttrs (
old: {
format = "pyproject";
}
)
) else super.shellingham;
tables = super.tables.overridePythonAttrs (
old: {
@ -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 =
(
if lib.versionAtLeast super.zipp.version "2.0.0" then (
zipp = if super.zipp == null then null else
(
if lib.versionAtLeast super.zipp.version "2.0.0" then
(
super.zipp.overridePythonAttrs (
old: {
prePatch = ''
@ -1039,12 +1185,12 @@ self: super:
}
)
) else super.zipp
).overridePythonAttrs (
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [
self.toml
];
}
);
).overridePythonAttrs (
old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [
self.toml
];
}
);
}

@ -71,12 +71,13 @@ let
withPython = ver: abi: x: (isPyVersionCompatible ver x.pyVer) && (isPyAbiCompatible abi x.abi);
withPlatform =
if isLinux
then (
x: x.platform == "manylinux1_${stdenv.platform.kernelArch}"
|| x.platform == "manylinux2010_${stdenv.platform.kernelArch}"
|| x.platform == "manylinux2014_${stdenv.platform.kernelArch}"
|| x.platform == "any"
)
then
(
x: x.platform == "manylinux1_${stdenv.platform.kernelArch}"
|| x.platform == "manylinux2010_${stdenv.platform.kernelArch}"
|| x.platform == "manylinux2014_${stdenv.platform.kernelArch}"
|| x.platform == "any"
)
else (x: hasInfix "macosx" x.platform || x.platform == "any");
filterWheel = x:
let

@ -8,35 +8,38 @@ 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 (
let
posNew = acc.pos + 1;
isOpen = acc.openP == 0;
startPos = if isOpen then posNew else acc.startPos;
in
acc // {
inherit startPos;
exprs = acc.exprs ++ [ (substr acc.exprPos (acc.pos - 1) acc.expr) ];
pos = posNew;
openP = acc.openP + 1;
}
) else if c == ")" then (
let
openP = acc.openP - 1;
exprs = findSubExpressions (substr acc.startPos acc.pos acc.expr);
in
acc // {
inherit openP;
pos = acc.pos + 1;
exprs = if openP == 0 then acc.exprs ++ [ exprs ] else acc.exprs;
exprPos = if openP == 0 then acc.pos + 1 else acc.exprPos;
}
) else acc // { pos = acc.pos + 1; }
if c == "(" then
(
let
posNew = acc.pos + 1;
isOpen = acc.openP == 0;
startPos = if isOpen then posNew else acc.startPos;
in
acc // {
inherit startPos;
exprs = acc.exprs ++ [ (substr acc.exprPos (acc.pos - 1) acc.expr) ];
pos = posNew;
openP = acc.openP + 1;
}
) else if c == ")" then
(
let
openP = acc.openP - 1;
exprs = findSubExpressions (substr acc.startPos acc.pos acc.expr);
in
acc // {
inherit openP;
pos = acc.pos + 1;
exprs = if openP == 0 then acc.exprs ++ [ exprs ] else acc.exprs;
exprPos = if openP == 0 then acc.pos + 1 else acc.exprPos;
}
) else acc // { pos = acc.pos + 1; }
);
# 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,26 +124,28 @@ let
substituteVar
];
in
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);
in
{
type = "expr";
value = {
op = builtins.elemAt m 1;
values = [
(processVar (builtins.elemAt m 0))
(processVar (builtins.elemAt m 2))
];
};
}
) else exprs
) else builtins.map transformExpressions exprs;
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 = {
# 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
) else builtins.map transformExpressions exprs;
# Recursively eval all expressions
evalExpressions = 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,18 +183,20 @@ let
builtins.elem (unmarshal x) values;
};
in
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);
in
{
type = "value";
value = result;
}
) else exprs
) else builtins.map evalExpressions exprs;
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);
in
{
type = "value";
value = result;
}
) else exprs
) 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:
@ -198,30 +206,34 @@ let
"or" = x: y: x || y;
};
reduceExpressionsFun = acc: v: (
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 (
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
(
acc // {
cond = v.value;
}
) else throw "Unsupported type"
) else if builtins.typeOf v == "list" then
(
let
ret = builtins.foldl'
reduceExpressionsFun
{
value = true;
cond = "and";
}
v;
in
acc // {
cond = v.value;
value = cond."${acc.cond}" acc.value ret.value;
}
) else throw "Unsupported type"
) else if builtins.typeOf v == "list" then (
let
ret = builtins.foldl'
reduceExpressionsFun
{
value = true;
cond = "and";
}
v;
in
acc // {
value = cond."${acc.cond}" acc.value ret.value;
}
) else throw "Unsupported type"
);
in
(

@ -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…
Cancel
Save