git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #46488 from xeji/p/python-fixes
2bc08cexeji
pkgs/development/python-modules/pydub/default.nix+17−7
@@ -1,19 +1,29 @@
1−{ stdenv, buildPythonPackage, fetchPypi, scipy, ffmpeg-full }:
1+{ stdenv, buildPythonPackage, fetchFromGitHub, scipy, ffmpeg-full }:
2
2
3buildPythonPackage rec {
3buildPythonPackage rec {
4 pname = "pydub";
4 pname = "pydub";
5 version = "0.22.1";
5 version = "0.22.1";
6− src = fetchPypi {
6+ # pypi version doesn't include required data files for tests
7+ src = fetchFromGitHub {
8+ owner = "jiaaro";
9+ repo = pname;
7− inherit pname version;
10+ rev = "v${version}";
8− sha256 = "20beff39e9959a3b2cb4392802aecb9b2417837fff635d2b00b5ef5f5326d313";
11+ sha256 = "0xqyvzgdfy01p98wnvsrf6iwdfq91ad377r6j12r8svm13ygx5bv";
9 };
12 };
10
13
11− patches = [
14+
12− ./pyaudioop-python3.patch
15+ # disable a test that fails on aarch64 due to rounding errors
16+ postPatch = stdenv.lib.optionalString stdenv.isAarch64 ''
17+ substituteInPlace test/test.py \
18+ --replace "test_overlay_with_gain_change" "notest_overlay_with_gain_change"
13− ];
19+ '';
14
20
15 checkInputs = [ scipy ffmpeg-full ];
21 checkInputs = [ scipy ffmpeg-full ];
16
22
23+ checkPhase = ''
24+ python test/test.py
25+ '';
26+
17 meta = with stdenv.lib; {
27 meta = with stdenv.lib; {
18 description = "Manipulate audio with a simple and easy high level interface.";
28 description = "Manipulate audio with a simple and easy high level interface.";
19 homepage = "http://pydub.com/";
29 homepage = "http://pydub.com/";
pkgs/development/python-modules/pydub/pyaudioop-python3.patchdeleted−46
@@ -1,46 +0,0 @@
1−diff --git i/pydub/pyaudioop.py w/pydub/pyaudioop.py
2−index 8f8f017..aa6bb8c 100644
3−--- i/pydub/pyaudioop.py
4−+++ w/pydub/pyaudioop.py
5−@@ -1,4 +1,4 @@
6−-import __builtin__
7−+import builtins
8− import math
9− import struct
10− from fractions import gcd
11−@@ -79,7 +79,7 @@ def _get_minval(size, signed=True):
12− def _get_clipfn(size, signed=True):
13− maxval = _get_maxval(size, signed)
14− minval = _get_minval(size, signed)
15−- return lambda val: __builtin__.max(min(val, maxval), minval)
16−+ return lambda val: builtins.max(min(val, maxval), minval)
17−
18−
19− def _overflow(val, size, signed=True):
20−@@ -109,7 +109,7 @@ def max(cp, size):
21− if len(cp) == 0:
22− return 0
23−
24−- return __builtin__.max(abs(sample) for sample in _get_samples(cp, size))
25−+ return builtins.max(abs(sample) for sample in _get_samples(cp, size))
26−
27−
28− def minmax(cp, size):
29−@@ -117,8 +117,8 @@ def minmax(cp, size):
30−
31− max_sample, min_sample = 0, 0
32− for sample in _get_samples(cp, size):
33−- max_sample = __builtin__.max(sample, max_sample)
34−- min_sample = __builtin__.min(sample, min_sample)
35−+ max_sample = builtins.max(sample, max_sample)
36−+ min_sample = builtins.min(sample, min_sample)
37−
38− return min_sample, max_sample
39−
40−@@ -542,4 +542,4 @@ def lin2adpcm(cp, size, state):
41−
42−
43− def adpcm2lin(cp, size, state):
44−- raise NotImplementedError()
45−\ No newline at end of file
46−+ raise NotImplementedError()
pkgs/development/python-modules/pyfakefs/default.nix+16−8
@@ -1,7 +1,7 @@
1{ stdenv, buildPythonPackage, fetchFromGitHub, python, pytest, glibcLocales }:
1{ stdenv, buildPythonPackage, fetchFromGitHub, python, pytest, glibcLocales }:
2
2
3buildPythonPackage rec {
3buildPythonPackage rec {
4− version = "3.4.1";
4+ version = "3.4.3";
5 pname = "pyfakefs";
5 pname = "pyfakefs";
6
6
7 # no tests in PyPI tarball
7 # no tests in PyPI tarball
@@ -10,22 +10,30 @@ buildPythonPackage rec {
10 owner = "jmcgeheeiv";
10 owner = "jmcgeheeiv";
11 repo = pname;
11 repo = pname;
12 rev = "v${version}";
12 rev = "v${version}";
13− sha256 = "0i8kq7sl8bczr927hllgfhsmirjqjh89c9184kcqmprc13ac4kxy";
13+ sha256 = "0rhbkcb5h2x8kmyxivr5jr1db2xvmpjdbsfjxl142qhfb29hr2hp";
14 };
14 };
15
15
16 postPatch = ''
16 postPatch = ''
17 # test doesn't work in sandbox
17 # test doesn't work in sandbox
18− substituteInPlace tests/fake_filesystem_test.py \
18+ substituteInPlace pyfakefs/tests/fake_filesystem_test.py \
19 --replace "test_expand_root" "notest_expand_root"
19 --replace "test_expand_root" "notest_expand_root"
20+ substituteInPlace pyfakefs/tests/fake_os_test.py \
21+ --replace "test_path_links_not_resolved" "notest_path_links_not_resolved" \
22+ --replace "test_append_mode_tell_linux_windows" "notest_append_mode_tell_linux_windows"
23+ substituteInPlace pyfakefs/tests/fake_filesystem_unittest_test.py \
24+ --replace "test_copy_real_file" "notest_copy_real_file"
25+ '' + (stdenv.lib.optionalString stdenv.isDarwin ''
26+ # this test fails on darwin due to case-insensitive file system
20− substituteInPlace tests/fake_os_test.py \
27+ substituteInPlace pyfakefs/tests/fake_os_test.py \
21− --replace "test_append_mode" "notest_append_mode"
28+ --replace "test_rename_dir_to_existing_dir" "notest_rename_dir_to_existing_dir"
22− '';
29+ '');
23
30
24 checkInputs = [ pytest glibcLocales ];
31 checkInputs = [ pytest glibcLocales ];
25
32
26 checkPhase = ''
33 checkPhase = ''
34+ export LC_ALL=en_US.UTF-8
27− LC_ALL=en_US.UTF-8 ${python.interpreter} -m tests.all_tests
35+ ${python.interpreter} -m pyfakefs.tests.all_tests
28− py.test tests/pytest_plugin_test.py
36+ ${python.interpreter} -m pytest pyfakefs/tests/pytest_plugin_test.py
29 '';
37 '';
30
38
31 meta = with stdenv.lib; {
39 meta = with stdenv.lib; {
pkgs/development/python-modules/readme_renderer/default.nix+2−1
@@ -27,7 +27,8 @@ buildPythonPackage rec {
27 ];
27 ];
28
28
29 checkPhase = ''
29 checkPhase = ''
30− py.test
30+ # disable one failing test case
31+ py.test -k "not test_invalid_link"
31 '';
32 '';
32
33
33 meta = {
34 meta = {
pkgs/development/python-modules/restview/default.nix+10
@@ -1,6 +1,7 @@
1{ lib
1{ lib
2, buildPythonPackage
2, buildPythonPackage
3, fetchPypi
3, fetchPypi
4+, fetchpatch
4, docutils
5, docutils
5, readme_renderer
6, readme_renderer
6, pygments
7, pygments
@@ -19,6 +20,15 @@ buildPythonPackage rec {
19 propagatedBuildInputs = [ docutils readme_renderer pygments ];
20 propagatedBuildInputs = [ docutils readme_renderer pygments ];
20 checkInputs = [ mock ];
21 checkInputs = [ mock ];
21
22
23+ patches = [
24+ # fix tests after readme_renderer update
25+ # TODO remove on next update
26+ (fetchpatch {
27+ url = "https://github.com/mgedmin/restview/commit/541743ded13ae55dea4c437046984a5f13d06e8b.patch";
28+ sha256 = "031b1dlqx346bz7afpc011lslnq771lnxb6iy1l2285pph534bci";
29+ })
30+ ];
31+
22 postPatch = ''
32 postPatch = ''
23 # dict order breaking tests
33 # dict order breaking tests
24 sed -i 's@<a href="http://www.example.com" rel="nofollow">@...@' src/restview/tests.py
34 sed -i 's@<a href="http://www.example.com" rel="nofollow">@...@' src/restview/tests.py
pkgs/development/python-modules/us/default.nix+7
@@ -15,6 +15,13 @@ buildPythonPackage rec {
15 sha256 = "1niglalkp7pinibzbxjdz9mxx9qmwkrh8884dag3kr72cfkrpp09";
15 sha256 = "1niglalkp7pinibzbxjdz9mxx9qmwkrh8884dag3kr72cfkrpp09";
16 };
16 };
17
17
18+ # Upstream requires jellyfish==0.5.6 but we have 0.6.1
19+ postPatch = ''
20+ substituteInPlace setup.py --replace "jellyfish==" "jellyfish>="
21+ '';
22+
23+ doCheck = false; # pypi version doesn't include tests
24+
18 meta = {
25 meta = {
19 description = "A package for easily working with US and state metadata";
26 description = "A package for easily working with US and state metadata";
20 longDescription = ''
27 longDescription = ''