Skip to content

Commit

Permalink
Merge pull request #309391 from mweinelt/do-things
Browse files Browse the repository at this point in the history
Various python fixes ZHF-style.
  • Loading branch information
mweinelt authored May 6, 2024
2 parents 8f65060 + e726d86 commit e3f29be
Show file tree
Hide file tree
Showing 10 changed files with 76 additions and 36 deletions.
5 changes: 5 additions & 0 deletions pkgs/by-name/pr/pretix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ python.pkgs.buildPythonApplication rec {
"--reruns" "3"
];

disabledTests = [
# unreliable around day changes
"test_order_create_invoice"
];

preCheck = ''
export PYTHONPATH=$(pwd)/src:$PYTHONPATH
export DJANGO_SETTINGS_MODULE=tests.settings
Expand Down
1 change: 1 addition & 0 deletions pkgs/development/python-modules/aiodhcpwatcher/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,6 @@ buildPythonPackage rec {
changelog = "https://github.com/bdraco/aiodhcpwatcher/blob/${src.rev}/CHANGELOG.md";
license = licenses.gpl3Only;
maintainers = with maintainers; [ hexa ];
platforms = platforms.linux;
};
}
8 changes: 8 additions & 0 deletions pkgs/development/python-modules/faster-fifo/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, stdenv
, gcc12Stdenv

# build-system
, cython
Expand All @@ -11,11 +13,17 @@
, unittestCheckHook
}:

let
stdenv' = if stdenv.isLinux then gcc12Stdenv else stdenv;
in
buildPythonPackage rec {
pname = "faster-fifo";
version = "1.4.5";
format = "pyproject";

# https://github.com/alex-petrenko/faster-fifo/issues/47\
stdenv = stdenv';

src = fetchFromGitHub {
owner = "alex-petrenko";
repo = "faster-fifo";
Expand Down
34 changes: 16 additions & 18 deletions pkgs/development/python-modules/librosa/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
, stdenv
, buildPythonPackage
, fetchFromGitHub
, fetchpatch

# build-system
, setuptools
Expand Down Expand Up @@ -34,34 +33,24 @@

buildPythonPackage rec {
pname = "librosa";
version = "0.10.1";
version = "0.10.2";
format = "pyproject";

src = fetchFromGitHub {
owner = "librosa";
repo = "librosa";
rev = "refs/tags/${version}";
fetchSubmodules = true; # for test data
hash = "sha256-zbmU87hI9A1CVcBZ/5FU8z0t6SS4jfJk9bj9kLe/EHI=";
hash = "sha256-zUKljPKWOhyb3Zv4KEUcvLsVkxVhL+rzErKycAl6jIg=";
};

nativeBuildInputs = [
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 = ''
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 = [
Expand Down Expand Up @@ -107,11 +96,20 @@ buildPythonPackage rec {
"test_example"
"test_example_info"
"test_load_resample"
# does not converge
"test_nnls_vector"
"test_cite_released"
"test_cite_badversion"
"test_cite_unreleased"
] ++ lib.optionals stdenv.isDarwin [
# https://github.com/librosa/librosa/pull/1808
"test_pyin_multi_center"
# crashing the python interpreter
"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; {
Expand Down
5 changes: 5 additions & 0 deletions pkgs/development/python-modules/paypalhttp/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ buildPythonPackage rec {
hash = "sha256-3ihcpYtpcejPkiyf4g4jveyNU6flQB2sv9EZ5Pd7tUc=";
};

postPatch = ''
substituteInPlace tests/http_response_test.py \
--replace-fail assertEquals assertEqual
'';

propagatedBuildInputs = [
requests
six
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/pyct/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
, fetchPypi
, param
, pytestCheckHook
, pythonOlder
, pythonAtLeast
, pyyaml
, requests
}:
Expand All @@ -13,7 +13,7 @@ buildPythonPackage rec {
version = "0.5.0";
format = "setuptools";

disabled = pythonOlder "3.7";
disabled = pythonAtLeast "3.12";

src = fetchPypi {
inherit pname version;
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/pytest-mpl/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
, pytest
, jinja2
, matplotlib
, nose
, pynose
, pillow
, pytestCheckHook
}:
Expand All @@ -31,7 +31,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [
jinja2
matplotlib
nose
pynose
pillow
];

Expand Down
43 changes: 33 additions & 10 deletions pkgs/development/python-modules/samplerate/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,56 @@
, stdenv
, buildPythonPackage
, fetchFromGitHub

# build-system
, cmake
, setuptools
, setuptools-scm
, pybind11

# dependencies
, cffi
, numpy

# native dependencies
, libsamplerate

# tests
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "samplerate";
version = "0.1.0";
format = "setuptools";
version = "0.2.1";
pyproject = true;

src = fetchFromGitHub {
owner = "tuxu";
repo = "python-samplerate";
rev = "refs/tags/${version}";
hash = "sha256-lHZ9SVnKcsEsnKYXR/QocGbKPEoA7yCZxXvrNPeH1rA=";
rev = "refs/tags/v${version}";
hash = "sha256-/9NFJcn8R0DFjVhFAIYOtzZM90hjVIfsVXFlS0nHNhA=";
};

postPatch = ''
substituteInPlace setup.py \
--replace ", 'pytest-runner'" ""
substituteInPlace samplerate/lowlevel.py --replace \
"lib_filename = _find_library('samplerate')" \
'lib_filename = "${libsamplerate.out}/lib/libsamplerate${stdenv.hostPlatform.extensions.sharedLibrary}"'
# unvendor pybind11, libsamplerate
rm -r external
substituteInPlace CMakeLists.txt \
--replace-fail "add_subdirectory(external)" "find_package(pybind11 REQUIRED)"
'';

build-system = [
cmake
setuptools
setuptools-scm
pybind11
];

dontUseCmakeConfigure = true;

buildInputs = [
libsamplerate
];

propagatedBuildInputs = [
cffi
numpy
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/tensorflow/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ stdenv, bazel_5, buildBazelPackage, lib, fetchFromGitHub, symlinkJoin
, addOpenGLRunpath, fetchpatch, fetchzip, linkFarm
# Python deps
, buildPythonPackage, pythonOlder, python
, buildPythonPackage, pythonAtLeast, pythonOlder, python
# Python libraries
, numpy, tensorboard, abseil-cpp, absl-py
, packaging, setuptools, wheel, keras-preprocessing, google-pasta
Expand Down Expand Up @@ -500,7 +500,7 @@ let

in buildPythonPackage {
inherit version pname;
disabled = pythonOlder "3.8";
disabled = pythonAtLeast "3.12";

src = bazel-build.python;

Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/python-modules/wxpython/4.2.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
, stdenv
, buildPythonPackage
, setuptools
, pythonOlder
, pythonAtLeast
, fetchPypi
, substituteAll

Expand Down Expand Up @@ -43,7 +43,7 @@ buildPythonPackage rec {
pname = "wxpython";
version = "4.2.1";
format = "other";
disabled = pythonOlder "3.7";
disabled = pythonAtLeast "3.12";

src = fetchPypi {
pname = "wxPython";
Expand Down

0 comments on commit e3f29be

Please sign in to comment.