mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-22 21:18:28 +03:00
Merge pull request #121257 from dotlambda/pythonPackages-ffmpeg
pythonPackages: migrate away from ffmpeg_3
This commit is contained in:
commit
dfebdee0fc
@ -1,29 +1,42 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, fetchpatch
|
||||
, isPy3k
|
||||
, fetchPypi
|
||||
, substituteAll
|
||||
, ffmpeg
|
||||
, python
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "imageio-ffmpeg";
|
||||
version = "0.4.2";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "13b05b17a941a9f4a90b16910b1ffac159448cff051a153da8ba4b4343ffa195";
|
||||
};
|
||||
patches = [ (fetchpatch {
|
||||
# Fixes compatibility with python3.9
|
||||
# Should be included in the next release after 0.4.2
|
||||
url = "https://github.com/imageio/imageio-ffmpeg/pull/43/commits/b90c39fe3d29418d67d953588ed9fdf4d848f811.patch";
|
||||
sha256 = "0d9kf4w6ldwag3s2dr9zjin6wrj66fnl4fn8379ci4q4qfsqgx3f";
|
||||
})];
|
||||
version = "0.4.3";
|
||||
|
||||
disabled = !isPy3k;
|
||||
|
||||
# No test infrastructure in repository.
|
||||
doCheck = false;
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "f826260a3207b872f1a4ba87ec0c8e02c00afba4fd03348a59049bdd8215841e";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./ffmpeg-path.patch;
|
||||
ffmpeg = "${ffmpeg}/bin/ffmpeg";
|
||||
})
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
|
||||
${python.interpreter} << EOF
|
||||
from imageio_ffmpeg import get_ffmpeg_version
|
||||
assert get_ffmpeg_version() == '${ffmpeg.version}'
|
||||
EOF
|
||||
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [ "imageio_ffmpeg" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "FFMPEG wrapper for Python";
|
||||
|
@ -0,0 +1,39 @@
|
||||
diff --git a/imageio_ffmpeg/_utils.py b/imageio_ffmpeg/_utils.py
|
||||
index 1399cfd..c0eb9be 100644
|
||||
--- a/imageio_ffmpeg/_utils.py
|
||||
+++ b/imageio_ffmpeg/_utils.py
|
||||
@@ -23,33 +23,7 @@ def get_ffmpeg_exe():
|
||||
if exe:
|
||||
return exe
|
||||
|
||||
- plat = get_platform()
|
||||
-
|
||||
- # 2. Try from here
|
||||
- bin_dir = resource_filename("imageio_ffmpeg", "binaries")
|
||||
- exe = os.path.join(bin_dir, FNAME_PER_PLATFORM.get(plat, ""))
|
||||
- if exe and os.path.isfile(exe) and _is_valid_exe(exe):
|
||||
- return exe
|
||||
-
|
||||
- # 3. Try binary from conda package
|
||||
- # (installed e.g. via `conda install ffmpeg -c conda-forge`)
|
||||
- if plat.startswith("win"):
|
||||
- exe = os.path.join(sys.prefix, "Library", "bin", "ffmpeg.exe")
|
||||
- else:
|
||||
- exe = os.path.join(sys.prefix, "bin", "ffmpeg")
|
||||
- if exe and os.path.isfile(exe) and _is_valid_exe(exe):
|
||||
- return exe
|
||||
-
|
||||
- # 4. Try system ffmpeg command
|
||||
- exe = "ffmpeg"
|
||||
- if _is_valid_exe(exe):
|
||||
- return exe
|
||||
-
|
||||
- # Nothing was found
|
||||
- raise RuntimeError(
|
||||
- "No ffmpeg exe could be found. Install ffmpeg on your system, "
|
||||
- "or set the IMAGEIO_FFMPEG_EXE environment variable."
|
||||
- )
|
||||
+ return '@ffmpeg@'
|
||||
|
||||
|
||||
def _popen_kwargs(prevent_sigint=False):
|
@ -1,17 +1,12 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, isPy27
|
||||
, pathlib
|
||||
, fetchPypi
|
||||
, imageio-ffmpeg
|
||||
, numpy
|
||||
, pillow
|
||||
, psutil
|
||||
, imageio-ffmpeg
|
||||
, pytest
|
||||
, numpy
|
||||
, isPy3k
|
||||
, ffmpeg_3
|
||||
, futures ? null
|
||||
, enum34
|
||||
, pytestCheckHook
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@ -24,26 +19,21 @@ buildPythonPackage rec {
|
||||
inherit pname version;
|
||||
};
|
||||
|
||||
checkInputs = [ pytest psutil ] ++ lib.optionals isPy3k [
|
||||
imageio-ffmpeg ffmpeg_3
|
||||
];
|
||||
propagatedBuildInputs = [ numpy pillow ];
|
||||
propagatedBuildInputs = [
|
||||
imageio-ffmpeg
|
||||
numpy
|
||||
pillow
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
checkInputs = [
|
||||
psutil
|
||||
pytestCheckHook
|
||||
];
|
||||
|
||||
preCheck = ''
|
||||
export IMAGEIO_USERDIR="$TMP"
|
||||
export IMAGEIO_NO_INTERNET="true"
|
||||
export HOME="$(mktemp -d)"
|
||||
py.test
|
||||
'';
|
||||
|
||||
# For some reason, importing imageio also imports xml on Nix, see
|
||||
# https://github.com/imageio/imageio/issues/395
|
||||
|
||||
# Also, there are tests that test the downloading of ffmpeg if it's not installed.
|
||||
# "Uncomment" those by renaming.
|
||||
postPatch = ''
|
||||
substituteInPlace tests/test_meta.py --replace '"urllib",' "\"urllib\",\"xml\","
|
||||
substituteInPlace tests/test_ffmpeg.py --replace 'test_get_exe_installed' 'get_exe_installed'
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
@ -51,5 +41,4 @@ buildPythonPackage rec {
|
||||
homepage = "http://imageio.github.io/";
|
||||
license = licenses.bsd2;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
{ lib
|
||||
, buildPythonPackage
|
||||
, html5lib
|
||||
, six
|
||||
, beautifulsoup4
|
||||
, pkgs
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = "0.1.0";
|
||||
pname = "infoqscraper";
|
||||
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "cykl";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "07mxp4mla7fwfc032f3mxrhjarnhkjqdxxibf9ba87c93z3dq8jj";
|
||||
};
|
||||
|
||||
# requires network
|
||||
doCheck = false;
|
||||
|
||||
buildInputs = [ html5lib ];
|
||||
propagatedBuildInputs = [ six beautifulsoup4 pkgs.ffmpeg_3 pkgs.swftools pkgs.rtmpdump ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "Discover presentations and/or create a movie consisting of slides and audio track from an infoq url";
|
||||
homepage = "https://github.com/cykl/infoqscraper/wiki";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ edwtjo ];
|
||||
};
|
||||
|
||||
}
|
@ -8,7 +8,6 @@
|
||||
, pandas
|
||||
, tables
|
||||
, git
|
||||
, ffmpeg_3
|
||||
, scikitimage
|
||||
, matplotlib
|
||||
, qdarkstyle
|
||||
@ -59,7 +58,6 @@ buildPythonPackage rec {
|
||||
pandas
|
||||
tables
|
||||
git
|
||||
ffmpeg_3
|
||||
scikitimage
|
||||
matplotlib
|
||||
qdarkstyle
|
||||
@ -79,7 +77,7 @@ buildPythonPackage rec {
|
||||
meta = {
|
||||
homepage = "https://github.com/portugueslab/stytra";
|
||||
description = "A modular package to control stimulation and track behaviour";
|
||||
license = lib.licenses.gpl3;
|
||||
license = lib.licenses.gpl3Plus;
|
||||
maintainers = with lib.maintainers; [ tbenst ];
|
||||
};
|
||||
}
|
||||
|
@ -3279,8 +3279,6 @@ in {
|
||||
|
||||
influxgraph = callPackage ../development/python-modules/influxgraph { };
|
||||
|
||||
infoqscraper = callPackage ../development/python-modules/infoqscraper { };
|
||||
|
||||
inform = callPackage ../development/python-modules/inform { };
|
||||
|
||||
iniconfig = callPackage ../development/python-modules/iniconfig { };
|
||||
|
Loading…
Reference in New Issue
Block a user