From c13fc0213735d8834ad0cdfd0cfa4b5765e80671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tin=20=C5=A0vagelj?= Date: Sun, 1 Dec 2024 00:06:46 +0100 Subject: [PATCH] Simplify packaging and publishing process MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tin Švagelj --- .gitignore | 197 ++++++++++++++++++++++++ Makefile | 126 +++++++++++++++ RELEASE.rst | 7 +- cover-thumbnailer-gui.py | 2 +- cover-thumbnailer.py | 2 +- install.sh | 295 ------------------------------------ man/cover-thumbnailer-gui.1 | 2 +- man/cover-thumbnailer.1 | 2 +- pyproject.toml | 17 +++ 9 files changed, 345 insertions(+), 305 deletions(-) create mode 100755 Makefile delete mode 100755 install.sh create mode 100644 pyproject.toml diff --git a/.gitignore b/.gitignore index 22e556c..e1a53ae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,199 @@ +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ +cover/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +.pybuilder/ +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +# For a library or package, you might want to ignore these files since the code is +# intended to run in multiple environments; otherwise, check them in: +# .python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# poetry +# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. +# This is especially recommended for binary packages to ensure reproducibility, and is more +# commonly ignored for libraries. +# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control +#poetry.lock + +# pdm +# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. +#pdm.lock +# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it +# in version control. +# https://pdm.fming.dev/#use-with-ide +.pdm.toml + +# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm +__pypackages__/ + +# Celery stuff +celerybeat-schedule +celerybeat.pid + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ + +# pytype static type analyzer +.pytype/ + +# Cython debug symbols +cython_debug/ + +### Python Patch ### +# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration +poetry.toml + +# ruff +.ruff_cache/ + +# LSP config files +pyrightconfig.json + +### Linux ### *~ __env__ + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Git ### +# Created by git for backups. To disable backups in Git: +# $ git config --global mergetool.keepBackup false +*.orig + +# Created by git when using merge tools for conflicts +*.BACKUP.* +*.BASE.* +*.LOCAL.* +*.REMOTE.* +*_BACKUP_*.txt +*_BASE_*.txt +*_LOCAL_*.txt +*_REMOTE_*.txt + +### Project ### +# Package results +pkg/ diff --git a/Makefile b/Makefile new file mode 100755 index 0000000..ed557d4 --- /dev/null +++ b/Makefile @@ -0,0 +1,126 @@ +# Variables +SOFTWARE = $(shell awk -F'[ ="]+' '$$1 == "name" {print $$2;exit}' pyproject.toml) +DESCRIPTION = "directory cover thumbnailer for GTK based file viewers" +VERSION := $(shell awk -F'[ ="]+' '$$1 == "version" {print $$2;exit}' pyproject.toml) +DATE := $(shell date +"%a, %d %b %Y") + +INSTALL_PATH ?= / +PACKAGE_PATH ?= ./pkg +LOGFILE ?= install.log + +# Tools +PYTHON ?= /usr/bin/python3 +PIP := $(PYTHON) -m pip +PKG_CONFIG := pkg-config +GTK_VERSION := gtk+-3.0 +GI_MODULE := gi + +# Colors for output +RED := \033[1;31m +GREEN := \033[1;32m +NORMAL := \033[0m +BOLD := \033[1m + +# Targets +.PHONY: all install remove locale check_dep + +all: help + +help: + @echo "$(SOFTWARE) v$(VERSION) - $(DESCRIPTION)" + @echo "" + @echo "Targets:" + @echo -e "\t- $(BOLD)install$(NORMAL) : Install $(SOFTWARE)" + @echo -e "\t- $(BOLD)remove$(NORMAL) : Remove $(SOFTWARE)" + @echo -e "\t- $(BOLD)locale$(NORMAL) : Extract strings for translation template" + @echo -e "\t- $(BOLD)package$(NORMAL) : Generate a package distribution" + @echo -e "\t- $(BOLD)publish$(NORMAL) : Publish current version to git" + +check_build_deps: + @echo -e "$(BOLD) * Checking system dependencies...$(NORMAL)" + @test -x /usr/bin/xgettext || { echo -e "gettext: $(RED)Missing$(NORMAL)" && exit 1; } + @echo -e "gettext: $(GREEN)Found$(NORMAL)" + +check_run_deps: + @$(PYTHON) --version 2>&1 | grep "^Python 3" >/dev/null || { echo -e "Python 3: $(RED)Missing$(NORMAL)" && exit 1; } + @echo -e "Python 3: $(GREEN)Found$(NORMAL)" + @$(PYTHON) -c "import $(GI_MODULE)" 2>/dev/null || { echo -e "PyGObject: $(RED)Missing$(NORMAL)"; exit 1; } + @echo -e "PyGObject: $(GREEN)Found$(NORMAL)" + @$(PKG_CONFIG) --exists $(GTK_VERSION) || { echo -e "GTK+3: $(RED)Missing$(NORMAL)"; exit 1; } + @echo -e "GTK+3: $(GREEN)Found$(NORMAL)" + +locale: check_build_deps + @echo "$(BOLD) * Extracting strings for translation...$(NORMAL)" + @mkdir -pv ./locale/ + @xgettext -k_ -kN_ -o ./locale/cover-thumbnailer-gui.pot ./cover-thumbnailer-gui.py ./share/cover-thumbnailer-gui.glade + @for lcfile in $$(find ./locale/ -name "*.po"); do \ + echo -n " * $$lcfile"; \ + msgmerge --update $$lcfile ./locale/cover-thumbnailer-gui.pot; \ + done + +_install: locale + @echo -e "$(BOLD) * $(action) $(SOFTWARE)...$(NORMAL)" + @mkdir -pv $(INSTALL_PATH)/usr/bin || { echo -e "$(RED)Error creating directory$(NORMAL)" && exit 1; } + @sed "s/{{VERSION}}/$(VERSION)/g" ./cover-thumbnailer.py > $(INSTALL_PATH)/usr/bin/cover-thumbnailer + @chmod 755 $(INSTALL_PATH)/usr/bin/cover-thumbnailer + @sed "s/{{VERSION}}/$(VERSION)/g" ./cover-thumbnailer-gui.py > $(INSTALL_PATH)/usr/bin/cover-thumbnailer-gui + @chmod 755 $(INSTALL_PATH)/usr/bin/cover-thumbnailer-gui + + @echo -e "$(BOLD) * Creating man entries...$(NORMAL)" + @mkdir -pv $(INSTALL_PATH)/usr/share/man/man1 + @sed "s/{{VERSION}}/$(VERSION)/g" ./man/cover-thumbnailer.1\ + | sed "s/{{DATE}}/$(DATE)/g" > $(INSTALL_PATH)/usr/share/man/man1/cover-thumbnailer.1 + @gzip --best -f $(INSTALL_PATH)/usr/share/man/man1/cover-thumbnailer.1 + @sed "s/{{VERSION}}/$(VERSION)/g" ./man/cover-thumbnailer-gui.1\ + | sed "s/{{DATE}}/$(DATE)/g" > $(INSTALL_PATH)/usr/share/man/man1/cover-thumbnailer-gui.1 + @gzip --best -f $(INSTALL_PATH)/usr/share/man/man1/cover-thumbnailer-gui.1 + + @echo -e "$(BOLD) * Generating locales...$(NORMAL)" + @for file in $$(find ./locale -name "*.po"); do \ + lang=$$(echo $$file | sed -r 's#./locale/(.*).po#\1#g'); \ + mkdir -pv $(INSTALL_PATH)/usr/share/locale/$$lang/LC_MESSAGES; \ + msgfmt $$file -o $(INSTALL_PATH)/usr/share/locale/$$lang/LC_MESSAGES/cover-thumbnailer-gui.mo; \ + done + + @echo -e "$(BOLD) * $(action) application data...$(NORMAL)" + @mkdir -pv $(INSTALL_PATH)/usr/share/cover-thumbnailer + @cp -rv ./share/* $(INSTALL_PATH)/usr/share/cover-thumbnailer + @mkdir -pv $(INSTALL_PATH)/usr/share/doc/cover-thumbnailer + @cp -v ./README.md $(INSTALL_PATH)/usr/share/doc/cover-thumbnailer + + @echo -e "$(BOLD) * $(action) application files...$(NORMAL)" + @mkdir -pv $(INSTALL_PATH)/usr/share/applications + @cp -v ./freedesktop/cover-thumbnailer-gui.desktop $(INSTALL_PATH)/usr/share/applications/cover-thumbnailer-gui.desktop + @mkdir -pv $(INSTALL_PATH)/usr/share/thumbnailers + @cp -v ./freedesktop/cover.thumbnailer $(INSTALL_PATH)/usr/share/thumbnailers/cover.thumbnailer + @echo -e "$(GREEN)$(SOFTWARE) $(action_end) successfully$(NORMAL)" + +install: action:="Installing" +install: action_end:="installed" +install: check_run_deps _install + +remove: + @echo "$(BOLD) * Removing $(SOFTWARE)...$(NORMAL)" + @rm -fv /usr/share/applications/cover-thumbnailer-gui.desktop + @rm -rfv /usr/share/cover-thumbnailer + @rm -rfv /usr/share/doc/cover-thumbnailer + @rm -vf /usr/share/man/man1/cover-thumbnailer.1.gz + @rm -vf /usr/share/man/man1/cover-thumbnailer-gui.1.gz + @find /usr/share/locale/ -name cover-thumbnailer-gui.mo -exec rm -v '{}' ';' + @rm -vf /usr/bin/cover-thumbnailer + @rm -vf /usr/bin/cover-thumbnailer-gui + @rm -vf /usr/share/thumbnailers/cover.thumbnailer + @echo "$(GREEN)$(SOFTWARE) removed successfully$(NORMAL)" + +package: INSTALL_PATH:=$(PACKAGE_PATH) +package: action:="Packaging" +package: action_end:="packaged" +package: + @mkdir -pv $(PACKAGE_PATH) +package: _install + +clean: + @rm -rf $(PACKAGE_PATH) + +publish: + @git commit -m v$(VERSION) && git tag v$(VERSION) && git push && git push --tags diff --git a/RELEASE.rst b/RELEASE.rst index 0345336..f91296c 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -17,13 +17,8 @@ This file is a memo for the maintainer. 1. Release ---------- -* Update version number in ``cover-thumbnailer.py`` (``__version__`` var) -* Update version number in ``cover-thumbnailer-gui.py`` (``__version__`` var) -* Update version number in ``install.sh`` (comment) -* Update version number and date in ``man/cover-thumbnailer.1`` (header) -* Update version number and date in ``man/cover-thumbnailer-gui.1`` (header) * Edit / update changelog in ``README.md`` -* Commit / tag (``git commit -m vX.Y.Z && git tag vX.Y.Z && git push && git push --tags``) +* Publish (``make publish``) 2. Publish Github Release diff --git a/cover-thumbnailer-gui.py b/cover-thumbnailer-gui.py index 2d19935..542de99 100755 --- a/cover-thumbnailer-gui.py +++ b/cover-thumbnailer-gui.py @@ -39,7 +39,7 @@ A GUI for easily configuring Cover Thumbnailer. """ -__version__ = "0.10.1" +__version__ = "{{VERSION}}" __author__ = "Fabien Loison " __copyright__ = "Copyright © 2009 - 2023 Fabien LOISON" __appname__ = "cover-thumbnailer-gui" diff --git a/cover-thumbnailer.py b/cover-thumbnailer.py index 1105184..01734b2 100755 --- a/cover-thumbnailer.py +++ b/cover-thumbnailer.py @@ -44,7 +44,7 @@ cover-thumbnailer """ -__version__ = "0.10.1" +__version__ = "{{VERSION}}" __author__ = "Fabien Loison " __copyright__ = "Copyright © 2009 - 2023 Fabien LOISON" diff --git a/install.sh b/install.sh deleted file mode 100755 index f264ae6..0000000 --- a/install.sh +++ /dev/null @@ -1,295 +0,0 @@ -#!/bin/bash - - ######################################################################### - ## ## -## ┏━╸┏━┓╻ ╻┏━╸┏━┓ ╺┳╸╻ ╻╻ ╻┏┳┓┏┓ ┏┓╻┏━┓╻╻ ┏━╸┏━┓ ## -## ┃ ┃ ┃┃┏┛┣╸ ┣┳┛ ┃ ┣━┫┃ ┃┃┃┃┣┻┓┃┗┫┣━┫┃┃ ┣╸ ┣┳┛ ## -## ┗━╸┗━┛┗┛ ┗━╸╹┗╸ ╹ ╹ ╹┗━┛╹ ╹┗━┛╹ ╹╹ ╹╹┗━╸┗━╸╹┗╸ ## -## — www.flogisoft.com — ## -## ## -############################################################################ -## ## -## Cover thumbnailer — Installer ## -## ## -## Copyright (C) 2009 - 2023 Fabien Loison ## -## ## -## This program is free software: you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation, either version 3 of the License, or ## -## (at your option) any later version. ## -## ## -## This program is distributed in the hope that it will be useful, ## -## but WITHOUT ANY WARRANTY; without even the implied warranty of ## -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program. If not, see . ## -## ## -############################################################################ -## ## -## VERSION : 0.10.1 (Mon Jul 31 13:41:54 CEST 2023) ## -## WEB SITE : https://github.com/flozz/cover-thumbnailer ## -## ## -######################################################################### - -SOFTWARE="Cover Thumbnailer" -DESC="Displays music album covers in Nautilus and more..." -LOGFILE="/tmp/cover-thumbnailer$1_$$.log" - - -_install() { - #Install the software - #$1 : The installation path if different of / - - #Check if an older version is installed - if [ -z $1 ] ; then { #Only for --install - _check_for_old_version - } fi - - #/usr/bin - mkdir -pv "$1"/usr/bin 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -v ./cover-thumbnailer.py "$1"/usr/bin/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - chmod -v 755 "$1"/usr/bin/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -v ./cover-thumbnailer-gui.py "$1"/usr/bin/cover-thumbnailer-gui 1>> $LOGFILE 2>> $LOGFILE || error=1 - chmod -v 755 "$1"/usr/bin/cover-thumbnailer-gui 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/cover-thumbnailer/ - mkdir -pv "$1"/usr/share/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -rv ./share/* "$1"/usr/share/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/man/man1 - mkdir -pv "$1"/usr/share/man/man1 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -v ./man/cover-thumbnailer.1 "$1"/usr/share/man/man1/ 1>> $LOGFILE 2>> $LOGFILE || error=1 - gzip --best -f "$1"/usr/share/man/man1/cover-thumbnailer.1 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -v ./man/cover-thumbnailer-gui.1 "$1"/usr/share/man/man1/ 1>> $LOGFILE 2>> $LOGFILE || error=1 - gzip --best -f "$1"/usr/share/man/man1/cover-thumbnailer-gui.1 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/doc/cover-thumbnailer - mkdir -pv "$1"/usr/share/doc/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -v ./README.md "$1"/usr/share/doc/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/locale/xx_XX/LC_MESSAGES - for file in `find ./locale -name "*.po"` ; do { - l10elang=`echo $file | sed -r 's#./locale/(.*).po#\1#g'` - mkdir -pv "$1"/usr/share/locale/$l10elang/LC_MESSAGES/ 1>> $LOGFILE 2>> $LOGFILE || error=1 - msgfmt "$file" -o "$1"/usr/share/locale/$l10elang/LC_MESSAGES/cover-thumbnailer-gui.mo 1>> $LOGFILE 2>> $LOGFILE || error=1 - } done - - #/usr/share/applications - mkdir -pv "$1"/usr/share/applications/ 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -v ./freedesktop/cover-thumbnailer-gui.desktop "$1"/usr/share/applications/cover-thumbnailer-gui.desktop 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/thumbnailers - mkdir -pv "$1"/usr/share/thumbnailers/ 1>> $LOGFILE 2>> $LOGFILE || error=1 - cp -v ./freedesktop/cover.thumbnailer "$1"/usr/share/thumbnailers/cover.thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #uninstall.sh - if [ -z $1 ] ; then { - cp ./install.sh /usr/share/cover-thumbnailer/uninstall.sh 1>> $LOGFILE 2>> $LOGFILE || error=1 - chmod -v 755 /usr/share/cover-thumbnailer/uninstall.sh 1>> $LOGFILE 2>> $LOGFILE || error=1 - } fi - - if [ "$error" == "1" ] ; then { - echo "$_RED E:$_NORMAL An error occurred when installing $SOFTWARE" - echo "$_RED E:$_NORMAL See the log file for more informations." - echo "$_RED E:$_NORMAL $LOGFILE" - exit 20 - } else { - echo " $_GREEN$SOFTWARE was successfully installed on your computer$_NORMAL" - rm $LOGFILE 1> /dev/null 2> /dev/null - } fi -} - - -_remove() { - #Remove the software - - #/usr/share/applications - rm -fv /usr/share/applications/cover-thumbnailer-gui.desktop 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/cover-thumbnailer - rm -rfv /usr/share/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/doc - rm -rfv /usr/share/doc/cover-thumbnailer/ 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/man/man1 - rm -vf /usr/share/man/man1/cover-thumbnailer.1.gz 1>> $LOGFILE 2>> $LOGFILE || error=1 - rm -vf /usr/share/man/man1/cover-thumbnailer-gui.1.gz 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/locale/xx_XX/LC_MESSAGES/cover-thumbnailer-gui.mo - find /usr/share/locale/ \ - -name cover-thumbnailer-gui.mo \ - -exec rm -v '{}' ';' \ - 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/bin - rm -vf /usr/bin/cover-thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - rm -vf /usr/bin/cover-thumbnailer-gui 1>> $LOGFILE 2>> $LOGFILE || error=1 - - #/usr/share/thumbnailers - rm -vf /usr/share/thumbnailers/cover.thumbnailer 1>> $LOGFILE 2>> $LOGFILE || error=1 - - if [ "$error" == "1" ] ; then { - echo "$_RED E:$_NORMAL An error occurred when removing $SOFTWARE" - echo "$_RED E:$_NORMAL See the log file for more informations." - echo "$_RED E:$_NORMAL $LOGFILE" - exit 20 - } else { - echo " $_GREEN$SOFTWARE was successfully removed from your computer$_NORMAL" - rm $LOGFILE 1> /dev/null 2> /dev/null - } fi -} - - -_locale() { - #Extracts strings - - mkdir -pv ./locale/ - xgettext -k_ -kN_ \ - -o ./locale/cover-thumbnailer-gui.pot \ - ./cover-thumbnailer-gui.py \ - ./share/cover-thumbnailer-gui.glade - for lcfile in $(find ./locale/ -name "*.po") ; do { - echo -n " * $lcfile" - msgmerge --update $lcfile ./locale/cover-thumbnailer-gui.pot - } done -} - - -_check_for_old_version() { - #Checks if an older version is installed, and try to remove. - - echo " * Checking for old version..." - if [ -d /usr/share/cover-thumbnailer/ ] ; then { #Version >= 0.4 - echo " Version 0.4 or newer found." - if [ -x /usr/share/cover-thumbnailer/uninstall.sh ] ; then { - /usr/share/cover-thumbnailer/uninstall.sh --remove 1>> $LOGFILE 2>> $LOGFILE || error=1 - if [ "$error" == "1" ] ; then { - echo " E: An error occurred when removing installed version." - echo " E: See the log file for more informations." - echo " E: $LOGFILE" - exit 11 - } else { - echo " * Old version successfully removed" - } fi - } else { - echo " E: Can't remove the installed version." - echo " E: Remove it manually and run this script again." - exit 10 - } fi - } fi -} - - -_check_dep() { - #Checks dependencies - - echo "$_BOLD * Checking dependencies...$_NORMAL" - echo -n " * Python 3 ............................ " - test -x /usr/bin/python3 && echo "$_GREEN[OK]$_NORMAL" || { echo "$_RED[Missing]$_NORMAL" ; error=1 ; } - echo -n " * Python Imaging Library (PIL) ........ " - $_PY <<< "$(echo -e "try: from PIL import Image\nexcept: import Image")" 1> /dev/null 2> /dev/null && echo "$_GREEN[OK]$_NORMAL" || { echo "$_RED[Missing]$_NORMAL" ; error=1 ; } - echo -n " * Python gi and GTK introspection ..... " - $_PY <<< "import gi ; gi.require_version('Gtk', '3.0') ; from gi.repository import Gtk" 1> /dev/null 2> /dev/null && echo "$_GREEN[OK]$_NORMAL" || { echo "$_RED[Missing]$_NORMAL" ; error=1 ; } - echo -n " * Python gettext support .............. " - $_PY <<< "import gettext" 1> /dev/null 2> /dev/null && echo "$_GREEN[OK]$_NORMAL" || { echo "$_RED[Missing]$_NORMAL" ; error=1 ; } - if [ "$error" == "1" ] ; then { - echo "$_RED E:$_NORMAL Some dependencies are missing." - exit 30 - } fi -} - - -_check_build_dep() { - #Checks build dependencies - - echo "$_BOLD * Checking build dependencies...$_NORMAL" - echo -n " * gettext ............................. " - test -x /usr/bin/xgettext && echo "$_GREEN[OK]$_NORMAL" || { echo "$_RED[Missing]$_NORMAL" ; error=1 ; } - if [ "$error" == "1" ] ; then { - echo "$_RED E:$_NORMAL Some build dependencies are missing." - exit 31 - } fi -} - - -#Go to the script directory -cd "${0%/*}" 1> /dev/null 2> /dev/null - -#Force English -export LANG=C -#Header -echo -e "$SOFTWARE - $DESC\n" - -#Python -export _PY=/usr/bin/python3 - -#Action do to -if [ "$1" == "--install" ] || [ "$1" == "-i" ] ; then { - #Colors - _RED=$(echo -e "\033[1;31m") - _GREEN=$(echo -e "\033[1;32m") - _NORMAL=$(echo -e "\033[0m") - _BOLD=$(echo -e "\033[1m") - if [ "$(whoami)" == "root" ] ; then { - _check_build_dep - _check_dep - echo "$_BOLD * Installing $SOFTWARE...$_NORMAL" - _install - } else { - echo "$_BOLD * Installing $SOFTWARE...$_NORMAL" - echo "$_RED E:$_NORMAL Need to be root" - exit 1 - } fi -} elif [ "$1" == "--package" ] || [ "$1" == "-p" ] ; then { - _check_build_dep - echo " * Packaging $SOFTWARE..." - mkdir -p "$2" 1> /dev/null 2> /dev/null #create the output directory if not exists - #Check if the directory is empty - if [ $(find "$2" | wc -l) != 1 ] ; then - echo "E: The destination folder '$2' is not empty..." - exit 5 - fi - if [ -d "$2" ] ; then { - _install "$2" - } else { - echo " E: '$2' is not a directory" - exit 2 - } fi -} elif [ "$1" == "--remove" ] || [ "$1" == "-r" ] ; then { - #Colors - _RED=$(echo -e "\033[1;31m") - _GREEN=$(echo -e "\033[1;32m") - _NORMAL=$(echo -e "\033[0m") - _BOLD=$(echo -e "\033[1m") - echo "$_BOLD * Removing $SOFTWARE...$_NORMAL" - if [ "$(whoami)" == "root" ] ; then { - _remove - } else { - echo "$_RED E:$_NORMAL Need to be root" - exit 1 - } fi -} elif [ "$1" == "--locale" ] || [ "$1" == "-l" ] ; then { - #Colors - _RED=$(echo -e "\033[1;31m") - _GREEN=$(echo -e "\033[1;32m") - _NORMAL=$(echo -e "\033[0m") - _BOLD=$(echo -e "\033[1m") - echo "$_BOLD * Extracting strings for the translation template...$_NORMAL" - if [ -x /usr/bin/xgettext ] ; then { - _locale - } else { - echo "$_RED E:$_NORMAL Can't find xgettext... Please install gettext and try again." - exit 3 - } fi -} else { - echo "Arguments:" - echo " --install : install $SOFTWARE on your computer." - echo " --package : install $SOFTWARE in (Useful for packaging)." - echo " NOTE: with no slash ('/') at the end" - echo " --remove : remove $SOFTWARE from your computer." - echo " --locale : extract strings to for the translation template." - exit 4 -} fi diff --git a/man/cover-thumbnailer-gui.1 b/man/cover-thumbnailer-gui.1 index a0a0f04..1797c68 100644 --- a/man/cover-thumbnailer-gui.1 +++ b/man/cover-thumbnailer-gui.1 @@ -1,4 +1,4 @@ -.TH cover-thumbnailer-gui 1 "Mon, 31 Jul 2023" "version 0.10.1" "COVER THUMBNAILER GUI" +.TH cover-thumbnailer-gui 1 "{{DATE}}" "version {{VERSION}}" "COVER THUMBNAILER GUI" .SH NAME cover-thumbnailer-gui \- configuration tool for cover-thumbnailer diff --git a/man/cover-thumbnailer.1 b/man/cover-thumbnailer.1 index deb89d3..f545ba0 100644 --- a/man/cover-thumbnailer.1 +++ b/man/cover-thumbnailer.1 @@ -1,4 +1,4 @@ -.TH cover-thumbnailer 1 "Mon, 31 Jul 2023" "version 0.10.1" "COVER THUMBNAILER" +.TH cover-thumbnailer 1 "{{DATE}}" "version {{VERSION}}" "COVER THUMBNAILER" .SH NAME cover-thumbnailer \- display music covers and more in nautilus diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..e740bc1 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[project] +name = "cover-thumbnailer" +version = "0.10.1" +description = "directory cover thumbnailer for GTK based file viewers" +authors = ["Fabien Loison "] +readme = "README.md" +license = "GPL-3.0" +classifiers = [ + "Development Status :: 6 - Mature", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Operating System :: POSIX :: Linux", + "Topic :: System", + "Programming Language :: Python :: 3.8", +] + +requires-python = ">=3.8" +dependencies = ["pillow>=10.0"]