Giter Club home page Giter Club logo

Comments (3)

thp avatar thp commented on July 17, 2024

It seems to be that in your case, urlwatch is installed into /usr/sbin/urlwatch instead of /usr/bin/urlwatch (or that /usr/sbin appears first in your $PATH, and on Void Linux, /usr/sbin is a symlink to /usr/bin?).

In order to determine whether the program is run from a source checkout or a system-wide installation, this is used (the assumption here is that if the urlwatch script is in a folder named bin, assume system-wide installation, otherwise assume a source checkout):

# Check if we are installed in the system already
(prefix, bindir) = os.path.split(os.path.dirname(os.path.abspath(sys.argv[0])))
if bindir != 'bin':
sys.path.insert(0, os.path.join(prefix, bindir, 'lib'))

Both prefix and bindir from the code snippet above are then used to construct a path to the examples:

if self.bindir == 'bin':
# Installed system-wide
self.examples_dir = os.path.join(prefix, 'share', self.pkgname, 'examples')
else:
# Assume we are not yet installed
self.examples_dir = os.path.join(prefix, bindir, 'share', self.pkgname, 'examples')

There are multiple ways to fix this:

  • Quick workaround for you locally: Make sure /usr/bin appears before /usr/sbin in your $PATH
  • Change == 'bin' to in ('bin', 'sbin') to support cases where it's launched from sbin
  • Use os.path.realpath() to remove symlinks in the path
  • Instead of detecting a system-wide installation via bin, try to detect a source checkout instead

I'll try to come up with a workaround. This isn't really a regression, but has been like that since ~ 2008 in urlwatch (according to git blame), and probably affects Void Linux since July 2015 (according to the blog post linked above) :)

from urlwatch.

thp avatar thp commented on July 17, 2024

Additional information for the fix in 6b68afb: Since the urlwatch script that gets installed system-wide (or in $HOME if installed via pip install --user) is different from the urlwatch script in the source checkout, the special-case handling of that can just go into the urlwatch script. Also cleaned up some other things (e.g. sys.path.insert() wasn't necessary, as the urlwatch script was already doing this).

from urlwatch.

RunningDroid avatar RunningDroid commented on July 17, 2024

This isn't really a regression, but has been like that since ~ 2008 in urlwatch (according to git blame), and probably affects Void Linux since July 2015 (according to the blog post linked above) :)

My bad, I assumed it was a regression because it worked on one machine with urlwatch 2.25 but not on a different machine that I'd updated to urlwatch 2.26. Apparently urlwatch behaved differently because the machine running urlwatch 2.25 had /usr/bin before /usr/sbin and the one I'd updated had /usr/sbin before /usr/bin.

(I don't know why the paths are ordered differently when all the relevant config files are identical, but that's a separate problem.)

from urlwatch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.