diff options
Diffstat (limited to 'pkgs/tools/backup/gphotos-sync/default.nix')
-rw-r--r-- | pkgs/tools/backup/gphotos-sync/default.nix | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/pkgs/tools/backup/gphotos-sync/default.nix b/pkgs/tools/backup/gphotos-sync/default.nix index 515bfc31cf291..cdcc824c535de 100644 --- a/pkgs/tools/backup/gphotos-sync/default.nix +++ b/pkgs/tools/backup/gphotos-sync/default.nix @@ -1,54 +1,80 @@ { lib , fetchFromGitHub -, python3Packages +, fetchpatch +, python3 , ffmpeg }: - -python3Packages.buildPythonApplication rec { +let + py = python3.override { + packageOverrides = self: super: { + google-auth-oauthlib = super.google-auth-oauthlib.overridePythonAttrs (oldAttrs: rec { + version = "0.5.2b1"; + src = fetchFromGitHub { + owner = "gilesknap"; + repo = "google-auth-library-python-oauthlib"; + rev = "v${version}"; + hash = "sha256-o4Jakm/JgLszumrSoTTnU+nc79Ei70abjpmn614qGyc="; + }; + }); + }; + }; +in +py.pkgs.buildPythonApplication rec { pname = "gphotos-sync"; - version = "2.14.2"; + version = "3.04"; + format = "pyproject"; + + SETUPTOOLS_SCM_PRETEND_VERSION = version; src = fetchFromGitHub { owner = "gilesknap"; repo = "gphotos-sync"; rev = version; - sha256 = "0cfmbrdy6w18hb623rjn0a4hnn3n63jw2jlmgn4a2k1sjqhpx3bf"; + sha256 = "0mnlnqmlh3n1b6fjwpx2byl1z41vgghjb95598kz5gvdi95iirrs"; }; - propagatedBuildInputs = with python3Packages; [ + patches = [ + ./skip-network-tests.patch + ]; + + propagatedBuildInputs = with py.pkgs; [ appdirs attrs exif + google-auth-oauthlib psutil pyyaml requests-oauthlib + types-pyyaml + types-requests ]; + postPatch = '' + # this is a patched release that we include via packageOverrides above + substituteInPlace setup.cfg \ + --replace " @ https://github.com/gilesknap/google-auth-library-python-oauthlib/archive/refs/tags/v0.5.2b1.zip" "" + ''; + buildInputs = [ ffmpeg ]; - checkInputs = with python3Packages; [ - pytestCheckHook + checkInputs = with py.pkgs; [ mock + pytestCheckHook + setuptools-scm ]; - checkPhase = '' + preCheck = '' export HOME=$(mktemp -d) - - # patch to skip all tests that do network access - cat >>test/test_setup.py <<EOF - import pytest, requests - requests.Session.__init__ = lambda *args, **kwargs: pytest.skip("no network access") - EOF - - pytestCheckPhase + substituteInPlace setup.cfg \ + --replace "--cov=gphotos_sync --cov-report term --cov-report xml:cov.xml" "" ''; meta = with lib; { description = "Google Photos and Albums backup with Google Photos Library API"; homepage = "https://github.com/gilesknap/gphotos-sync"; - license = licenses.mit; + license = licenses.asl20; maintainers = with maintainers; [ dnr ]; }; } |