Package Details: goobook 3.5.1-2

Git Clone URL: https://aur.archlinux.org/goobook.git (read-only, click to copy)
Package Base: goobook
Description: Access your Google contacts from the command line
Upstream URL: https://gitlab.com/goobook/goobook
Licenses: GPL3
Submitter: jaantoots
Maintainer: jaantoots
Last Packager: jaantoots
Votes: 2
Popularity: 0.001873
First Submitted: 2020-11-08 17:10
Last Updated: 2020-12-05 18:26

Latest Comments

snakeroot commented on 2021-07-27 21:39

A few months ago, Jan Baier submitted a pull request upstream to make the switch from xdg to pyxdg.

https://gitlab.com/baierjan/goobook/-/commit/391c081199f9cba5026460fbffba43c03602fa13

Unfortunately, to date it hasn't been merged. I made patches for the two operative files, setup.py and goobook/config.py:

setup.patch

--- setup.py    2021-07-18 15:32:03.973529351 -0400
+++ setup.py.new        2021-07-27 17:02:26.627825390 -0400
@@ -39,7 +39,7 @@
         'google-api-python-client>=1.7.12',
         'simplejson>=3.16.0',
         'oauth2client>=1.5.0,<5.0.0dev',
-        'xdg>=4.0.1'
+        'pyxdg>=0.26'    
     ],
     extras_require={    
     },

config.patch:

--- goobook/config.py   2021-07-18 16:18:37.199555608 -0400
+++ config.py.new   2021-07-27 09:50:24.618527368 -0400
@@ -10,7 +10,7 @@
 import logging

 import oauth2client.client
-import xdg
+from xdg import BaseDirectory

 from goobook.storage import Storage

@@ -61,8 +61,8 @@
     if config_file:  # config file explicitly given on the commandline
         config_file = os.path.expanduser(config_file)
     else:  # search for goobookrc in XDG dirs and homedir
-        config_files = [dir_ / "goobookrc" for dir_ in [xdg.XDG_CONFIG_HOME] +
-                        xdg.XDG_CONFIG_DIRS] + [LEGACY_CONFIG_FILE]
+        config_files = [dir_ / "goobookrc" for dir_ in [pathlib.Path(BaseDirectory.xdg_config_home)] +
+                        [pathlib.Path(p) for p in BaseDirectory.xdg_config_dirs]] + [LEGACY_CONFIG_FILE]
         log.debug("config file search path: %s", config_files)
         for config_file_ in config_files:
             if config_file_.exists():
@@ -93,7 +93,7 @@
     if config.cache_filename:  # If explicitly specified in config file
         config.cache_filename = realpath(expanduser(config.cache_filename))
     else:  # search for goobook_cache in XDG dirs and homedir
-        cache_files = [xdg.XDG_CACHE_HOME / "goobook_cache", LEGACY_CACHE_FILE]
+        cache_files = [pathlib.Path(BaseDirectory.xdg_cache_home) / "goobook_cache", LEGACY_CACHE_FILE]
         log.debug("cache file search path: %s", cache_files)
         for cache_file in cache_files:
             cache_file = cache_file.resolve()
@@ -101,7 +101,7 @@
                 log.debug("found cache file: %s", cache_file)
                 break
         else:  # If there is none, create in XDG_CACHE_HOME
-            cache_file = xdg.XDG_CACHE_HOME / "goobook_cache"
+            cache_file = pathlib.Path(BaseDirectory.xdg_cache_home) / "goobook_cache"
             log.debug("no cache file found, will use %s", cache_file)
         config.cache_filename = str(cache_file)

@@ -110,8 +110,8 @@
         config.oauth_db_filename = realpath(expanduser(config.oauth_db_filename))
         auth_file = pathlib.Path(config.oauth_db_filename)
     else:  # search for goobook_auth.json in XDG dirs and homedir
-        auth_files = [dir_ / "goobook_auth.json" for dir_ in [xdg.XDG_DATA_HOME] +
-                      xdg.XDG_DATA_DIRS] + [LEGACY_AUTH_FILE]
+        auth_files = [dir_ / "goobook_auth.json" for dir_ in [pathlib.Path(BaseDirectory.xdg_data_home)] +
+                      [pathlib.Path(p) for p in BaseDirectory.xdg_data_dirs]] + [LEGACY_AUTH_FILE]
         log.debug("auth file search path: %s", auth_files)
         for auth_file in auth_files:
             auth_file = auth_file.resolve()
@@ -119,7 +119,7 @@
                 log.debug("found auth file: %s", auth_file)
                 break
         else:  # If there is none, create in XDG_DATA_HOME
-            auth_file = xdg.XDG_DATA_HOME / "goobook_auth.json"
+            auth_file = pathlib.Path(BaseDirectory.xdg_data_home) / "goobook_auth.json"
             log.debug("no auth file found, will use %s", auth_file)
         config.oauth_db_filename = str(auth_file)

Add these patches to the same directory as the PKGBUILD, change the depends from python-xdg to python-pyxdg, add the patches to the source array, add 'SKIP' for both in the SHA256 array and add the following "prepare" stanza above the "build":

prepare() {
    cd "$pkgname-$pkgver"
    patch --input="${srcdir}/setup.patch"
    patch -d goobook --input="${srcdir}/config.patch"
}

This compiles and seems to work (i.e., I can query contacts).

smp commented on 2021-02-20 07:36

It has turned out that my work-around of installing goobook using PIP doesn't actually let me use it alongside packages that depend on python-pyxdg. However the comments of python-xdg link to a forum thread that describes how to work around the problem using Python virtual environments.

afwlehmann commented on 2021-02-15 08:20

@ribbons @smp Thanks for the info. For some reason I could not simply install the AUR package for python-xdg (I'm using aura), but had to clone the repo and makepkg the thing manually instead. Anyway, goobook seems to be working now so thanks for the heads-up!

smp commented on 2021-02-14 12:58

The problem is that many packages from the repositories and the AUR depend on python-pyxdg from the repositories and will not work with python-xdg from the AUR (python-pyxdg and python-xdg conflict because they have the same module names). It seems to me that the only way to resolve this would be for the developer of python-xdg to rename their package, as has been requested here. I have meanwhile opted for a work-around in the form of installing goobook via PIP.

ribbons commented on 2021-02-14 11:15

@afwlehmann the latest version of this package works fine for me with python-xdg version 5.0.1-2 from the AUR (it depends on 4.0.1 or above).

afwlehmann commented on 2021-02-10 06:51

The latest available version of community/python-xdg dependency is 0.26-8 (and there is no AUR of 4.0.1 as well), so I am having trouble upgrading to the latest version of goobook.

ribbons commented on 2020-12-05 19:20

Sorry, looked at this fresh again today after your reply and realised it was totally user error on my part - built goobook in a fully updated chroot (python 3.9) and then installed it in my system with slightly less up-to-date packages (python 3.8) with unsurprising results... Doh!

jaantoots commented on 2020-12-05 17:16

This doesn't make any sense. The only explanation I can come up with is if you built the package with some older version of python or your python is somehow broken and not finding goobook in its expected place at /usr/lib/python3.8/site-packages/goobook/. Are other python packages working for you?

ribbons commented on 2020-12-02 19:56

Unfortunately after upgrading to 3.5.1 I'm getting the following if I try to run goobook:

Traceback (most recent call last):
  File "/usr/bin/goobook", line 33, in <module>
    sys.exit(load_entry_point('goobook==3.5.1.dev0', 'console_scripts', 'goobook')())
  File "/usr/bin/goobook", line 22, in importlib_load_entry_point
    for entry_point in distribution(dist_name).entry_points
  File "/usr/lib/python3.8/importlib/metadata.py", line 504, in distribution
    return Distribution.from_name(distribution_name)
  File "/usr/lib/python3.8/importlib/metadata.py", line 177, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: goobook