Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the native part more portable #10

Open
ao2 opened this issue Nov 15, 2017 · 5 comments
Open

Make the native part more portable #10

ao2 opened this issue Nov 15, 2017 · 5 comments

Comments

@ao2
Copy link

ao2 commented Nov 15, 2017

Hi,

is the restriction to linux given by the inotify dependency?

If so, a possible approach to make the native connector more portable could be to use Gio from Glib, and in particular the GFileMonitor API https://developer.gnome.org/gio/stable/GFile.html#g-file-monitor-directory AFAIU this will use different backends depending on the system (e.g. inotify on linux) and fall back to polling if there is not a native one for the system.

An example of a native connector using Gio is the chrome-gnome-shell extension: https://github.com/GNOME/chrome-gnome-shell/tree/master/connector

I also noticed that chrome-gnome-shell installs the native part of the extension in $PREFIX/bin, any idea if this is the standard practice?

@jlebon
Copy link
Owner

jlebon commented Nov 16, 2017

is the restriction to linux given by the inotify dependency?

Mostly because I only use Linux and I only have Linux to test with. :) The inotify dependency is just an artifact of that. I'd be OK with switching from asyncio to Glib if it means cross-platform (though interestingly, this project started as an exercise to get acquainted with asyncio), but I'd rather not go through the hassle without being able to actually verify that it indeed works cross-platform. FWIW, I would definitely consider patches that do this, though I'm worried about maintenance afterwards if I can't debug/resolve non-Linux issues.

I also noticed that chrome-gnome-shell installs the native part of the extension in $PREFIX/bin, any idea if this is the standard practice?

Hmm, I find that odd. ISTM like it belongs more in $PREFIX/libexec since it's not something that would make sense in users' $PATH. You should be able to just override LIBEXEC at install time to change that though if you'd like.

@ao2
Copy link
Author

ao2 commented Nov 16, 2017

[...] I'd be OK with switching from asyncio to Glib if it means cross-platform (though interestingly, this project started as an exercise to get acquainted with asyncio), but I'd rather not go through the hassle without being able to actually verify that it indeed works cross-platform. FWIW, I would definitely consider patches that do this, though I'm worried about maintenance afterwards if I can't debug/resolve non-Linux issues.

I too only use linux, so even if I experimented with porting the connector to Gio I wouldn't be able to easily test it on other platforms. My inquiry was mainly out of curiosity.

However it's an option to keep in mind, It'sAllText was quite popular and Textern seems to me the most promising alternative because it does not require editor-specific plugins like other extensions do.

Hmm, I find that odd. ISTM like it belongs more in $PREFIX/libexec since it's not something that would make sense in users' $PATH. You should be able to just override LIBEXEC at install time to change that though if you'd like.

Maybe they execute their native part also from the command line, for testing, not sure.

Anyways I see that $PREFIX/libexec is not very common either: in the whole Debian archive only two packages use it, more common paths seem to be $PREFIX/lib/$NAMESPACE/libexec or $PREFIX/share/$NAMESPACE/libexec.

Check out the output of apt-file search libexec/if you are on a Debian based system.

Ciao,
Antonio

@jlebon
Copy link
Owner

jlebon commented Nov 21, 2017

Interesting. It's a pretty common pattern in Fedora/RHEL/CentOS at least: https://fedoraproject.org/wiki/Packaging:Guidelines#Libexecdir.

I mainly use Fedora and had assumed this was the case cross-distro, though it looks like a fundamental difference between Debian and Fedora guidelines: https://lists.debian.org/debian-devel/2005/05/msg00401.html.

Hmm, not sure. Seems like it's safer to just put them under $PREFIX/libexec/textern/ and allow folks to override if they'd like?

@ao2
Copy link
Author

ao2 commented Nov 21, 2017

Interesting indeed, I didn't look beyond Debian.

Since there is not a standardized path for libexec binaries I agree that leaving the current one is OK, distro can always override it in case they want to package the native part.

Thanks for the followup.

@phdru
Copy link
Contributor

phdru commented Dec 23, 2017

https://pypi.python.org/pypi/watchdog revived, I'll try to use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants