Skip to content

Commit

Permalink
Merge pull request #139116 from adisbladis/poetry2nix-1_20_0
Browse files Browse the repository at this point in the history
poetry2nix: 1.19.0 -> 1.20.0
  • Loading branch information
adisbladis committed Sep 23, 2021
2 parents 51bcdc4 + 1b7e3b7 commit c93472b
Show file tree
Hide file tree
Showing 8 changed files with 242 additions and 71 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/tools/poetry2nix/poetry2nix/default.nix
Expand Up @@ -5,7 +5,7 @@
}:
let
# Poetry2nix version
version = "1.19.0";
version = "1.20.0";

inherit (poetryLib) isCompatible readTOML moduleName;

Expand Down
Expand Up @@ -38,7 +38,7 @@ pythonPackages.callPackage
fileCandidates =
let
supportedRegex = ("^.*(" + builtins.concatStringsSep "|" supportedExtensions + ")");
matchesVersion = fname: builtins.match ("^.*" + builtins.replaceStrings [ "." ] [ "\\." ] version + ".*$") fname != null;
matchesVersion = fname: builtins.match ("^.*" + builtins.replaceStrings [ "." "+" ] [ "\\." "\\+" ] version + ".*$") fname != null;
hasSupportedExtension = fname: builtins.match supportedRegex fname != null;
isCompatibleEgg = fname: ! lib.strings.hasSuffix ".egg" fname || lib.strings.hasSuffix "py${python.pythonVersion}.egg" fname;
in
Expand Down Expand Up @@ -96,6 +96,10 @@ pythonPackages.callPackage
"setuptools_scm"
"setuptools-scm"
"toml" # Toml is an extra for setuptools-scm
"tomli" # tomli is an extra for later versions of setuptools-scm
"packaging"
"six"
"pyparsing"
];
baseBuildInputs = lib.optional (! lib.elem name skipSetupToolsSCM) pythonPackages.setuptools-scm;
format = if isDirectory || isGit || isUrl then "pyproject" else fileInfo.format;
Expand Down
189 changes: 174 additions & 15 deletions pkgs/development/tools/poetry2nix/poetry2nix/overrides.nix
Expand Up @@ -58,6 +58,12 @@ self: super:
'';
});

argcomplete = super.argcomplete.overridePythonAttrs (
old: rec {
buildInputs = (old.buildInputs or [ ]) ++ [ self.importlib-metadata ];
}
);

arpeggio = super.arpeggio.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.pytest-runner ];
Expand Down Expand Up @@ -94,6 +100,20 @@ self: super:
}
);

black = super.black.overridePythonAttrs (
old: {
dontPreferSetupPy = true;
}
);

borgbackup = super.borgbackup.overridePythonAttrs (
old: {
BORG_OPENSSL_PREFIX = pkgs.openssl.dev;
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ];
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.openssl pkgs.acl ];
}
);

cairocffi = super.cairocffi.overridePythonAttrs (
old: {
inherit (pkgs.python3.pkgs.cairocffi) patches;
Expand Down Expand Up @@ -165,6 +185,11 @@ self: super:
}
);

cwcwidth = super.cwcwidth.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ])
++ [ self.cython ];
});

daphne = super.daphne.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup_requires=["pytest-runner"],' ""
Expand Down Expand Up @@ -339,6 +364,12 @@ self: super:
}
);

gitpython = super.gitpython.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.typing-extensions ];
}
);

grpcio = super.grpcio.overridePythonAttrs (old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.cython pkgs.pkg-config ];
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.c-ares pkgs.openssl pkgs.zlib ];
Expand Down Expand Up @@ -549,6 +580,13 @@ self: super:
}
);

jupyterlab-widgets = super.jupyterlab-widgets.overridePythonAttrs (
old: rec {
buildInputs = (old.buildInputs or [ ]) ++ [ self.jupyter-packaging ];
}
);


keyring = super.keyring.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [
Expand Down Expand Up @@ -581,8 +619,32 @@ self: super:
propagatedBuildInputs = [ pkgs.libvirt ];
});

licensecheck = super.licensecheck.overridePythonAttrs (old: {
dontPreferSetupPy = true;
});

llvmlite = super.llvmlite.overridePythonAttrs (
old: {
old:
let
llvm =
if lib.versionAtLeast old.version "0.37.0" then
pkgs.llvmPackages_11.llvm
else if (lib.versionOlder old.version "0.37.0" && lib.versionAtLeast old.version "0.34.0") then
pkgs.llvmPackages_10.llvm
else if (lib.versionOlder old.version "0.34.0" && lib.versionAtLeast old.version "0.33.0") then
pkgs.llvmPackages_9.llvm
else if (lib.versionOlder old.version "0.33.0" && lib.versionAtLeast old.version "0.29.0") then
pkgs.llvmPackages_8.llvm
else if (lib.versionOlder old.version "0.28.0" && lib.versionAtLeast old.version "0.27.0") then
pkgs.llvmPackages_7.llvm
else if (lib.versionOlder old.version "0.27.0" && lib.versionAtLeast old.version "0.23.0") then
pkgs.llvmPackages_6.llvm
else if (lib.versionOlder old.version "0.23.0" && lib.versionAtLeast old.version "0.21.0") then
pkgs.llvmPackages_5.llvm
else
pkgs.llvm; # Likely to fail.
in
{
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.llvm ];

# Disable static linking
Expand All @@ -595,12 +657,12 @@ self: super:

# Set directory containing llvm-config binary
preConfigure = ''
export LLVM_CONFIG=${pkgs.llvm}/bin/llvm-config
export LLVM_CONFIG=${llvm.dev}/bin/llvm-config
'';

__impureHostDeps = lib.optionals pkgs.stdenv.isDarwin [ "/usr/lib/libm.dylib" ];

passthru = old.passthru // { llvm = pkgs.llvm; };
passthru = old.passthru // { llvm = llvm; };
}
);

Expand Down Expand Up @@ -651,6 +713,7 @@ self: super:
cat > setup.cfg <<EOF
[libs]
system_freetype = True
system_qhull = True
'' + lib.optionalString stdenv.isDarwin ''
# LTO not working in darwin stdenv, see NixOS/nixpkgs/pull/19312
enable_lto = false
Expand All @@ -661,12 +724,17 @@ self: super:
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [
pkgs.libpng
pkgs.freetype
pkgs.qhull
]
++ lib.optionals enableGtk3 [ pkgs.cairo self.pycairo pkgs.gtk3 pkgs.gobject-introspection self.pygobject3 ]
++ lib.optionals enableTk [ pkgs.tcl pkgs.tk self.tkinter pkgs.libX11 ]
++ lib.optionals enableQt [ self.pyqt5 ]
;

preBuild = ''
cp -r ${pkgs.qhull} .
'';

inherit (super.matplotlib) patches;
}
);
Expand All @@ -691,6 +759,12 @@ self: super:
}
);

mmdet = super.mmdet.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pytorch ];
}
);

molecule =
if lib.versionOlder super.molecule.version "3.0.0" then
(super.molecule.overridePythonAttrs (
Expand Down Expand Up @@ -760,7 +834,11 @@ self: super:

mypy = super.mypy.overridePythonAttrs (
old: {
MYPY_USE_MYPYC = pkgs.stdenv.buildPlatform.is64bit;
MYPY_USE_MYPYC =
# is64bit: unfortunately the build would exhaust all possible memory on i686-linux.
stdenv.buildPlatform.is64bit
# Derivation fails to build since v0.900 if mypyc is enabled.
&& lib.strings.versionOlder old.version "0.900";
}
);

Expand Down Expand Up @@ -830,6 +908,12 @@ self: super:
}
);

opencv-python = super.opencv-python.overridePythonAttrs (
old: rec {
buildInputs = (old.buildInputs or [ ]) ++ [ self.scikit-build ];
}
);

openexr = super.openexr.overridePythonAttrs (
old: rec {
buildInputs = (old.buildInputs or [ ]) ++ [ pkgs.openexr pkgs.ilmbase ];
Expand Down Expand Up @@ -899,6 +983,12 @@ self: super:
};
}) else super.pip;

platformdirs = super.platformdirs.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.py --replace 'setup()' 'setup(version="${old.version}")'
'';
});

poetry-core = super.poetry-core.overridePythonAttrs (old: {
# "Vendor" dependencies (for build-system support)
postPatch = ''
Expand Down Expand Up @@ -1285,6 +1375,12 @@ self: super:
}
);

pytest-randomly = super.pytest-randomly.overrideAttrs (old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [
self.importlib-metadata
];
});

pytest-runner = super.pytest-runner or super.pytestrunner;

pytest-pylint = super.pytest-pylint.overridePythonAttrs (
Expand Down Expand Up @@ -1326,6 +1422,10 @@ self: super:
}
);

pythran = super.pythran.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ];
});

ffmpeg-python = super.ffmpeg-python.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pytest-runner ];
Expand All @@ -1350,6 +1450,13 @@ self: super:
}
);

pywavelets = super.pywavelets.overridePythonAttrs (
old: {
HDF5_DIR = "${pkgs.hdf5}";
propagatedBuildInputs = (old.propagatedBuildInputs or [ ]) ++ [ pkgs.hdf5 ];
}
);

pyzmq = super.pyzmq.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ];
Expand Down Expand Up @@ -1426,6 +1533,13 @@ self: super:
'';
});

ruamel-yaml = super.ruamel-yaml.overridePythonAttrs (
old: {
propagatedBuildInputs = (old.propagatedBuildInputs or [ ])
++ [ self.ruamel-yaml-clib ];
}
);

scipy = super.scipy.overridePythonAttrs (
old:
if old.format != "wheel" then {
Expand Down Expand Up @@ -1479,18 +1593,28 @@ self: super:
}
);

shellingham =
if lib.versionAtLeast super.shellingham.version "1.3.2" then
(
super.shellingham.overridePythonAttrs (
old: {
format = "pyproject";
}
)
) else super.shellingham;
shellcheck-py = super.shellcheck-py.overridePythonAttrs (old: {

# Make fetching/installing external binaries no-ops
preConfigure =
let
fakeCommand = "type('FakeCommand', (Command,), {'initialize_options': lambda self: None, 'finalize_options': lambda self: None, 'run': lambda self: None})";
in
''
substituteInPlace setup.py \
--replace "'fetch_binaries': fetch_binaries," "'fetch_binaries': ${fakeCommand}," \
--replace "'install_shellcheck': install_shellcheck," "'install_shellcheck': ${fakeCommand},"
'';

propagatedUserEnvPkgs = (old.propagatedUserEnvPkgs or [ ]) ++ [
pkgs.shellcheck
];

});

tables = super.tables.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.pywavelets ];
HDF5_DIR = "${pkgs.hdf5}";
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.pkg-config ];
propagatedBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ pkgs.hdf5 self.numpy self.numexpr ];
Expand All @@ -1508,6 +1632,27 @@ self: super:
}
);

tensorboard = super.tensorboard.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [
self.wheel
self.absl-py
];
HDF5_DIR = "${pkgs.hdf5}";
propagatedBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
pkgs.hdf5
self.google-auth-oauthlib
self.tensorboard-plugin-wit
self.numpy
self.markdown
self.tensorboard-data-server
self.grpcio
self.protobuf
self.werkzeug
];
}
);

tensorflow = super.tensorflow.overridePythonAttrs (
old: {
postInstall = ''
Expand Down Expand Up @@ -1667,6 +1812,14 @@ self: super:
'';
};

weblate-language-data = super.weblate-language-data.overridePythonAttrs (
old: {
buildInputs = (old.buildInputs or [ ]) ++ [
self.translate-toolkit
];
}
);

wheel =
let
isWheel = super.wheel.src.isWheel or false;
Expand Down Expand Up @@ -1887,7 +2040,7 @@ self: super:
pendulum = super.pendulum.overridePythonAttrs (old: {
# Technically incorrect, but fixes the build error..
preInstall = lib.optionalString stdenv.isLinux ''
mv ./dist/*.whl $(echo ./dist/*.whl | sed s/'manylinux_[0-9]*_[0-9]*'/'manylinux1'/)
mv --no-clobber ./dist/*.whl $(echo ./dist/*.whl | sed s/'manylinux_[0-9]*_[0-9]*'/'manylinux1'/)
'';
});

Expand Down Expand Up @@ -1917,6 +2070,12 @@ self: super:
});

tomli = super.tomli.overridePythonAttrs (old: {
buildInputs = (old.buildInputs or [ ]) ++ [ self.flit-core ];
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.flit-core ];
});

virtualenv = super.virtualenv.overridePythonAttrs (old: {
postPatch = ''
substituteInPlace setup.cfg --replace 'platformdirs>=2,<3' 'platformdirs'
'';
});
}

0 comments on commit c93472b

Please sign in to comment.