Merge pull request #292837 from iFreilicht/update-persepolis

persepolis: 3.2.0 -> 4.0.1

authored by Sandro and committed by GitHub 3dd4b58d d769131c

+85 -183
+84
pkgs/by-name/pe/persepolis/package.nix
··· 1 + { lib 2 + , stdenv 3 + , qt5 4 + , python3 5 + , fetchFromGitHub 6 + , aria2 7 + , ffmpeg 8 + , libnotify 9 + , pulseaudio 10 + , sound-theme-freedesktop 11 + , pkg-config 12 + , meson 13 + , ninja 14 + }: 15 + 16 + python3.pkgs.buildPythonApplication rec { 17 + pname = "persepolis"; 18 + version = "4.0.1"; 19 + format = "other"; 20 + 21 + src = fetchFromGitHub { 22 + owner = "persepolisdm"; 23 + repo = "persepolis"; 24 + rev = "57dc9d438bb3f126070a17c7a3677c45ea4dd332"; 25 + hash = "sha256-7OXAITFQJ2/aY0QmqlAo7if7cY7+T3j6PUjfJJV8Z2Q="; 26 + }; 27 + 28 + patches = [ 29 + # Upstream does currently not allow building from source on macOS. These patches can likely 30 + # be removed if https://github.com/persepolisdm/persepolis/issues/943 is fixed upstream 31 + ./0003-Search-PATH-for-aria2c-on-darwin.patch 32 + ./0004-Search-PATH-for-ffmpeg-on-darwin.patch 33 + ]; 34 + 35 + postPatch = '' 36 + # Ensure dependencies with hard-coded FHS dependencies are properly detected 37 + substituteInPlace check_dependencies.py --replace-fail "isdir(notifications_path)" "isdir('${sound-theme-freedesktop}/share/sounds/freedesktop')" 38 + ''; 39 + 40 + postInstall = '' 41 + mkdir -p $out/share/applications 42 + cp $src/xdg/com.github.persepolisdm.persepolis.desktop $out/share/applications 43 + ''; 44 + 45 + # prevent double wrapping 46 + dontWrapQtApps = true; 47 + nativeBuildInputs = [ meson ninja pkg-config qt5.wrapQtAppsHook ]; 48 + 49 + # feed args to wrapPythonApp 50 + makeWrapperArgs = [ 51 + "--prefix PATH : ${lib.makeBinPath [ aria2 ffmpeg libnotify ]}" 52 + "\${qtWrapperArgs[@]}" 53 + ]; 54 + 55 + # The presence of these dependencies is checked during setuptoolsCheckPhase, 56 + # but apart from that, they're not required during build, only runtime 57 + nativeCheckInputs = [ 58 + aria2 59 + libnotify 60 + pulseaudio 61 + sound-theme-freedesktop 62 + ffmpeg 63 + ]; 64 + 65 + propagatedBuildInputs = [ 66 + pulseaudio 67 + sound-theme-freedesktop 68 + ] ++ (with python3.pkgs; [ 69 + psutil 70 + pyqt5 71 + requests 72 + setproctitle 73 + setuptools 74 + yt-dlp 75 + ]); 76 + 77 + meta = with lib; { 78 + description = "A GUI for aria2"; 79 + mainProgram = "persepolis"; 80 + homepage = "https://persepolisdm.github.io/"; 81 + license = licenses.gpl3Plus; 82 + maintainers = with maintainers; [ iFreilicht ]; 83 + }; 84 + }
-45
pkgs/tools/networking/persepolis/0001-Allow-building-on-darwin.patch
··· 1 - --- 2 - setup.py | 13 +++++-------- 3 - 1 file changed, 5 insertions(+), 8 deletions(-) 4 - 5 - diff --git a/setup.py b/setup.py 6 - index 985d28d..933f3df 100755 7 - --- a/setup.py 8 - +++ b/setup.py 9 - @@ -24,13 +24,9 @@ import shutil 10 - # finding os platform 11 - os_type = platform.system() 12 - 13 - -if os_type == 'Linux' or os_type == 'FreeBSD' or os_type == 'OpenBSD': 14 - - from setuptools import setup, Command, find_packages 15 - - setuptools_available = True 16 - - print(os_type + " detected!") 17 - -else: 18 - - print('This script is only work for GNU/Linux or BSD!') 19 - - sys.exit(1) 20 - +from setuptools import setup, Command, find_packages 21 - +setuptools_available = True 22 - +print(os_type + " detected!") 23 - 24 - # Checking dependencies! 25 - not_installed = '' 26 - @@ -100,6 +96,7 @@ else: 27 - print('paplay is found!') 28 - 29 - # sound-theme-freedesktop 30 - +notifications_path = '' 31 - if os_type == 'Linux': 32 - notifications_path = '/usr/share/sounds/freedesktop/stereo/' 33 - elif os_type == 'FreeBSD' or os_type == 'OpenBSD': 34 - @@ -139,7 +136,7 @@ if sys.argv[1] == "test": 35 - 36 - DESCRIPTION = 'Persepolis Download Manager' 37 - 38 - -if os_type == 'Linux': 39 - +if os_type in ['Linux', 'Darwin']: 40 - DATA_FILES = [ 41 - ('/usr/share/man/man1/', ['man/persepolis.1.gz']), 42 - ('/usr/share/applications/', ['xdg/com.github.persepolisdm.persepolis.desktop']), 43 - -- 44 - 2.39.3 (Apple Git-145) 45 -
-41
pkgs/tools/networking/persepolis/0002-Fix-startup-crash-on-darwin.patch
··· 1 - --- 2 - persepolis/scripts/mac_notification.py | 25 +++++++++---------------- 3 - 1 file changed, 9 insertions(+), 16 deletions(-) 4 - 5 - diff --git a/persepolis/scripts/mac_notification.py b/persepolis/scripts/mac_notification.py 6 - index 4d69929..9a9a7cf 100644 7 - --- a/persepolis/scripts/mac_notification.py 8 - +++ b/persepolis/scripts/mac_notification.py 9 - @@ -15,20 +15,13 @@ 10 - 11 - # native notification on mac! needs Xcode (latest version) installed and pyobjc 12 - # library from pip 13 - -import Foundation 14 - -import AppKit 15 - -import objc 16 - - 17 - -NSUserNotification = objc.lookUpClass('NSUserNotification') 18 - -NSUserNotificationCenter = objc.lookUpClass('NSUserNotificationCenter') 19 - - 20 - - 21 - def notifyMac(title, subtitle, info_text, delay=0): 22 - - notification = NSUserNotification.alloc().init() 23 - - notification.setTitle_(title) 24 - - notification.setSubtitle_(subtitle) 25 - - notification.setInformativeText_(info_text) 26 - - notification.setDeliveryDate_(Foundation.NSDate.dateWithTimeInterval_sinceDate_( 27 - - delay, Foundation.NSDate.date())) 28 - - NSUserNotificationCenter.defaultUserNotificationCenter( 29 - - ).scheduleNotification_(notification) 30 - + print(f""" 31 - +Warning: Persepolis was installed from nixpkgs, which currently breaks notifications 32 - + on macOS. Until https://github.com/NixOS/nixpkgs/issues/105156 is resolved, 33 - + this cannot be fixed. The notification that should've been displayed was: 34 - + 35 - + title: {title} 36 - + subtitle: {subtitle} 37 - + info_text: {info_text} 38 - + """) 39 - -- 40 - 2.39.3 (Apple Git-145) 41 -
+1 -1
pkgs/tools/networking/persepolis/0003-Search-PATH-for-aria2c-on-darwin.patch pkgs/by-name/pe/persepolis/0003-Search-PATH-for-aria2c-on-darwin.patch
··· 9 9 @@ -72,16 +72,8 @@ def startAria(): 10 10 11 11 # in macintosh 12 - elif os_type == 'Darwin': 12 + elif os_type == OS.OSX: 13 13 - if aria2_path == "" or aria2_path == None or os.path.isfile(str(aria2_path)) == False: 14 14 - 15 15 - cwd = sys.argv[0]
pkgs/tools/networking/persepolis/0004-Search-PATH-for-ffmpeg-on-darwin.patch pkgs/by-name/pe/persepolis/0004-Search-PATH-for-ffmpeg-on-darwin.patch
-92
pkgs/tools/networking/persepolis/default.nix
··· 1 - { lib 2 - , stdenv 3 - , buildPythonApplication 4 - , fetchFromGitHub 5 - , aria2 6 - , ffmpeg 7 - , libnotify 8 - , pulseaudio 9 - , psutil 10 - , pyqt5 11 - , requests 12 - , setproctitle 13 - , setuptools 14 - , sound-theme-freedesktop 15 - , wrapQtAppsHook 16 - , yt-dlp 17 - }: 18 - 19 - buildPythonApplication rec { 20 - pname = "persepolis"; 21 - version = "3.2.0"; 22 - 23 - src = fetchFromGitHub { 24 - owner = "persepolisdm"; 25 - repo = "persepolis"; 26 - rev = version; 27 - sha256 = "1rh7q432ynbysapsd075nif975ync71icpb71x2mb4j8jx1vzs45"; 28 - }; 29 - 30 - # see: https://github.com/persepolisdm/persepolis/blob/3.2.0/setup.py#L130 31 - doCheck = false; 32 - 33 - preBuild= 34 - # Make setup automatic 35 - '' 36 - substituteInPlace setup.py --replace "answer = input(" "answer = 'y'#" 37 - '' + 38 - # Replace abandoned youtube-dl with maintained fork yt-dlp. Fixes https://github.com/persepolisdm/persepolis/issues/930, 39 - # can be removed if that issue is fixed and/or https://github.com/persepolisdm/persepolis/pull/936 is merged 40 - '' 41 - substituteInPlace setup.py ./persepolis/scripts/video_finder_addlink.py --replace \ 42 - "import youtube_dl" "import yt_dlp as youtube_dl" 43 - ''; 44 - 45 - patches = lib.optionals stdenv.isDarwin [ 46 - # Upstream is abandonware, the last commit to master was on 2021-08-26. 47 - # If it is forked or picked up again, consider upstreaming these patches. 48 - ./0001-Allow-building-on-darwin.patch 49 - ./0002-Fix-startup-crash-on-darwin.patch 50 - ./0003-Search-PATH-for-aria2c-on-darwin.patch 51 - ./0004-Search-PATH-for-ffmpeg-on-darwin.patch 52 - ]; 53 - 54 - postPatch = '' 55 - sed -i 's|/usr/share/sounds/freedesktop/stereo/|${sound-theme-freedesktop}/share/sounds/freedesktop/stereo/|' setup.py 56 - sed -i "s|'persepolis = persepolis.__main__'|'persepolis = persepolis.scripts.persepolis:main'|" setup.py 57 - ''; 58 - 59 - postInstall = '' 60 - mkdir -p $out/share/applications 61 - cp $src/xdg/com.github.persepolisdm.persepolis.desktop $out/share/applications 62 - ''; 63 - 64 - # prevent double wrapping 65 - dontWrapQtApps = true; 66 - nativeBuildInputs = [ wrapQtAppsHook ]; 67 - 68 - # feed args to wrapPythonApp 69 - makeWrapperArgs = [ 70 - "--prefix PATH : ${lib.makeBinPath [ aria2 ffmpeg libnotify ]}" 71 - "\${qtWrapperArgs[@]}" 72 - ]; 73 - 74 - propagatedBuildInputs = [ 75 - pulseaudio 76 - psutil 77 - pyqt5 78 - requests 79 - setproctitle 80 - setuptools 81 - sound-theme-freedesktop 82 - yt-dlp 83 - ]; 84 - 85 - meta = with lib; { 86 - description = "Persepolis Download Manager is a GUI for aria2"; 87 - mainProgram = "persepolis"; 88 - homepage = "https://persepolisdm.github.io/"; 89 - license = licenses.gpl3; 90 - maintainers = with maintainers; [ iFreilicht ]; 91 - }; 92 - }
-4
pkgs/top-level/all-packages.nix
··· 6050 6050 6051 6051 pcp = callPackage ../tools/misc/pcp { }; 6052 6052 6053 - persepolis = python3Packages.callPackage ../tools/networking/persepolis { 6054 - wrapQtAppsHook = qt5.wrapQtAppsHook; 6055 - }; 6056 - 6057 6053 pev = callPackage ../development/tools/analysis/pev { }; 6058 6054 6059 6055 phd2 = callPackage ../applications/science/astronomy/phd2 { };