diff options
author | David Reiss <dnr@dnr.im> | 2022-06-05 16:21:01 -0700 |
---|---|---|
committer | Robert Schütz <github@dotlambda.de> | 2022-06-17 04:02:26 +0000 |
commit | c9ba04ce8c6d57c9f6d47a462e9d64d0a589f51c (patch) | |
tree | 2b96b938627ea29102deaefc0c2e346a2e42ae03 | |
parent | 39dff39cf37ac61825e610166faf6082f8e4db1d (diff) |
gphotos-sync: 2.14.2 -> 3.04
-rw-r--r-- | pkgs/tools/backup/gphotos-sync/default.nix | 62 | ||||
-rw-r--r-- | pkgs/tools/backup/gphotos-sync/skip-network-tests.patch | 21 |
2 files changed, 65 insertions, 18 deletions
diff --git a/pkgs/tools/backup/gphotos-sync/default.nix b/pkgs/tools/backup/gphotos-sync/default.nix index 515bfc31cf29..cdcc824c535d 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 ]; }; } diff --git a/pkgs/tools/backup/gphotos-sync/skip-network-tests.patch b/pkgs/tools/backup/gphotos-sync/skip-network-tests.patch new file mode 100644 index 000000000000..6f78ed7db3f2 --- /dev/null +++ b/pkgs/tools/backup/gphotos-sync/skip-network-tests.patch @@ -0,0 +1,21 @@ +diff --git a/tests/test_setup.py b/tests/test_setup.py +index 085b110..ea4a7d2 100644 +--- a/tests/test_setup.py ++++ b/tests/test_setup.py +@@ -45,7 +45,8 @@ class SetupDbAndCredentials: + return self + + def __exit__(self, exc_type=None, exc_value=None, traceback=None): +- self.gp.google_photos_down.close() ++ if hasattr(self.gp, 'google_photos_down'): ++ self.gp.google_photos_down.close() + + def test_setup(self, test_name, args=None, trash_db=False, trash_files=False): + self.root = Path("/tmp/gpTests/{}".format(test_name)) +@@ -76,3 +77,6 @@ class SetupDbAndCredentials: + + def test_done(self): + self.gp.data_store.store() ++ ++import pytest, requests ++requests.Session.__init__ = lambda *args, **kwargs: pytest.skip("no network access") |