[RESOLVED] digiKam package
Published: January 9, 2024 - 1:58 PM
Good morning,
Following a user request, I created the DigiKam package (Win 10 64bit). It's not super clean, but it's just waiting to be improved.
I haven't found an easy way to check for updates, so I parse the RSS feed looking for the latest version and then construct the download URL.
Good day
Following a user request, I created the DigiKam package (Win 10 64bit). It's not super clean, but it's just waiting to be improved.
I haven't found an easy way to check for updates, so I parse the RSS feed looking for the latest version and then construct the download URL.
Good day
Code: Select all
# -*- coding: utf-8 -*-
from setuphelpers import *
exe_name = "Digikam-x64.exe"
def install():
install_exe_if_needed(exe_name,key="digiKam")
pass
def update_package():
import xml.etree.ElementTree as ET
# On doit utiliser cette bibliotheque pour accéder a une URL
import urllib.request
opener = urllib.request.build_opener()
url = "https://apps.kde.org/fr/digikam/index.xml"
tree = ET.parse(opener.open(url))
root = tree.getroot()
#root[0][6][1].text correspond au lien la derniere version
text_link_last_version = root[0][6][1].text
version_online = text_link_last_version.split("#")[1]
#Construction du lien de téléchargement
download_url = "https://download.kde.org/stable/digikam/%s/digiKam-%s-Win64.exe" % (version_online,version_online)
latest_bin = download_url.split("/")[-1]
package_updated = False
proxies = get_proxies()
if not proxies:
proxies = get_proxies_from_wapt_console()
exe_name = "Digikam-x64.exe"
# Checking version from file
version_actuelle = Version(control.get_software_version())
if version_actuelle != Version(version_online) and version_actuelle != "":
if os.path.isfile(exe_name):
print("Changing version to the version number of the binary")
os.rename(exe_name, "%s-ancien" % exe_name)
# Téléchargement du dernier binaire
print("Latest %s version is: %s" % (control.name, version_online))
print("Download URL is: %s" % download_url)
if not isfile(latest_bin):
print("Downloading: %s" % latest_bin)
wget(download_url, latest_bin, proxies=proxies)
os.rename(latest_bin, exe_name)
else:
print("Binary is present: %s" % latest_bin)
# Changement de la version du paquet
if Version(version_online) > version_actuelle:
print("Software version updated (from: %s to: %s)" % (version_actuelle, Version(version_online)))
package_updated = True
else:
print("Software version up-to-date (%s)" % Version(version_online))
control.set_software_version(version_online)
control.save_control_to_wapt()
# Suppression du binaire obsolete
if isfile("%s-ancien" % exe_name):
os.remove("%s-ancien" % exe_name)
# Validating update-package-sources
return package_updated
else:
print("Binary file version corresponds to online version")
pass