poetry2nix: 1.12.0 -> 1.13.0
This commit is contained in:
parent
e6ec27be98
commit
0eeedc732c
|
@ -20,11 +20,58 @@ let
|
||||||
|
|
||||||
# Experimental withPlugins functionality
|
# Experimental withPlugins functionality
|
||||||
toPluginAble = (import ./plugins.nix { inherit pkgs lib; }).toPluginAble;
|
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
|
in
|
||||||
lib.makeScope pkgs.newScope (self: {
|
lib.makeScope pkgs.newScope (self: {
|
||||||
|
|
||||||
# Poetry2nix version
|
# Poetry2nix version
|
||||||
version = "1.12.0";
|
version = "1.13.0";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Returns an attrset { python, poetryPackages, pyProject, poetryLock } for the given pyproject/lockfile.
|
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
|
# Filter packages by their PEP508 markers & pyproject interpreter version
|
||||||
partitions =
|
partitions =
|
||||||
let
|
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
|
in
|
||||||
lib.partition supportsPythonVersion poetryLock.package;
|
lib.partition supportsPythonVersion poetryLock.package;
|
||||||
compatible = partitions.right;
|
compatible = partitions.right;
|
||||||
|
@ -91,7 +138,7 @@ lib.makeScope pkgs.newScope (self: {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
compatible
|
(lib.reverseList compatible)
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
lockPkgs;
|
lockPkgs;
|
||||||
|
@ -106,9 +153,13 @@ lib.makeScope pkgs.newScope (self: {
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
mkPoetryDep = self.callPackage ./mk-poetry-dep.nix {
|
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
|
# The canonical name is setuptools-scm
|
||||||
setuptools-scm = super.setuptools_scm;
|
setuptools-scm = super.setuptools_scm;
|
||||||
|
|
||||||
|
@ -126,10 +177,13 @@ lib.makeScope pkgs.newScope (self: {
|
||||||
);
|
);
|
||||||
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) overlays;
|
packageOverrides = lib.foldr lib.composeExtensions (self: super: { }) overlays;
|
||||||
py = python.override { inherit packageOverrides; self = py; };
|
py = python.override { inherit packageOverrides; self = py; };
|
||||||
|
|
||||||
|
inputAttrs = mkInputAttrs { inherit py pyProject; attrs = { }; includeBuildSystem = false; };
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
python = py;
|
python = py;
|
||||||
poetryPackages = map (pkg: py.pkgs.${moduleName pkg.name}) compatible;
|
poetryPackages = builtins.foldl' (acc: v: acc ++ v) [ ] (lib.attrValues inputAttrs);
|
||||||
poetryLock = poetryLock;
|
poetryLock = poetryLock;
|
||||||
inherit pyProject;
|
inherit pyProject;
|
||||||
};
|
};
|
||||||
|
@ -219,32 +273,12 @@ lib.makeScope pkgs.newScope (self: {
|
||||||
];
|
];
|
||||||
passedAttrs = builtins.removeAttrs attrs specialAttrs;
|
passedAttrs = builtins.removeAttrs attrs specialAttrs;
|
||||||
|
|
||||||
# Get dependencies and filter out depending on interpreter version
|
inputAttrs = mkInputAttrs { inherit py pyProject attrs; };
|
||||||
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;
|
|
||||||
};
|
|
||||||
app = py.pkgs.buildPythonPackage (
|
app = py.pkgs.buildPythonPackage (
|
||||||
passedAttrs // {
|
passedAttrs // inputAttrs // {
|
||||||
|
nativeBuildInputs = inputAttrs.nativeBuildInputs ++ [ py.pkgs.removePathDependenciesHook ];
|
||||||
|
} // {
|
||||||
pname = moduleName pyProject.tool.poetry.name;
|
pname = moduleName pyProject.tool.poetry.name;
|
||||||
version = pyProject.tool.poetry.version;
|
version = pyProject.tool.poetry.version;
|
||||||
|
|
||||||
|
@ -256,11 +290,6 @@ lib.makeScope pkgs.newScope (self: {
|
||||||
# provides python modules
|
# provides python modules
|
||||||
namePrefix = "";
|
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 = {
|
passthru = {
|
||||||
python = py;
|
python = py;
|
||||||
dependencyEnv = (
|
dependencyEnv = (
|
||||||
|
@ -274,9 +303,10 @@ lib.makeScope pkgs.newScope (self: {
|
||||||
) { inherit app; };
|
) { 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) description;
|
||||||
|
} // lib.optionalAttrs (lib.hasAttr "homepage" pyProject.tool.poetry) {
|
||||||
inherit (pyProject.tool.poetry) homepage;
|
inherit (pyProject.tool.poetry) homepage;
|
||||||
} // {
|
} // {
|
||||||
inherit (py.meta) platforms;
|
inherit (py.meta) platforms;
|
||||||
|
|
|
@ -29,25 +29,26 @@ let
|
||||||
# A python package that contains simple .egg-info and .pth files for an editable installation
|
# A python package that contains simple .egg-info and .pth files for an editable installation
|
||||||
editablePackage = python.pkgs.toPythonModule (pkgs.runCommandNoCC "${name}-editable"
|
editablePackage = python.pkgs.toPythonModule (pkgs.runCommandNoCC "${name}-editable"
|
||||||
{ } ''
|
{ } ''
|
||||||
mkdir -p "$out/${python.sitePackages}"
|
mkdir -p "$out/${python.sitePackages}"
|
||||||
cd "$out/${python.sitePackages}"
|
cd "$out/${python.sitePackages}"
|
||||||
|
|
||||||
# See https://docs.python.org/3.8/library/site.html for info on such .pth files
|
# 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
|
# These add another site package path for each line
|
||||||
touch poetry2nix-editable.pth
|
touch poetry2nix-editable.pth
|
||||||
${lib.concatMapStringsSep "\n" (src: ''
|
${lib.concatMapStringsSep "\n"
|
||||||
echo "${toString src}" >> poetry2nix-editable.pth
|
(src: ''
|
||||||
'')
|
echo "${toString src}" >> poetry2nix-editable.pth
|
||||||
(lib.attrValues editablePackageSources)}
|
'')
|
||||||
|
(lib.attrValues editablePackageSources)}
|
||||||
|
|
||||||
# Create a very simple egg so pkg_resources can find this package
|
# 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
|
# See https://setuptools.readthedocs.io/en/latest/formats.html for more info on the egg format
|
||||||
mkdir "${name}.egg-info"
|
mkdir "${name}.egg-info"
|
||||||
cd "${name}.egg-info"
|
cd "${name}.egg-info"
|
||||||
ln -s ${pkgInfoFile} PKG-INFO
|
ln -s ${pkgInfoFile} PKG-INFO
|
||||||
${lib.optionalString (pyProject.tool.poetry ? plugins) ''
|
${lib.optionalString (pyProject.tool.poetry ? plugins) ''
|
||||||
ln -s ${entryPointsFile} entry_points.txt
|
ln -s ${entryPointsFile} entry_points.txt
|
||||||
''}
|
''}
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
|
|
|
@ -24,7 +24,8 @@ in
|
||||||
pyprojectPatchScript = "${./pyproject-without-path.py}";
|
pyprojectPatchScript = "${./pyproject-without-path.py}";
|
||||||
};
|
};
|
||||||
} ./remove-path-dependencies.sh
|
} ./remove-path-dependencies.sh
|
||||||
) { };
|
)
|
||||||
|
{ };
|
||||||
|
|
||||||
pipBuildHook = callPackage
|
pipBuildHook = callPackage
|
||||||
(
|
(
|
||||||
|
@ -37,7 +38,8 @@ in
|
||||||
inherit pythonInterpreter pythonSitePackages;
|
inherit pythonInterpreter pythonSitePackages;
|
||||||
};
|
};
|
||||||
} ./pip-build-hook.sh
|
} ./pip-build-hook.sh
|
||||||
) { };
|
)
|
||||||
|
{ };
|
||||||
|
|
||||||
poetry2nixFixupHook = callPackage
|
poetry2nixFixupHook = callPackage
|
||||||
(
|
(
|
||||||
|
@ -47,7 +49,8 @@ in
|
||||||
name = "fixup-hook.sh";
|
name = "fixup-hook.sh";
|
||||||
deps = [ ];
|
deps = [ ];
|
||||||
} ./fixup-hook.sh
|
} ./fixup-hook.sh
|
||||||
) { };
|
)
|
||||||
|
{ };
|
||||||
|
|
||||||
# When the "wheel" package itself is a wheel the nixpkgs hook (which pulls in "wheel") leads to infinite recursion
|
# 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.
|
# It doesn't _really_ depend on wheel though, it just copies the wheel.
|
||||||
|
@ -58,7 +61,8 @@ in
|
||||||
name = "wheel-unpack-hook.sh";
|
name = "wheel-unpack-hook.sh";
|
||||||
deps = [ ];
|
deps = [ ];
|
||||||
} ./wheel-unpack-hook.sh
|
} ./wheel-unpack-hook.sh
|
||||||
) { };
|
)
|
||||||
|
{ };
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,12 +156,10 @@ let
|
||||||
let
|
let
|
||||||
missingBuildBackendError = "No build-system.build-backend section in pyproject.toml. "
|
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";
|
+ "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;
|
requires = lib.attrByPath [ "build-system" "requires" ] (throw missingBuildBackendError) pyProject;
|
||||||
drvAttr = moduleName (builtins.elemAt (builtins.split "\\.|:" buildSystem) 0);
|
requiredPkgs = builtins.map (n: lib.elemAt (builtins.match "([^!=<>~\[]+).*" n) 0) requires;
|
||||||
in
|
in
|
||||||
if buildSystem == "" then [ ] else (
|
builtins.map (drvAttr: pythonPackages.${drvAttr} or (throw "unsupported build system requirement ${drvAttr}")) requiredPkgs;
|
||||||
[ pythonPackages.${drvAttr} or (throw "unsupported build system ${buildSystem}") ]
|
|
||||||
);
|
|
||||||
|
|
||||||
# Find gitignore files recursively in parent directory stopping with .git
|
# Find gitignore files recursively in parent directory stopping with .git
|
||||||
findGitIgnores = path:
|
findGitIgnores = path:
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
, lib
|
, lib
|
||||||
, python
|
, python
|
||||||
, buildPythonPackage
|
, buildPythonPackage
|
||||||
, pythonPackages
|
|
||||||
, poetryLib
|
, poetryLib
|
||||||
|
, evalPep508
|
||||||
}:
|
}:
|
||||||
{ name
|
{ name
|
||||||
, version
|
, version
|
||||||
|
@ -53,9 +53,11 @@ pythonPackages.callPackage
|
||||||
pyProjectPath = localDepPath + "/pyproject.toml";
|
pyProjectPath = localDepPath + "/pyproject.toml";
|
||||||
pyProject = poetryLib.readTOML pyProjectPath;
|
pyProject = poetryLib.readTOML pyProjectPath;
|
||||||
in
|
in
|
||||||
if builtins.pathExists pyProjectPath then poetryLib.getBuildSystemPkgs {
|
if builtins.pathExists pyProjectPath then
|
||||||
inherit pythonPackages pyProject;
|
poetryLib.getBuildSystemPkgs
|
||||||
} else [ ];
|
{
|
||||||
|
inherit pythonPackages pyProject;
|
||||||
|
} else [ ];
|
||||||
|
|
||||||
fileInfo =
|
fileInfo =
|
||||||
let
|
let
|
||||||
|
@ -127,8 +129,9 @@ pythonPackages.callPackage
|
||||||
n: v:
|
n: v:
|
||||||
let
|
let
|
||||||
constraints = v.python or "";
|
constraints = v.python or "";
|
||||||
|
pep508Markers = v.markers or "";
|
||||||
in
|
in
|
||||||
compat constraints
|
compat constraints && evalPep508 pep508Markers
|
||||||
)
|
)
|
||||||
dependencies
|
dependencies
|
||||||
);
|
);
|
||||||
|
@ -150,15 +153,18 @@ pythonPackages.callPackage
|
||||||
# Interpreters should declare what wheel types they're compatible with (python type + ABI)
|
# Interpreters should declare what wheel types they're compatible with (python type + ABI)
|
||||||
# Here we can then choose a file based on that info.
|
# Here we can then choose a file based on that info.
|
||||||
src =
|
src =
|
||||||
if isGit then (
|
if isGit then
|
||||||
builtins.fetchGit {
|
(
|
||||||
inherit (source) url;
|
builtins.fetchGit {
|
||||||
rev = source.reference;
|
inherit (source) url;
|
||||||
ref = sourceSpec.branch or sourceSpec.rev or sourceSpec.tag or "HEAD";
|
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;
|
pname = name;
|
||||||
inherit (fileInfo) file hash kind;
|
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 =
|
||||||
# cffi is bundled with pypy
|
# cffi is bundled with pypy
|
||||||
if self.python.implementation == "pypy" then null else (
|
if self.python.implementation == "pypy" then null else
|
||||||
|
(
|
||||||
super.cffi.overridePythonAttrs (
|
super.cffi.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [ pkgs.libffi ];
|
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 = (
|
django = (
|
||||||
super.django.overridePythonAttrs (
|
super.django.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
|
@ -139,6 +166,24 @@ self: super:
|
||||||
# Environment markers are not always included (depending on how a dep was defined)
|
# Environment markers are not always included (depending on how a dep was defined)
|
||||||
enum34 = if self.pythonAtLeast "3.4" then null else super.enum34;
|
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 (
|
faker = super.faker.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [ self.pytest-runner ];
|
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 (
|
jupyter = super.jupyter.overridePythonAttrs (
|
||||||
old: rec {
|
old: rec {
|
||||||
# jupyter is a meta-package. Everything relevant comes from the
|
# 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 (
|
kiwisolver = super.kiwisolver.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs ++ [
|
buildInputs = old.buildInputs ++ [
|
||||||
|
@ -408,21 +477,33 @@ self: super:
|
||||||
);
|
);
|
||||||
|
|
||||||
molecule =
|
molecule =
|
||||||
if lib.versionOlder super.molecule.version "3.0.0" then (super.molecule.overridePythonAttrs (
|
if lib.versionOlder super.molecule.version "3.0.0" then
|
||||||
old: {
|
(super.molecule.overridePythonAttrs (
|
||||||
patches = (old.patches or [ ]) ++ [
|
old: {
|
||||||
# Fix build with more recent setuptools versions
|
patches = (old.patches or [ ]) ++ [
|
||||||
(pkgs.fetchpatch {
|
# Fix build with more recent setuptools versions
|
||||||
url = "https://github.com/ansible-community/molecule/commit/c9fee498646a702c77b5aecf6497cff324acd056.patch";
|
(pkgs.fetchpatch {
|
||||||
sha256 = "1g1n45izdz0a3c9akgxx14zhdw6c3dkb48j8pq64n82fa6ndl1b7";
|
url = "https://github.com/ansible-community/molecule/commit/c9fee498646a702c77b5aecf6497cff324acd056.patch";
|
||||||
excludes = [ "pyproject.toml" ];
|
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 ];
|
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 (
|
netcdf4 = super.netcdf4.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
|
@ -456,15 +537,16 @@ self: super:
|
||||||
name = "site.cfg";
|
name = "site.cfg";
|
||||||
text = (
|
text = (
|
||||||
lib.generators.toINI
|
lib.generators.toINI
|
||||||
{ } {
|
{ }
|
||||||
${blasImplementation} = {
|
{
|
||||||
include_dirs = "${blas}/include";
|
${blasImplementation} = {
|
||||||
library_dirs = "${blas}/lib";
|
include_dirs = "${blas}/include";
|
||||||
} // lib.optionalAttrs (blasImplementation == "mkl") {
|
library_dirs = "${blas}/lib";
|
||||||
mkl_libs = "mkl_rt";
|
} // lib.optionalAttrs (blasImplementation == "mkl") {
|
||||||
lapack_libs = "";
|
mkl_libs = "mkl_rt";
|
||||||
};
|
lapack_libs = "";
|
||||||
}
|
};
|
||||||
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
in
|
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 (
|
psycopg2 = super.psycopg2.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
buildInputs = old.buildInputs
|
buildInputs = old.buildInputs
|
||||||
|
@ -533,61 +638,65 @@ self: super:
|
||||||
);
|
);
|
||||||
|
|
||||||
pyarrow =
|
pyarrow =
|
||||||
if lib.versionAtLeast super.pyarrow.version "0.16.0" then super.pyarrow.overridePythonAttrs (
|
if lib.versionAtLeast super.pyarrow.version "0.16.0" then
|
||||||
old:
|
super.pyarrow.overridePythonAttrs
|
||||||
let
|
(
|
||||||
parseMinor = drv: lib.concatStringsSep "." (lib.take 2 (lib.splitVersion drv.version));
|
old:
|
||||||
|
let
|
||||||
|
parseMinor = drv: lib.concatStringsSep "." (lib.take 2 (lib.splitVersion drv.version));
|
||||||
|
|
||||||
# Starting with nixpkgs revision f149c7030a7, pyarrow takes "python3" as an argument
|
# Starting with nixpkgs revision f149c7030a7, pyarrow takes "python3" as an argument
|
||||||
# instead of "python". Below we inspect function arguments to maintain compatibilitiy.
|
# instead of "python". Below we inspect function arguments to maintain compatibilitiy.
|
||||||
_arrow-cpp = pkgs.arrow-cpp.override (
|
_arrow-cpp = pkgs.arrow-cpp.override (
|
||||||
builtins.intersectAttrs
|
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;
|
ARROW_HOME = _arrow-cpp;
|
||||||
arrowCppVersion = parseMinor pkgs.arrow-cpp;
|
arrowCppVersion = parseMinor pkgs.arrow-cpp;
|
||||||
pyArrowVersion = parseMinor super.pyarrow;
|
pyArrowVersion = parseMinor super.pyarrow;
|
||||||
errorMessage = "arrow-cpp version (${arrowCppVersion}) mismatches pyarrow version (${pyArrowVersion})";
|
errorMessage = "arrow-cpp version (${arrowCppVersion}) mismatches pyarrow version (${pyArrowVersion})";
|
||||||
in
|
in
|
||||||
if arrowCppVersion != pyArrowVersion then throw errorMessage else {
|
if arrowCppVersion != pyArrowVersion then throw errorMessage else {
|
||||||
|
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||||
self.cython
|
self.cython
|
||||||
pkgs.pkgconfig
|
pkgs.pkgconfig
|
||||||
pkgs.cmake
|
pkgs.cmake
|
||||||
];
|
];
|
||||||
|
|
||||||
preBuild = ''
|
preBuild = ''
|
||||||
export PYARROW_PARALLEL=$NIX_BUILD_CORES
|
export PYARROW_PARALLEL=$NIX_BUILD_CORES
|
||||||
'';
|
'';
|
||||||
|
|
||||||
PARQUET_HOME = _arrow-cpp;
|
PARQUET_HOME = _arrow-cpp;
|
||||||
inherit ARROW_HOME;
|
inherit ARROW_HOME;
|
||||||
|
|
||||||
buildInputs = old.buildInputs ++ [
|
buildInputs = old.buildInputs ++ [
|
||||||
pkgs.arrow-cpp
|
pkgs.arrow-cpp
|
||||||
];
|
];
|
||||||
|
|
||||||
PYARROW_BUILD_TYPE = "release";
|
PYARROW_BUILD_TYPE = "release";
|
||||||
PYARROW_WITH_PARQUET = true;
|
PYARROW_WITH_PARQUET = true;
|
||||||
PYARROW_CMAKE_OPTIONS = [
|
PYARROW_CMAKE_OPTIONS = [
|
||||||
"-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib"
|
"-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib"
|
||||||
|
|
||||||
# This doesn't use setup hook to call cmake so we need to workaround #54606
|
# This doesn't use setup hook to call cmake so we need to workaround #54606
|
||||||
# ourselves
|
# ourselves
|
||||||
"-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
|
"-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
|
||||||
];
|
];
|
||||||
|
|
||||||
dontUseCmakeConfigure = true;
|
dontUseCmakeConfigure = true;
|
||||||
}
|
}
|
||||||
) else super.pyarrow.overridePythonAttrs (
|
) else
|
||||||
old: {
|
super.pyarrow.overridePythonAttrs (
|
||||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
old: {
|
||||||
self.cython
|
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||||
];
|
self.cython
|
||||||
}
|
];
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
|
||||||
pycairo = (
|
pycairo = (
|
||||||
drv: (
|
drv: (
|
||||||
|
@ -647,20 +756,22 @@ self: super:
|
||||||
# Tests fail because of no audio device and display.
|
# Tests fail because of no audio device and display.
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
sed \
|
sed \
|
||||||
-e "s/origincdirs = .*/origincdirs = []/" \
|
-e "s/origincdirs = .*/origincdirs = []/" \
|
||||||
-e "s/origlibdirs = .*/origlibdirs = []/" \
|
-e "s/origlibdirs = .*/origlibdirs = []/" \
|
||||||
-e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \
|
-e "/'\/lib\/i386-linux-gnu', '\/lib\/x86_64-linux-gnu']/d" \
|
||||||
-e "/\/include\/smpeg/d" \
|
-e "/\/include\/smpeg/d" \
|
||||||
-i buildconfig/config_unix.py
|
-i buildconfig/config_unix.py
|
||||||
${lib.concatMapStrings (dep: ''
|
${lib.concatMapStrings
|
||||||
sed \
|
(dep: ''
|
||||||
-e "/origincdirs =/a\ origincdirs += ['${lib.getDev dep}/include']" \
|
sed \
|
||||||
-e "/origlibdirs =/a\ origlibdirs += ['${lib.getLib dep}/lib']" \
|
-e "/origincdirs =/a\ origincdirs += ['${lib.getDev dep}/include']" \
|
||||||
-i buildconfig/config_unix.py
|
-e "/origlibdirs =/a\ origlibdirs += ['${lib.getLib dep}/lib']" \
|
||||||
'') buildInputs
|
-i buildconfig/config_unix.py
|
||||||
}
|
'')
|
||||||
LOCALBASE=/ ${self.python.interpreter} buildconfig/config.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 (
|
scipy = super.scipy.overridePythonAttrs (
|
||||||
old:
|
old:
|
||||||
if old.format != "wheel" then {
|
if old.format != "wheel" then {
|
||||||
|
@ -927,13 +1044,14 @@ self: super:
|
||||||
);
|
);
|
||||||
|
|
||||||
shellingham =
|
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: {
|
super.shellingham.overridePythonAttrs (
|
||||||
format = "pyproject";
|
old: {
|
||||||
}
|
format = "pyproject";
|
||||||
)
|
}
|
||||||
) else super.shellingham;
|
)
|
||||||
|
) else super.shellingham;
|
||||||
|
|
||||||
tables = super.tables.overridePythonAttrs (
|
tables = super.tables.overridePythonAttrs (
|
||||||
old: {
|
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 (
|
tensorflow = super.tensorflow.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
postInstall = ''
|
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
|
# nix uses a dash, poetry uses an underscore
|
||||||
typing_extensions = super.typing_extensions or self.typing-extensions;
|
typing_extensions = super.typing_extensions or self.typing-extensions;
|
||||||
|
|
||||||
|
@ -1004,6 +1135,20 @@ self: super:
|
||||||
python = self.python;
|
python = self.python;
|
||||||
}).wheel;
|
}).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 =
|
wheel =
|
||||||
let
|
let
|
||||||
isWheel = super.wheel.src.isWheel or false;
|
isWheel = super.wheel.src.isWheel or false;
|
||||||
|
@ -1026,9 +1171,10 @@ self: super:
|
||||||
in
|
in
|
||||||
if isWheel then wheelPackage else sourcePackage;
|
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 (
|
super.zipp.overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
prePatch = ''
|
prePatch = ''
|
||||||
|
@ -1039,12 +1185,12 @@ self: super:
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
) else super.zipp
|
) else super.zipp
|
||||||
).overridePythonAttrs (
|
).overridePythonAttrs (
|
||||||
old: {
|
old: {
|
||||||
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
propagatedBuildInputs = old.propagatedBuildInputs ++ [
|
||||||
self.toml
|
self.toml
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,12 +71,13 @@ let
|
||||||
withPython = ver: abi: x: (isPyVersionCompatible ver x.pyVer) && (isPyAbiCompatible abi x.abi);
|
withPython = ver: abi: x: (isPyVersionCompatible ver x.pyVer) && (isPyAbiCompatible abi x.abi);
|
||||||
withPlatform =
|
withPlatform =
|
||||||
if isLinux
|
if isLinux
|
||||||
then (
|
then
|
||||||
x: x.platform == "manylinux1_${stdenv.platform.kernelArch}"
|
(
|
||||||
|| x.platform == "manylinux2010_${stdenv.platform.kernelArch}"
|
x: x.platform == "manylinux1_${stdenv.platform.kernelArch}"
|
||||||
|| x.platform == "manylinux2014_${stdenv.platform.kernelArch}"
|
|| x.platform == "manylinux2010_${stdenv.platform.kernelArch}"
|
||||||
|| x.platform == "any"
|
|| x.platform == "manylinux2014_${stdenv.platform.kernelArch}"
|
||||||
)
|
|| x.platform == "any"
|
||||||
|
)
|
||||||
else (x: hasInfix "macosx" x.platform || x.platform == "any");
|
else (x: hasInfix "macosx" x.platform || x.platform == "any");
|
||||||
filterWheel = x:
|
filterWheel = x:
|
||||||
let
|
let
|
||||||
|
|
|
@ -8,35 +8,38 @@ let
|
||||||
# Strip leading/trailing whitespace from string
|
# Strip leading/trailing whitespace from string
|
||||||
stripStr = s: lib.elemAt (builtins.split "^ *" (lib.elemAt (builtins.split " *$" s) 0)) 2;
|
stripStr = s: lib.elemAt (builtins.split "^ *" (lib.elemAt (builtins.split " *$" s) 0)) 2;
|
||||||
findSubExpressionsFun = acc: c: (
|
findSubExpressionsFun = acc: c: (
|
||||||
if c == "(" then (
|
if c == "(" then
|
||||||
let
|
(
|
||||||
posNew = acc.pos + 1;
|
let
|
||||||
isOpen = acc.openP == 0;
|
posNew = acc.pos + 1;
|
||||||
startPos = if isOpen then posNew else acc.startPos;
|
isOpen = acc.openP == 0;
|
||||||
in
|
startPos = if isOpen then posNew else acc.startPos;
|
||||||
acc // {
|
in
|
||||||
inherit startPos;
|
acc // {
|
||||||
exprs = acc.exprs ++ [ (substr acc.exprPos (acc.pos - 1) acc.expr) ];
|
inherit startPos;
|
||||||
pos = posNew;
|
exprs = acc.exprs ++ [ (substr acc.exprPos (acc.pos - 1) acc.expr) ];
|
||||||
openP = acc.openP + 1;
|
pos = posNew;
|
||||||
}
|
openP = acc.openP + 1;
|
||||||
) else if c == ")" then (
|
}
|
||||||
let
|
) else if c == ")" then
|
||||||
openP = acc.openP - 1;
|
(
|
||||||
exprs = findSubExpressions (substr acc.startPos acc.pos acc.expr);
|
let
|
||||||
in
|
openP = acc.openP - 1;
|
||||||
acc // {
|
exprs = findSubExpressions (substr acc.startPos acc.pos acc.expr);
|
||||||
inherit openP;
|
in
|
||||||
pos = acc.pos + 1;
|
acc // {
|
||||||
exprs = if openP == 0 then acc.exprs ++ [ exprs ] else acc.exprs;
|
inherit openP;
|
||||||
exprPos = if openP == 0 then acc.pos + 1 else acc.exprPos;
|
pos = acc.pos + 1;
|
||||||
}
|
exprs = if openP == 0 then acc.exprs ++ [ exprs ] else acc.exprs;
|
||||||
) else acc // { pos = acc.pos + 1; }
|
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)
|
# Make a tree out of expression groups (parens)
|
||||||
findSubExpressions = expr:
|
findSubExpressions = expr':
|
||||||
let
|
let
|
||||||
|
expr = " " + expr';
|
||||||
acc = builtins.foldl'
|
acc = builtins.foldl'
|
||||||
findSubExpressionsFun
|
findSubExpressionsFun
|
||||||
{
|
{
|
||||||
|
@ -113,7 +116,7 @@ let
|
||||||
python_full_version = python.version;
|
python_full_version = python.version;
|
||||||
implementation_name = python.implementation;
|
implementation_name = python.implementation;
|
||||||
implementation_version = python.version;
|
implementation_version = python.version;
|
||||||
extra = "";
|
# extra = "";
|
||||||
};
|
};
|
||||||
substituteVar = value: if builtins.hasAttr value variables then (builtins.toJSON variables."${value}") else value;
|
substituteVar = value: if builtins.hasAttr value variables then (builtins.toJSON variables."${value}") else value;
|
||||||
processVar = value: builtins.foldl' (acc: v: v acc) value [
|
processVar = value: builtins.foldl' (acc: v: v acc) value [
|
||||||
|
@ -121,26 +124,28 @@ let
|
||||||
substituteVar
|
substituteVar
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
if builtins.typeOf exprs == "set" then (
|
if builtins.typeOf exprs == "set" then
|
||||||
if exprs.type == "expr" then (
|
(
|
||||||
let
|
if exprs.type == "expr" then
|
||||||
mVal = ''[a-zA-Z0-9\'"_\. ]+'';
|
(
|
||||||
mOp = "in|[!=<>]+";
|
let
|
||||||
e = stripStr exprs.value;
|
mVal = ''[a-zA-Z0-9\'"_\. ]+'';
|
||||||
m = builtins.map stripStr (builtins.match ''^(${mVal}) *(${mOp}) *(${mVal})$'' e);
|
mOp = "in|[!=<>]+";
|
||||||
in
|
e = stripStr exprs.value;
|
||||||
{
|
m = builtins.map stripStr (builtins.match ''^(${mVal}) *(${mOp}) *(${mVal})$'' e);
|
||||||
type = "expr";
|
m0 = processVar (builtins.elemAt m 0);
|
||||||
value = {
|
m2 = processVar (builtins.elemAt m 2);
|
||||||
op = builtins.elemAt m 1;
|
in
|
||||||
values = [
|
{
|
||||||
(processVar (builtins.elemAt m 0))
|
type = "expr";
|
||||||
(processVar (builtins.elemAt m 2))
|
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;
|
}
|
||||||
|
) else exprs
|
||||||
|
) else builtins.map transformExpressions exprs;
|
||||||
|
|
||||||
# Recursively eval all expressions
|
# Recursively eval all expressions
|
||||||
evalExpressions = exprs:
|
evalExpressions = exprs:
|
||||||
|
@ -153,6 +158,7 @@ let
|
||||||
);
|
);
|
||||||
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));
|
||||||
op = {
|
op = {
|
||||||
|
"true" = x: y: true;
|
||||||
"<=" = x: y: (unmarshal x) <= (unmarshal y);
|
"<=" = x: y: (unmarshal x) <= (unmarshal y);
|
||||||
"<" = x: y: (unmarshal x) < (unmarshal y);
|
"<" = x: y: (unmarshal x) < (unmarshal y);
|
||||||
"!=" = x: y: x != y;
|
"!=" = x: y: x != y;
|
||||||
|
@ -177,18 +183,20 @@ let
|
||||||
builtins.elem (unmarshal x) values;
|
builtins.elem (unmarshal x) values;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
if builtins.typeOf exprs == "set" then (
|
if builtins.typeOf exprs == "set" then
|
||||||
if exprs.type == "expr" then (
|
(
|
||||||
let
|
if exprs.type == "expr" then
|
||||||
expr = exprs;
|
(
|
||||||
result = (op."${expr.value.op}") (builtins.elemAt expr.value.values 0) (builtins.elemAt expr.value.values 1);
|
let
|
||||||
in
|
expr = exprs;
|
||||||
{
|
result = (op."${expr.value.op}") (builtins.elemAt expr.value.values 0) (builtins.elemAt expr.value.values 1);
|
||||||
type = "value";
|
in
|
||||||
value = result;
|
{
|
||||||
}
|
type = "value";
|
||||||
) else exprs
|
value = result;
|
||||||
) else builtins.map evalExpressions exprs;
|
}
|
||||||
|
) 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
|
# Now that we have performed an eval all that's left to do is to concat the graph into a single bool
|
||||||
reduceExpressions = exprs:
|
reduceExpressions = exprs:
|
||||||
|
@ -198,30 +206,34 @@ let
|
||||||
"or" = x: y: x || y;
|
"or" = x: y: x || y;
|
||||||
};
|
};
|
||||||
reduceExpressionsFun = acc: v: (
|
reduceExpressionsFun = acc: v: (
|
||||||
if builtins.typeOf v == "set" then (
|
if builtins.typeOf v == "set" then
|
||||||
if v.type == "value" 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 // {
|
acc // {
|
||||||
value = cond."${acc.cond}" acc.value v.value;
|
value = cond."${acc.cond}" acc.value ret.value;
|
||||||
}
|
|
||||||
) else if v.type == "bool" then (
|
|
||||||
acc // {
|
|
||||||
cond = v.value;
|
|
||||||
}
|
}
|
||||||
) else throw "Unsupported type"
|
) 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
|
in
|
||||||
(
|
(
|
||||||
|
|
|
@ -14,12 +14,18 @@ poetry2nix.mkPoetryApplication {
|
||||||
|
|
||||||
# "Vendor" dependencies (for build-system support)
|
# "Vendor" dependencies (for build-system support)
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
|
echo "import sys" >> poetry/__init__.py
|
||||||
for path in ''${PYTHONPATH//:/ }; do echo $path; done | uniq | while read path; do
|
for path in ''${PYTHONPATH//:/ }; do echo $path; done | uniq | while read path; do
|
||||||
echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
|
echo "sys.path.insert(0, \"$path\")" >> poetry/__init__.py
|
||||||
done
|
done
|
||||||
'';
|
'';
|
||||||
|
|
||||||
postInstall = ''
|
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"
|
mkdir -p "$out/share/bash-completion/completions"
|
||||||
"$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
|
"$out/bin/poetry" completions bash > "$out/share/bash-completion/completions/poetry"
|
||||||
mkdir -p "$out/share/zsh/vendor-completions"
|
mkdir -p "$out/share/zsh/vendor-completions"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "poetry"
|
name = "poetry"
|
||||||
version = "1.0.10"
|
version = "1.1.0"
|
||||||
description = "Python dependency management and packaging made easy."
|
description = "Python dependency management and packaging made easy."
|
||||||
authors = [
|
authors = [
|
||||||
"Sébastien Eustace <sebastien@eustace.io>"
|
"Sébastien Eustace <sebastien@eustace.io>"
|
||||||
|
@ -22,40 +22,43 @@ classifiers = [
|
||||||
|
|
||||||
# Requirements
|
# Requirements
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
python = "~2.7 || ^3.4"
|
python = "~2.7 || ^3.5"
|
||||||
cleo = "^0.7.6"
|
|
||||||
clikit = "^0.4.2"
|
poetry-core = "^1.0.0"
|
||||||
|
cleo = "^0.8.1"
|
||||||
|
clikit = "^0.6.2"
|
||||||
|
crashtest = { version = "^0.3.0", python = "^3.6" }
|
||||||
requests = "^2.18"
|
requests = "^2.18"
|
||||||
cachy = "^0.3.0"
|
cachy = "^0.3.0"
|
||||||
requests-toolbelt = "^0.8.0"
|
requests-toolbelt = "^0.9.1"
|
||||||
jsonschema = "^3.1"
|
|
||||||
pyrsistent = "^0.14.2"
|
|
||||||
pyparsing = "^2.2"
|
|
||||||
cachecontrol = { version = "^0.12.4", extras = ["filecache"] }
|
cachecontrol = { version = "^0.12.4", extras = ["filecache"] }
|
||||||
pkginfo = "^1.4"
|
pkginfo = "^1.4"
|
||||||
html5lib = "^1.0"
|
html5lib = "^1.0"
|
||||||
shellingham = "^1.1"
|
shellingham = "^1.1"
|
||||||
tomlkit = "^0.5.11"
|
tomlkit = ">=0.7.0,<1.0.0"
|
||||||
pexpect = "^4.7.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
|
# The typing module is not in the stdlib in Python 2.7
|
||||||
typing = { version = "^3.6", python = "~2.7 || ~3.4" }
|
typing = { version = "^3.6", python = "~2.7" }
|
||||||
|
|
||||||
# Use pathlib2 for Python 2.7 and 3.4
|
# Use pathlib2 for Python 2.7
|
||||||
pathlib2 = { version = "^2.3", python = "~2.7 || ~3.4" }
|
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
|
# Use glob2 for Python 2.7 and 3.4
|
||||||
glob2 = { version = "^0.6", python = "~2.7 || ~3.4" }
|
glob2 = { version = "^0.6", python = "~2.7" }
|
||||||
# Use virtualenv for Python 2.7 since venv does not exist
|
|
||||||
virtualenv = { version = "^16.7.9", python = "~2.7" }
|
|
||||||
# functools32 is needed for Python 2.7
|
# functools32 is needed for Python 2.7
|
||||||
functools32 = { version = "^3.2.3", python = "~2.7" }
|
functools32 = { version = "^3.2.3", python = "~2.7" }
|
||||||
keyring = [
|
keyring = [
|
||||||
{ version = "^18.0.1", python = "~2.7 || ~3.4" },
|
{ version = "^18.0.1", python = "~2.7" },
|
||||||
{ version = "^20.0.1", python = "^3.5" }
|
{ version = "^20.0.1", python = "~3.5" },
|
||||||
|
{ version = "^21.2.0", python = "^3.6" }
|
||||||
]
|
]
|
||||||
# Use subprocess32 for Python 2.7 and 3.4
|
# Use subprocess32 for Python 2.7
|
||||||
subprocess32 = { version = "^3.5", python = "~2.7 || ~3.4" }
|
subprocess32 = { version = "^3.5", python = "~2.7" }
|
||||||
importlib-metadata = {version = "~1.1.3", python = "<3.8"}
|
importlib-metadata = {version = "^1.6.0", python = "<3.8"}
|
||||||
|
|
||||||
[tool.poetry.dev-dependencies]
|
[tool.poetry.dev-dependencies]
|
||||||
pytest = [
|
pytest = [
|
||||||
|
@ -63,62 +66,33 @@ pytest = [
|
||||||
{version = "^5.4.3", python = ">=3.5"}
|
{version = "^5.4.3", python = ">=3.5"}
|
||||||
]
|
]
|
||||||
pytest-cov = "^2.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"
|
pytest-mock = "^1.9"
|
||||||
pygments-github-lexers = "^0.0.5"
|
pre-commit = { version = "^2.6", python = "^3.6.1" }
|
||||||
black = { version = "^19.10b0", python = "^3.6" }
|
|
||||||
pre-commit = "^1.10"
|
|
||||||
tox = "^3.0"
|
tox = "^3.0"
|
||||||
pytest-sugar = "^0.9.2"
|
pytest-sugar = "^0.9.2"
|
||||||
httpretty = "^0.9.6"
|
httpretty = "^0.9.6"
|
||||||
markdown-include = "^0.5.1"
|
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
poetry = "poetry.console:main"
|
poetry = "poetry.console:main"
|
||||||
|
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["intreehooks"]
|
requires = ["poetry-core>=1.0.0"]
|
||||||
build-backend = "intreehooks:loader"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
||||||
[tool.intreehooks]
|
|
||||||
build-backend = "poetry.masonry.api"
|
|
||||||
|
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
line_length = 88
|
profile = "black"
|
||||||
force_single_line = true
|
force_single_line = true
|
||||||
atomic = true
|
atomic = true
|
||||||
include_trailing_comma = true
|
include_trailing_comma = true
|
||||||
lines_after_imports = 2
|
lines_after_imports = 2
|
||||||
lines_between_types = 1
|
lines_between_types = 1
|
||||||
multi_line_output = 3
|
|
||||||
use_parentheses = true
|
use_parentheses = true
|
||||||
not_skip = "__init__.py"
|
src_paths = ["poetry", "tests"]
|
||||||
skip_glob = ["*/setup.py"]
|
skip_glob = ["*/setup.py"]
|
||||||
filter_files = true
|
filter_files = true
|
||||||
|
|
||||||
known_first_party = "poetry"
|
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]
|
[tool.black]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
"owner": "python-poetry",
|
"owner": "python-poetry",
|
||||||
"repo": "poetry",
|
"repo": "poetry",
|
||||||
"rev": "d3c9049a18ae33baacfcb5c698777282f2f58128",
|
"rev": "539d7f732c34c821258a9853cd3078cbda34a717",
|
||||||
"sha256": "00qfzjjs6clh93gfl1px3ma9km8qxl3f4z819nmyl58zc8ni3zyv"
|
"sha256": "0kl23dkq9n112z1pqjg6f1wv3qk77ij6q5glg15lwrj7yrl9k65c",
|
||||||
|
"fetchSubmodules": true
|
||||||
}
|
}
|
Loading…
Reference in New Issue