After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 781232 - Does not look in /usr/local/share/nautilus-python/extensions or search $XDG_DATA_DIRS, but docs imply XDG semantics
Does not look in /usr/local/share/nautilus-python/extensions or search $XDG_D...
Status: RESOLVED FIXED
Product: nautilus-python
Classification: Other
Component: general
1.1
Other All
: Normal normal
: v1.2
Assigned To: Adam Plumb
Adam Plumb
Depends on:
Blocks:
 
 
Reported: 2017-04-12 18:42 UTC by Andrew Chadwick
Modified: 2017-12-24 14:01 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Andrew Chadwick 2017-04-12 18:42:00 UTC
The docs for nautilus-python 1.1 say that...

> As of nautilus-python 0.7.0, scripts are also loaded from $XDG_DATA_DIR/nautilus-python/extensions,
> which includes ~/.local/share and /usr/share (or whatever your $XDG_DATA_DIR is 
set to).

But it doesn't: see downstream <https://github.com/flozz/nautilus-terminal/pull/1>, and yes I tried setting XDG_DATA_DIR to no effect. Extension code in /usr/local/share/nautilus-python/extensions is not loaded after a Nautilus restart.

To me, looking at the source[1], nautilus-python actually uses a static DATADIR string define from src/Makefile.am in place of the XDG semantics for XDG_DATA_DIRS.

Is "$XDG_DATA_DIR" being used as a shorthand for the full "$XDG_DATA_HOME:$XDG_DATA_DIRS" search path? The XDG Base Directory Specification[2] does not mention the singular form. However, prefixing the explanation with "XDG_" does rather hint that you're trying full XDG semantics!

Please can all the proper functions for system data prefixes be used? These are g_get_user_data_dir() and g_get_system_data_dirs() in that order. As a card-carrying GTK-tinged Python-head, I expect the loader to be using:

>>> import gi
>>> gi.require_version("GLib", "2.0")
>>> from gi.repository import GLib
>>> GLib.get_user_data_dir()
'/home/andrewc/.local/share'
>>> GLib.get_system_data_dirs()
['/usr/share/gnome', '/usr/local/share/', '/usr/share/']

Please can nautilus_module_initialize() be updated to look in the locations that GLib helpfully exposes through these functions, in the order above? Those are designed to include the XDG dirs on POSIX systems, and will return suitable non-XDG paths on Windows systems too.

[1] https://git.gnome.org/browse/nautilus-python/tree/src
[2] https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Comment 1 Adam Plumb 2017-12-24 14:01:42 UTC
Hey I've fixed this in master (commit 0b1a2cae0955ec36a6d622157726516a2481cc29).  Release should happen somewhat soon.