54717a3491
When doing a `python setup.py build` on my machine, I found that `build/lib` would not end up with a compiled gresource file until the second invocation of `python setup.py build`. Before: $ python setup.py build running build running build_py creating build creating build/lib creating build/lib/mcg copying mcg/connectionpanel.py -> build/lib/mcg copying mcg/shortcutsdialog.py -> build/lib/mcg copying mcg/serverpanel.py -> build/lib/mcg copying mcg/application.py -> build/lib/mcg copying mcg/window.py -> build/lib/mcg copying mcg/playlistpanel.py -> build/lib/mcg copying mcg/utils.py -> build/lib/mcg copying mcg/coverpanel.py -> build/lib/mcg copying mcg/infodialog.py -> build/lib/mcg copying mcg/librarypanel.py -> build/lib/mcg copying mcg/client.py -> build/lib/mcg copying mcg/zeroconf.py -> build/lib/mcg copying mcg/mcg.py -> build/lib/mcg copying mcg/__init__.py -> build/lib/mcg copying mcg/albumheaderbar.py -> build/lib/mcg package init file 'data/__init__.py' not found (or not a regular file) compiling gresources compiling gschemas $ ls build/lib/mcg/data/ ls: cannot access 'build/lib/mcg/data/': No such file or directory Note how there is no data directory at all. Now check out what happens on the second build: $ git status On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add <file>..." to include in what will be committed) data/gschemas.compiled data/xyz.suruatoel.mcg.gresource nothing added to commit but untracked files present (use "git add" to track) $ python setup.py build running build running build_py package init file 'data/__init__.py' not found (or not a regular file) creating build/lib/mcg/data copying data/xyz.suruatoel.mcg.gresource -> build/lib/mcg/data compiling gresources compiling gschemas $ ls build/lib/mcg/data/ xyz.suruatoel.mcg.gresource That's because the first build generated the compiled schemas and resources (you can see evidence of that in `git status`), and then the second build was able to copy the gresource file over according to the `package_data` rules. The fix I've introduced here is to just do the compilations *before* we call `super(...).run(...)`. There might be better ways of doing this, I'm not very familiar with packaging gtk python applications. Things were even worse for the gschemas.compiled file: in addition to the ordering issue it's not even mentioned in `data_files`, so even if it does exist, it doesn't have a chance to get copied over when installed. So I've added it to the `data_files` section. I don't know if that'll play nicely or not with the existing `--no-compile-schemas` flag. |
||
---|---|---|
data | ||
locale | ||
mcg | ||
.gitignore | ||
CONTRIBUTING.textile | ||
LICENSE | ||
README.textile | ||
setup.py |
h1. CoverGrid CoverGrid (mcg) is a client for the "Music Player Daemon":http://www.musicpd.org (MPD), focusing on albums instead of single tracks. It is not intended to be a replacement for your favorite MPD client but an addition to get a better album-experience. Website: https://www.suruatoel.xyz/codes/mcg License: "GPL":http://www.gnu.org/licenses/gpl.html v3 Dependencies: * "Python":http://www.python.org 3 * "GTK":http://www.gtk.org 3 (>= 3.22) ("python-gobject":https://live.gnome.org/PyGObject) * "Avahi":http://www.avahi.org (optional) * "python-keyring":http://pypi.python.org/pypi/keyring (optional) * "python-setuptools":https://pypi.python.org/pypi/setuptools (building) Additionally a "MPD":http://www.musicpd.org server (version >= 0.21.0) is required at runtime. h2. Building Build the application with _setuptools_: bc. $ python3 setup.py build h2. Running/Testing For testing the application and running it without (system-wide) installation, donwload/clone the code, build it as described above and then use _setuptools_ to install it for the current user: bc. $ python3 setup.py develop --user After that you can run it with bc. $ ~/.local/bin/mcg or if _~/.local/bin/_ is on your PATH bc. $ mcg h2. Installing Install the application system-wide with _setuptools_: bc. # python3 setup.py install Note: _On Linux using the distribution’s package manager is the preferred way of installing applications system-wide._ h2. Packaging Create a distribution package with _setuptools_: bc. $ python3 setup.py sdist h2. Cover/image configuration Since MPD itself does not provide the cover/image/album art binaries, yet, _mcg_ has to look for them itself. In order to find the images a base folder has to be configured on the Connection tab as “Image Directory”. This value can either be a local (absolute) folder (e. g. /home/user/music/) or an http URL (e. g. http://localhost/music/). _mcg_ then adds the (relative) folder of the audio file to this paths and tries different names for the actual file: # the album name # “cover” # “folder” The following file extensions are used: # png # jpg The first combination that results in an existing file is used as cover image. If no matching file exists, _mcg_ will try to traverse the directory for any image file as fallback—this is done for local paths only though, not for http URLs. h2. Screenshots !https://suruatoel.xyz/images/mcg-cover-s.png(CoverGrid\u2019s cover panel with album details and track list.)! !https://suruatoel.xyz/images/mcg-playlist.png(CoverGrid\u2019s playlist panel with queued albums.)! !https://suruatoel.xyz/images/mcg-library-m.png(CoverGrid\u2019s library panel showing the albums middle-sized.)! !https://suruatoel.xyz/images/mcg-library-s.png(CoverGrid\u2019s library panel showing the albums small-sized.)!