Merge pull request #309391 from mweinelt/do-things

Various python fixes ZHF-style.
This commit is contained in:
Martin Weinelt 2024-05-06 11:31:21 +02:00 committed by GitHub
commit e3f29be1d3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 76 additions and 36 deletions

View File

@ -213,6 +213,11 @@ python.pkgs.buildPythonApplication rec {
"--reruns" "3" "--reruns" "3"
]; ];
disabledTests = [
# unreliable around day changes
"test_order_create_invoice"
];
preCheck = '' preCheck = ''
export PYTHONPATH=$(pwd)/src:$PYTHONPATH export PYTHONPATH=$(pwd)/src:$PYTHONPATH
export DJANGO_SETTINGS_MODULE=tests.settings export DJANGO_SETTINGS_MODULE=tests.settings

View File

@ -52,5 +52,6 @@ buildPythonPackage rec {
changelog = "https://github.com/bdraco/aiodhcpwatcher/blob/${src.rev}/CHANGELOG.md"; changelog = "https://github.com/bdraco/aiodhcpwatcher/blob/${src.rev}/CHANGELOG.md";
license = licenses.gpl3Only; license = licenses.gpl3Only;
maintainers = with maintainers; [ hexa ]; maintainers = with maintainers; [ hexa ];
platforms = platforms.linux;
}; };
} }

View File

@ -1,6 +1,8 @@
{ lib { lib
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, stdenv
, gcc12Stdenv
# build-system # build-system
, cython , cython
@ -11,11 +13,17 @@
, unittestCheckHook , unittestCheckHook
}: }:
let
stdenv' = if stdenv.isLinux then gcc12Stdenv else stdenv;
in
buildPythonPackage rec { buildPythonPackage rec {
pname = "faster-fifo"; pname = "faster-fifo";
version = "1.4.5"; version = "1.4.5";
format = "pyproject"; format = "pyproject";
# https://github.com/alex-petrenko/faster-fifo/issues/47\
stdenv = stdenv';
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "alex-petrenko"; owner = "alex-petrenko";
repo = "faster-fifo"; repo = "faster-fifo";

View File

@ -2,7 +2,6 @@
, stdenv , stdenv
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
, fetchpatch
# build-system # build-system
, setuptools , setuptools
@ -34,7 +33,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "librosa"; pname = "librosa";
version = "0.10.1"; version = "0.10.2";
format = "pyproject"; format = "pyproject";
src = fetchFromGitHub { src = fetchFromGitHub {
@ -42,26 +41,16 @@ buildPythonPackage rec {
repo = "librosa"; repo = "librosa";
rev = "refs/tags/${version}"; rev = "refs/tags/${version}";
fetchSubmodules = true; # for test data fetchSubmodules = true; # for test data
hash = "sha256-zbmU87hI9A1CVcBZ/5FU8z0t6SS4jfJk9bj9kLe/EHI="; hash = "sha256-zUKljPKWOhyb3Zv4KEUcvLsVkxVhL+rzErKycAl6jIg=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
setuptools setuptools
]; ];
patches = [
(fetchpatch {
# https://github.com/librosa/librosa/issues/1754
# https://github.com/librosa/librosa/pull/1755
name = "matplotlib-3.8-compat.patch";
url = "https://github.com/librosa/librosa/commit/beef47885ce1255b43b65e48ea2054ddace37c6c.patch";
hash = "sha256-rrnlUHXHY2me4BWGs3wFq8WJmz75CbXTWKFp3VdJKzE=";
})
];
postPatch = '' postPatch = ''
substituteInPlace setup.cfg \ substituteInPlace setup.cfg \
--replace "--cov-report term-missing --cov librosa --cov-report=xml " "" --replace-fail "--cov-report term-missing --cov librosa --cov-report=xml " ""
''; '';
propagatedBuildInputs = [ propagatedBuildInputs = [
@ -107,11 +96,20 @@ buildPythonPackage rec {
"test_example" "test_example"
"test_example_info" "test_example_info"
"test_load_resample" "test_load_resample"
# does not converge "test_cite_released"
"test_nnls_vector" "test_cite_badversion"
"test_cite_unreleased"
] ++ lib.optionals stdenv.isDarwin [ ] ++ lib.optionals stdenv.isDarwin [
# https://github.com/librosa/librosa/pull/1808 # crashing the python interpreter
"test_pyin_multi_center" "test_unknown_time_unit"
"test_unknown_wavaxis"
"test_waveshow_unknown_wavaxis"
"test_waveshow_bad_maxpoints"
"test_waveshow_deladaptor"
"test_waveshow_disconnect"
"test_unknown_axis"
"test_axis_bound_warning"
"test_auto_aspect"
]; ];
meta = with lib; { meta = with lib; {

View File

@ -24,6 +24,11 @@ buildPythonPackage rec {
hash = "sha256-3ihcpYtpcejPkiyf4g4jveyNU6flQB2sv9EZ5Pd7tUc="; hash = "sha256-3ihcpYtpcejPkiyf4g4jveyNU6flQB2sv9EZ5Pd7tUc=";
}; };
postPatch = ''
substituteInPlace tests/http_response_test.py \
--replace-fail assertEquals assertEqual
'';
propagatedBuildInputs = [ propagatedBuildInputs = [
requests requests
six six

View File

@ -3,7 +3,7 @@
, fetchPypi , fetchPypi
, param , param
, pytestCheckHook , pytestCheckHook
, pythonOlder , pythonAtLeast
, pyyaml , pyyaml
, requests , requests
}: }:
@ -13,7 +13,7 @@ buildPythonPackage rec {
version = "0.5.0"; version = "0.5.0";
format = "setuptools"; format = "setuptools";
disabled = pythonOlder "3.7"; disabled = pythonAtLeast "3.12";
src = fetchPypi { src = fetchPypi {
inherit pname version; inherit pname version;

View File

@ -5,7 +5,7 @@
, pytest , pytest
, jinja2 , jinja2
, matplotlib , matplotlib
, nose , pynose
, pillow , pillow
, pytestCheckHook , pytestCheckHook
}: }:
@ -31,7 +31,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [ propagatedBuildInputs = [
jinja2 jinja2
matplotlib matplotlib
nose pynose
pillow pillow
]; ];

View File

@ -2,33 +2,56 @@
, stdenv , stdenv
, buildPythonPackage , buildPythonPackage
, fetchFromGitHub , fetchFromGitHub
# build-system
, cmake
, setuptools
, setuptools-scm
, pybind11
# dependencies
, cffi , cffi
, numpy , numpy
# native dependencies
, libsamplerate , libsamplerate
# tests
, pytestCheckHook , pytestCheckHook
}: }:
buildPythonPackage rec { buildPythonPackage rec {
pname = "samplerate"; pname = "samplerate";
version = "0.1.0"; version = "0.2.1";
format = "setuptools"; pyproject = true;
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "tuxu"; owner = "tuxu";
repo = "python-samplerate"; repo = "python-samplerate";
rev = "refs/tags/${version}"; rev = "refs/tags/v${version}";
hash = "sha256-lHZ9SVnKcsEsnKYXR/QocGbKPEoA7yCZxXvrNPeH1rA="; hash = "sha256-/9NFJcn8R0DFjVhFAIYOtzZM90hjVIfsVXFlS0nHNhA=";
}; };
postPatch = '' postPatch = ''
substituteInPlace setup.py \ # unvendor pybind11, libsamplerate
--replace ", 'pytest-runner'" "" rm -r external
substituteInPlace CMakeLists.txt \
substituteInPlace samplerate/lowlevel.py --replace \ --replace-fail "add_subdirectory(external)" "find_package(pybind11 REQUIRED)"
"lib_filename = _find_library('samplerate')" \
'lib_filename = "${libsamplerate.out}/lib/libsamplerate${stdenv.hostPlatform.extensions.sharedLibrary}"'
''; '';
build-system = [
cmake
setuptools
setuptools-scm
pybind11
];
dontUseCmakeConfigure = true;
buildInputs = [
libsamplerate
];
propagatedBuildInputs = [ propagatedBuildInputs = [
cffi cffi
numpy numpy

View File

@ -1,7 +1,7 @@
{ stdenv, bazel_5, buildBazelPackage, lib, fetchFromGitHub, symlinkJoin { stdenv, bazel_5, buildBazelPackage, lib, fetchFromGitHub, symlinkJoin
, addOpenGLRunpath, fetchpatch, fetchzip, linkFarm , addOpenGLRunpath, fetchpatch, fetchzip, linkFarm
# Python deps # Python deps
, buildPythonPackage, pythonOlder, python , buildPythonPackage, pythonAtLeast, pythonOlder, python
# Python libraries # Python libraries
, numpy, tensorboard, abseil-cpp, absl-py , numpy, tensorboard, abseil-cpp, absl-py
, packaging, setuptools, wheel, keras-preprocessing, google-pasta , packaging, setuptools, wheel, keras-preprocessing, google-pasta
@ -500,7 +500,7 @@ let
in buildPythonPackage { in buildPythonPackage {
inherit version pname; inherit version pname;
disabled = pythonOlder "3.8"; disabled = pythonAtLeast "3.12";
src = bazel-build.python; src = bazel-build.python;

View File

@ -2,7 +2,7 @@
, stdenv , stdenv
, buildPythonPackage , buildPythonPackage
, setuptools , setuptools
, pythonOlder , pythonAtLeast
, fetchPypi , fetchPypi
, substituteAll , substituteAll
@ -43,7 +43,7 @@ buildPythonPackage rec {
pname = "wxpython"; pname = "wxpython";
version = "4.2.1"; version = "4.2.1";
format = "other"; format = "other";
disabled = pythonOlder "3.7"; disabled = pythonAtLeast "3.12";
src = fetchPypi { src = fetchPypi {
pname = "wxPython"; pname = "wxPython";