summary refs log tree commit diff
path: root/pkgs/development/python-modules/pyogg
diff options
context:
space:
mode:
authorPhilipp Middendorf <pmidden+github@secure.mailbox.org>2019-04-03 14:14:52 +0200
committerRobert Schütz <rschuetz17@gmail.com>2019-04-03 14:14:52 +0200
commit2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95 (patch)
tree7d20300467428276042464eb77c610eb1fce86f3 /pkgs/development/python-modules/pyogg
parent5babc67452fa7ff0b1f6a0ef3fc506b2e0de9e5f (diff)
downloadnixpkgs-2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95.tar
nixpkgs-2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95.tar.gz
nixpkgs-2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95.tar.bz2
nixpkgs-2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95.tar.lz
nixpkgs-2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95.tar.xz
nixpkgs-2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95.tar.zst
nixpkgs-2424a7cb951f1e60ab27717dac4cdb3e5ff7eb95.zip
pythonPackages.pyogg: 0.6.6a1 -> 0.6.9a1 (#58746)
Diffstat (limited to 'pkgs/development/python-modules/pyogg')
-rw-r--r--pkgs/development/python-modules/pyogg/default.nix35
-rw-r--r--pkgs/development/python-modules/pyogg/pyogg-paths.patch79
2 files changed, 95 insertions, 19 deletions
diff --git a/pkgs/development/python-modules/pyogg/default.nix b/pkgs/development/python-modules/pyogg/default.nix
index 901cc137f19..88fdc960a2b 100644
--- a/pkgs/development/python-modules/pyogg/default.nix
+++ b/pkgs/development/python-modules/pyogg/default.nix
@@ -1,34 +1,31 @@
-{ stdenv, lib, fetchPypi, buildPythonPackage, libvorbis, flac, libogg, libopus, opusfile }:
+{ stdenv, lib, fetchPypi, buildPythonPackage, libvorbis, flac, libogg, libopus, opusfile, substituteAll }:
 
 buildPythonPackage rec {
     pname = "PyOgg";
-    version = "0.6.6a1";
+    version = "0.6.9a1";
 
     src = fetchPypi {
       inherit pname version;
-      sha256 = "1ihzgl8p0rc3yjsp27zdrrs2r4qar5yf5l4v8wg0lilvan78h0rs";
+      sha256 = "0xabqwyknpvfc53s7il5pq6b07fcaqvz5bi5vbs3pbaw8602qvim";
     };
 
     buildInputs = [ libvorbis flac libogg libopus ];
     propagatedBuidInputs = [ libvorbis flac libogg libopus opusfile ];
     # There are no tests in this package.
     doCheck = false;
-    postPatch = ''
-      substituteInPlace pyogg/vorbis.py --replace \
-        'libvorbisfile = ExternalLibrary.load("vorbisfile")' "libvorbisfile = ctypes.CDLL('${libvorbis}/lib/libvorbisfile${stdenv.hostPlatform.extensions.sharedLibrary}')"
-      substituteInPlace pyogg/vorbis.py --replace \
-        'libvorbisenc = ExternalLibrary.load("vorbisenc")' "libvorbisenc = ctypes.CDLL('${libvorbis}/lib/libvorbisenc${stdenv.hostPlatform.extensions.sharedLibrary}')"
-      substituteInPlace pyogg/vorbis.py --replace \
-        'libvorbis = ExternalLibrary.load("vorbis")' "libvorbis = ctypes.CDLL('${libvorbis}/lib/libvorbis${stdenv.hostPlatform.extensions.sharedLibrary}')"
-      substituteInPlace pyogg/flac.py --replace \
-        'libflac = ExternalLibrary.load("flac")' "libflac = ctypes.CDLL('${flac.out}/lib/libFLAC${stdenv.hostPlatform.extensions.sharedLibrary}')"
-      substituteInPlace pyogg/ogg.py --replace \
-        'libogg = ExternalLibrary.load("ogg")' "libogg = ctypes.CDLL('${libogg}/lib/libogg${stdenv.hostPlatform.extensions.sharedLibrary}')"
-      substituteInPlace pyogg/opus.py --replace \
-        'libopus = ExternalLibrary.load("opus")' "libopus = ctypes.CDLL('${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}')"
-      substituteInPlace pyogg/opus.py --replace \
-        'libopusfile = ExternalLibrary.load("opusfile")' "libopusfile = ctypes.CDLL('${opusfile}/lib/libopusfile${stdenv.hostPlatform.extensions.sharedLibrary}')"
-    '';
+    patchFlags = [ "-p1" "--binary" ]; # patch has dos style eol
+    patches = [
+      (substituteAll {
+        src = ./pyogg-paths.patch;
+        flacLibPath="${flac.out}/lib/libFLAC${stdenv.hostPlatform.extensions.sharedLibrary}";
+        oggLibPath="${libogg}/lib/libogg${stdenv.hostPlatform.extensions.sharedLibrary}";
+        vorbisLibPath="${libvorbis}/lib/libvorbis${stdenv.hostPlatform.extensions.sharedLibrary}";
+        vorbisFileLibPath="${libvorbis}/lib/libvorbisfile${stdenv.hostPlatform.extensions.sharedLibrary}";
+        vorbisEncLibPath="${libvorbis}/lib/libvorbisenc${stdenv.hostPlatform.extensions.sharedLibrary}";
+        opusLibPath="${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}";
+        opusFileLibPath="${opusfile}/lib/libopusfile${stdenv.hostPlatform.extensions.sharedLibrary}";
+      })
+    ];
 
   meta = {
     description = "Xiph.org's Ogg Vorbis, Opus and FLAC for Python";
diff --git a/pkgs/development/python-modules/pyogg/pyogg-paths.patch b/pkgs/development/python-modules/pyogg/pyogg-paths.patch
new file mode 100644
index 00000000000..c7f1933878b
--- /dev/null
+++ b/pkgs/development/python-modules/pyogg/pyogg-paths.patch
@@ -0,0 +1,79 @@
+diff --git a/pyogg/flac.py b/pyogg/flac.py

+index 37cc788..9fb7e95 100644

+--- a/pyogg/flac.py

++++ b/pyogg/flac.py

+@@ -49,7 +49,7 @@ __here = os.getcwd()

+ libflac = None

+ 

+ try:

+-    libflac = ExternalLibrary.load("FLAC", tests = [lambda lib: hasattr(lib, "FLAC__EntropyCodingMethodTypeString")])

++    libflac = ctypes.CDLL('@flacLibPath@')

+ except ExternalLibraryError:

+     pass

+ except:

+diff --git a/pyogg/ogg.py b/pyogg/ogg.py

+index 7264774..2702e24 100644

+--- a/pyogg/ogg.py

++++ b/pyogg/ogg.py

+@@ -54,7 +54,7 @@ __here = os.getcwd()

+ libogg = None

+ 

+ try:

+-    libogg = ExternalLibrary.load("ogg", tests = [lambda lib: hasattr(lib, "oggpack_writeinit")])

++    libogg = ctypes.CDLL('@oggLibPath@')

+ except ExternalLibraryError:

+     pass

+ except:

+diff --git a/pyogg/opus.py b/pyogg/opus.py

+index 81e73da..640e59c 100644

+--- a/pyogg/opus.py

++++ b/pyogg/opus.py

+@@ -130,7 +130,7 @@ __here = os.getcwd()

+ libopus = None

+ 

+ try:

+-    libopus = ExternalLibrary.load("opus", tests = [lambda lib: hasattr(lib, "opus_encoder_get_size")])

++    libopus = ctypes.CDLL('@opusLibPath@')

+ except ExternalLibraryError:

+     pass

+ except:

+@@ -139,7 +139,7 @@ except:

+ libopusfile = None

+ 

+ try:

+-    libopusfile = ExternalLibrary.load("opusfile", tests = [lambda lib: hasattr(lib, "opus_head_parse")])

++    libopusfile = ctypes.CDLL('@opusFileLibPath@')

+ except ExternalLibraryError:

+     pass

+ except:

+diff --git a/pyogg/vorbis.py b/pyogg/vorbis.py

+index a8e4792..6f44d2d 100644

+--- a/pyogg/vorbis.py

++++ b/pyogg/vorbis.py

+@@ -52,7 +52,7 @@ __here = os.getcwd()

+ libvorbis = None

+ 

+ try:

+-    libvorbis = ExternalLibrary.load("vorbis", tests = [lambda lib: hasattr(lib, "vorbis_info_init")])

++    libvorbis = ctypes.CDLL('@vorbisLibPath@')

+ except ExternalLibraryError:

+     pass

+ except:

+@@ -61,7 +61,7 @@ except:

+ libvorbisfile = None

+ 

+ try:

+-    libvorbisfile = ExternalLibrary.load("vorbisfile", tests = [lambda lib: hasattr(lib, "ov_clear")])

++    libvorbisfile = ctypes.CDLL('@vorbisFileLibPath@')

+ except ExternalLibraryError:

+     pass

+ except:

+@@ -70,7 +70,7 @@ except:

+ libvorbisenc = None

+ 

+ try:

+-    libvorbisenc = ExternalLibrary.load("vorbisenc", tests = [lambda lib: hasattr(lib, "vorbis_encode_init")])

++    libvorbisenc = ctypes.CDLL('@vorbisEncLibPath@')

+ except ExternalLibraryError:

+     pass

+ except: