0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

pkgs/development/python-modules: stdenv.lib -> lib

This commit is contained in:
Pavol Rusnak 2021-01-24 01:29:22 +01:00
parent 2f34b4b883
commit a4bbfba80d
No known key found for this signature in database
GPG key ID: 91F3B339B9A02A3D
211 changed files with 525 additions and 546 deletions

View file

@ -1,6 +1,7 @@
# Python 2 expression
{ buildPythonPackage
{ lib
, buildPythonPackage
, fetchPypi
, python
, stdenv
@ -26,11 +27,7 @@
, libcxx ? null
}:
let
inherit (stdenv.lib) optional optionals optionalString;
inherit (stdenv) isDarwin;
in buildPythonPackage rec {
buildPythonPackage rec {
pname = "pandas";
version = "0.24.2";
@ -42,7 +39,7 @@ in buildPythonPackage rec {
checkInputs = [ pytest glibcLocales moto hypothesis ];
nativeBuildInputs = [ cython ];
buildInputs = optional isDarwin libcxx;
buildInputs = lib.optional stdenv.isDarwin libcxx;
propagatedBuildInputs = [
dateutil
scipy
@ -61,7 +58,7 @@ in buildPythonPackage rec {
# For OSX, we need to add a dependency on libcxx, which provides
# `complex.h` and other libraries that pandas depends on to build.
postPatch = optionalString isDarwin ''
postPatch = lib.optionalString stdenv.isDarwin ''
cpp_sdk="${libcxx}/include/c++/v1";
echo "Adding $cpp_sdk to the setup.py common_include variable"
substituteInPlace setup.py \
@ -70,7 +67,7 @@ in buildPythonPackage rec {
'';
disabledTests = stdenv.lib.concatMapStringsSep " and " (s: "not " + s) ([
disabledTests = lib.concatMapStringsSep " and " (s: "not " + s) ([
# since dateutil 0.6.0 the following fails: test_fallback_plural, test_ambiguous_flags, test_ambiguous_compat
# was supposed to be solved by https://github.com/dateutil/dateutil/issues/321, but is not the case
"test_fallback_plural"
@ -86,7 +83,7 @@ in buildPythonPackage rec {
"io"
# KeyError Timestamp
"test_to_excel"
] ++ optionals isDarwin [
] ++ lib.optionals stdenv.isDarwin [
"test_locale"
"test_clipboard"
]);
@ -98,7 +95,7 @@ in buildPythonPackage rec {
''
# TODO: Get locale and clipboard support working on darwin.
# Until then we disable the tests.
+ optionalString isDarwin ''
+ lib.optionalString stdenv.isDarwin ''
# Fake the impure dependencies pbpaste and pbcopy
echo "#!${runtimeShell}" > pbcopy
echo "#!${runtimeShell}" > pbpaste
@ -109,14 +106,14 @@ in buildPythonPackage rec {
runHook postCheck
'';
meta = {
meta = with lib; {
# https://github.com/pandas-dev/pandas/issues/14866
# pandas devs are no longer testing i686 so safer to assume it's broken
broken = stdenv.isi686;
homepage = "https://pandas.pydata.org/";
description = "Python Data Analysis Library";
license = stdenv.lib.licenses.bsd3;
maintainers = with stdenv.lib.maintainers; [ raskin knedlsepp ];
platforms = stdenv.lib.platforms.unix;
license = licenses.bsd3;
maintainers = with maintainers; [ raskin knedlsepp ];
platforms = platforms.unix;
};
}

View file

@ -27,11 +27,7 @@
, libcxx ? null
}:
let
inherit (stdenv.lib) optional optionals optionalString;
inherit (stdenv) isDarwin;
in buildPythonPackage rec {
buildPythonPackage rec {
pname = "pandas";
version = "1.1.5";
@ -41,7 +37,7 @@ in buildPythonPackage rec {
};
nativeBuildInputs = [ cython ];
buildInputs = optional isDarwin libcxx;
buildInputs = lib.optional stdenv.isDarwin libcxx;
propagatedBuildInputs = [
beautifulsoup4
bottleneck
@ -62,11 +58,11 @@ in buildPythonPackage rec {
# doesn't work with -Werror,-Wunused-command-line-argument
# https://github.com/NixOS/nixpkgs/issues/39687
hardeningDisable = optional stdenv.cc.isClang "strictoverflow";
hardeningDisable = lib.optional stdenv.cc.isClang "strictoverflow";
# For OSX, we need to add a dependency on libcxx, which provides
# `complex.h` and other libraries that pandas depends on to build.
postPatch = optionalString isDarwin ''
postPatch = lib.optionalString stdenv.isDarwin ''
cpp_sdk="${libcxx}/include/c++/v1";
echo "Adding $cpp_sdk to the setup.py common_include variable"
substituteInPlace setup.py \
@ -76,7 +72,7 @@ in buildPythonPackage rec {
# Parallel Cythonization is broken in Python 3.8 on Darwin. Fixed in the next
# release. https://github.com/pandas-dev/pandas/pull/30862
setupPyBuildFlags = optionals (!(isPy38 && isDarwin)) [
setupPyBuildFlags = lib.optionals (!(isPy38 && stdenv.isDarwin)) [
# As suggested by
# https://pandas.pydata.org/pandas-docs/stable/development/contributing.html#creating-a-python-environment
"--parallel=$NIX_BUILD_CORES"
@ -114,7 +110,7 @@ in buildPythonPackage rec {
"test_constructor_with_embedded_frames"
# tries to import compiled C extension locally
"test_missing_required_dependency"
] ++ optionals isDarwin [
] ++ lib.optionals stdenv.isDarwin [
"test_locale"
"test_clipboard"
];
@ -128,7 +124,7 @@ in buildPythonPackage rec {
''
# TODO: Get locale and clipboard support working on darwin.
# Until then we disable the tests.
+ optionalString isDarwin ''
+ lib.optionalString stdenv.isDarwin ''
# Fake the impure dependencies pbpaste and pbcopy
echo "#!${runtimeShell}" > pbcopy
echo "#!${runtimeShell}" > pbpaste