nwg-piotr/azote

Invalid $LIB resolution (Fedora 40 i3 Spin)

Opened this issue · 2 comments

Describe the bug
I apologize if this is the wrong place to post this issue, but I wanted to bring to light my experience on a fresh Fedora 40 i3 Spin install.

When first attempting to run azote I was met with an error hinting that the python package was not found:

$ azote
/usr/bin/azote: line 4: cd: /usr/local/lib/python3.12/site-packages/azote: No such file or directory
/usr/bin/python3: can't open file '/home/felipe/main.py': [Errno 2] No such file or directory

I checked and reinstalled azote via dnf, without any error. I had to install pip which was not installed by default sudo dnf install python3-pip. Once I had installed pip I ran pip show azote to see where the package was located and was met with:

$ pip show azote
Name: azote
Version: 1.12.7
Summary: Wallpaper manager for sway and some other WMs
Home-page: https://github.com/nwg-piotr/azote
Author: Piotr Miller
Author-email: nwg.piotr@gmail.com
License: GPL3
Location: /usr/lib/python3.12/site-packages
Requires: 
Required-by: 

When comparing the locations, I noticed the discrepancy,

In order to resolve this issue and be able to launch azote I edited /usr/bin/azote to point to the path set in pip show

#!/usr/bin/sh

# LIB=$(python3 -Ic "from sysconfig import get_path; print(get_path('purelib'))")
# cd $LIB/azote
cd /usr/lib/python3.12/site-packages/azote
exec /usr/bin/python3 main.py "$@"

Once I made this change I was able to run azote. It seems purelib changes based on the python installation. This could very well be an issue with my specific python installation but I'm curious if it would be helpful to add more descriptive error handling to point to a possible solution:

#!/bin/bash

LIB=$(python3 -Ic "from sysconfig import get_path; print(get_path('purelib'))")

if [ -d "$LIB/azote" ]; then
  cd "$LIB/azote"
  exec /usr/bin/python3 main.py "$@"
else
  echo "Error: Azote directory not found in $LIB"
  echo "Run pip show azote to verify package location"
  exit 1
fi

If this is deemed valid and wroth pursuing I can open a PR for it.

Starting from the 1.12.9 version, we no longer have the dist/azote file. The installation method should also be changed, see https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=azote.

Fedora 40 is still shipping version 1.12.7 according to dnf. So I guess we'll have to see when it gets updated then.

Starting from the 1.12.9 version, we no longer have the dist/azote file. The installation method should also be changed, see https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=azote.