diff --git a/default.nix b/default.nix index dec4a1f..2b78de4 100644 --- a/default.nix +++ b/default.nix @@ -50,6 +50,7 @@ in mt_lutspa = callPythonPackage ./plugins/mt_lutspa { }; nnedi3_resample = callPythonPackage ./plugins/nnedi3_resample { }; nnedi3_rpow2 = callPythonPackage ./plugins/nnedi3_rpow2 { }; + vsutil = callPythonPackage ./plugins/vsutil { }; mvsfunc = callPythonPackage ./plugins/mvsfunc { }; }; diff --git a/plugins/vsutil/default.nix b/plugins/vsutil/default.nix new file mode 100644 index 0000000..2f4c636 --- /dev/null +++ b/plugins/vsutil/default.nix @@ -0,0 +1,32 @@ +{ lib, buildPythonPackage, fetchFromGitHub, vapoursynth }: + +buildPythonPackage rec { + pname = "vsutil"; + version = "0.5.0"; + + # there are no tests in the pypi tarball + src = fetchFromGitHub { + owner = "Irrational-Encoding-Wizardry"; + repo = pname; + rev = version; + sha256 = "0pv3910g5cdx132cq9f3g7rb3yxyxyvw9110vsl196xswkccl8n8"; + }; + + patches = [ + # Vapoursynth is not recognised during installation. Since this package + # provides tests, a dependency problem should be catched by them. + ./disable-vapoursynth-install-requirement.diff + # By default, test failure does not fail the build. + ./fail-tests.diff + ]; + + checkInputs = [ vapoursynth ]; + + meta = with lib; { + description = "A collection of general purpose Vapoursynth functions to be reused in modules and scripts"; + homepage = "https://github.com/Irrational-Encoding-Wizardry/vsutil"; + license = licenses.mit; + maintainers = with maintainers; [ sbruder ]; + platforms = platforms.all; + }; +} diff --git a/plugins/vsutil/disable-vapoursynth-install-requirement.diff b/plugins/vsutil/disable-vapoursynth-install-requirement.diff new file mode 100644 index 0000000..a60048f --- /dev/null +++ b/plugins/vsutil/disable-vapoursynth-install-requirement.diff @@ -0,0 +1,12 @@ +diff --git a/setup.py b/setup.py +index a66f14c..a7de6b4 100644 +--- a/setup.py ++++ b/setup.py +@@ -45,7 +48,6 @@ setup( + author_email=meta['__author__'].split()[1][1:-1], + description='A collection of general-purpose Vapoursynth functions to be reused in modules and scripts.', + install_requires=[ +- "vapoursynth" + ], + cmdclass={ + 'test': DiscoverTest diff --git a/plugins/vsutil/fail-tests.diff b/plugins/vsutil/fail-tests.diff new file mode 100644 index 0000000..0390368 --- /dev/null +++ b/plugins/vsutil/fail-tests.diff @@ -0,0 +1,20 @@ +diff --git a/setup.py b/setup.py +index a66f14c..a7de6b4 100644 +--- a/setup.py ++++ b/setup.py +@@ -25,11 +25,14 @@ class DiscoverTest(test): + + def run_tests(self): + import os ++ import sys + import unittest + path = os.path.join(os.path.dirname(__file__), "tests") + runner = unittest.TextTestRunner(verbosity=2) + suite = unittest.TestLoader().discover(path, pattern="test_*.py") +- runner.run(suite) ++ result = runner.run(suite) ++ if not result.wasSuccessful(): ++ sys.exit(1) + + + setup(