From 5c70aa0b68d1c39334b85298b9795cc7cc59e017 Mon Sep 17 00:00:00 2001 From: Bobby Rong Date: Tue, 13 Feb 2024 11:28:02 +0000 Subject: [PATCH] =?UTF-8?q?orca:=2045.2=20=E2=86=92=2046.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://gitlab.gnome.org/GNOME/orca/-/compare/ORCA_45_2...ORCA_46_1 Regenerated the fix-paths.patch by searching usages of `subprocess`. Port to meson. No more pyatspi. https://github.com/GNOME/orca/commit/1c496c9ada82fdfd33c5be9bcddfdb76aca6c55b Move to by-name and use pkgs.callPackage so we don't have to write another `inherit (pkgs.buildPackages) meson;`. Changelog-Reviewed-By: Maxine Aubrey --- pkgs/applications/misc/orca/fix-paths.patch | 88 ------------------- pkgs/by-name/or/orca/fix-paths.patch | 75 ++++++++++++++++ .../or/orca/package.nix} | 33 +++---- pkgs/top-level/all-packages.nix | 4 - 4 files changed, 92 insertions(+), 108 deletions(-) delete mode 100644 pkgs/applications/misc/orca/fix-paths.patch create mode 100644 pkgs/by-name/or/orca/fix-paths.patch rename pkgs/{applications/misc/orca/default.nix => by-name/or/orca/package.nix} (85%) diff --git a/pkgs/applications/misc/orca/fix-paths.patch b/pkgs/applications/misc/orca/fix-paths.patch deleted file mode 100644 index 45ae4b827ba5..000000000000 --- a/pkgs/applications/misc/orca/fix-paths.patch +++ /dev/null @@ -1,88 +0,0 @@ -diff --git a/src/orca/debug.py b/src/orca/debug.py -index b7e11ea60..9ab996765 100644 ---- a/src/orca/debug.py -+++ b/src/orca/debug.py -@@ -447,7 +447,7 @@ def traceit(frame, event, arg): - return traceit - - def getOpenFDCount(pid): -- procs = subprocess.check_output([ 'lsof', '-w', '-Ff', '-p', str(pid)]) -+ procs = subprocess.check_output([ '@lsof@', '-w', '-Ff', '-p', str(pid)]) - procs = procs.decode('UTF-8').split('\n') - files = list(filter(lambda s: s and s[0] == 'f' and s[1:].isdigit(), procs)) - -@@ -465,7 +465,7 @@ def getCmdline(pid): - return cmdline - - def pidOf(procName): -- openFile = subprocess.Popen(f'pgrep {procName}', -+ openFile = subprocess.Popen(f'@pgrep@ {procName}', - shell=True, - stdout=subprocess.PIPE).stdout - pids = openFile.read() -diff --git a/src/orca/orca.py b/src/orca/orca.py -index d4e89f918..bb3e6cc1d 100644 ---- a/src/orca/orca.py -+++ b/src/orca/orca.py -@@ -312,7 +312,7 @@ def updateKeyMap(keyboardEvent): - - def _setXmodmap(xkbmap): - """Set the keyboard map using xkbcomp.""" -- p = subprocess.Popen(['xkbcomp', '-w0', '-', os.environ['DISPLAY']], -+ p = subprocess.Popen(['@xkbcomp@', '-w0', '-', os.environ['DISPLAY']], - stdin=subprocess.PIPE, stdout=None, stderr=None) - p.communicate(xkbmap) - -@@ -389,7 +389,7 @@ def _storeXmodmap(keyList): - """ - - global _originalXmodmap -- _originalXmodmap = subprocess.check_output(['xkbcomp', os.environ['DISPLAY'], '-']) -+ _originalXmodmap = subprocess.check_output(['@xkbcomp@', os.environ['DISPLAY'], '-']) - - def _restoreXmodmap(keyList=[]): - """Restore the original xmodmap values for the keys in keyList. -@@ -404,7 +404,7 @@ def _restoreXmodmap(keyList=[]): - - global _capsLockCleared - _capsLockCleared = False -- p = subprocess.Popen(['xkbcomp', '-w0', '-', os.environ['DISPLAY']], -+ p = subprocess.Popen(['@xkbcomp@', '-w0', '-', os.environ['DISPLAY']], - stdin=subprocess.PIPE, stdout=None, stderr=None) - p.communicate(_originalXmodmap) - -diff --git a/src/orca/orca_bin.py.in b/src/orca/orca_bin.py.in -index 9d64af948..ca9c9e083 100644 ---- a/src/orca/orca_bin.py.in -+++ b/src/orca/orca_bin.py.in -@@ -65,7 +65,7 @@ class ListApps(argparse.Action): - name = "[DEAD]" - - try: -- cmdline = subprocess.getoutput('cat /proc/%s/cmdline' % pid) -+ cmdline = subprocess.getoutput('@cat@ /proc/%s/cmdline' % pid) - except Exception: - cmdline = '(exception encountered)' - else: -@@ -198,7 +198,7 @@ def inGraphicalDesktop(): - def otherOrcas(): - """Returns the pid of any other instances of Orca owned by this user.""" - -- openFile = subprocess.Popen('pgrep -u %s -x orca' % os.getuid(), -+ openFile = subprocess.Popen('@pgrep@ -u %s -x orca' % os.getuid(), - shell=True, - stdout=subprocess.PIPE).stdout - pids = openFile.read() -diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py -index ed8b155e4..0436cca42 100644 ---- a/src/orca/script_utilities.py -+++ b/src/orca/script_utilities.py -@@ -144,7 +144,7 @@ class Utilities: - return "" - - try: -- cmdline = subprocess.getoutput(f"cat /proc/{pid}/cmdline") -+ cmdline = subprocess.getoutput(f"@cat@ /proc/{pid}/cmdline") - except Exception: - return "" - diff --git a/pkgs/by-name/or/orca/fix-paths.patch b/pkgs/by-name/or/orca/fix-paths.patch new file mode 100644 index 000000000000..5f5feacb33a5 --- /dev/null +++ b/pkgs/by-name/or/orca/fix-paths.patch @@ -0,0 +1,75 @@ +diff --git a/src/orca/debug.py b/src/orca/debug.py +index eb939a236..4e4db2e84 100644 +--- a/src/orca/debug.py ++++ b/src/orca/debug.py +@@ -522,7 +522,7 @@ def traceit(frame, event, arg): + return traceit + + def getOpenFDCount(pid): +- procs = subprocess.check_output([ 'lsof', '-w', '-Ff', '-p', str(pid)]) ++ procs = subprocess.check_output([ '@lsof@', '-w', '-Ff', '-p', str(pid)]) + procs = procs.decode('UTF-8').split('\n') + files = list(filter(lambda s: s and s[0] == 'f' and s[1:].isdigit(), procs)) + +@@ -540,7 +540,7 @@ def getCmdline(pid): + return cmdline + + def pidOf(procName): +- openFile = subprocess.Popen(f'pgrep {procName}', ++ openFile = subprocess.Popen(f'@pgrep@ {procName}', + shell=True, + stdout=subprocess.PIPE).stdout + pids = openFile.read() +diff --git a/src/orca/orca_bin.py.in b/src/orca/orca_bin.py.in +index c6f99de14..2370204f3 100755 +--- a/src/orca/orca_bin.py.in ++++ b/src/orca/orca_bin.py.in +@@ -62,7 +62,7 @@ class ListApps(argparse.Action): + name = "[DEAD]" + + try: +- cmdline = subprocess.getoutput('cat /proc/%s/cmdline' % pid) ++ cmdline = subprocess.getoutput('@cat@ /proc/%s/cmdline' % pid) + except Exception: + cmdline = '(exception encountered)' + else: +@@ -195,7 +195,7 @@ def inGraphicalDesktop(): + def otherOrcas(): + """Returns the pid of any other instances of Orca owned by this user.""" + +- openFile = subprocess.Popen('pgrep -u %s -x orca' % os.getuid(), ++ openFile = subprocess.Popen('@pgrep@ -u %s -x orca' % os.getuid(), + shell=True, + stdout=subprocess.PIPE).stdout + pids = openFile.read() +diff --git a/src/orca/orca_modifier_manager.py b/src/orca/orca_modifier_manager.py +index c45cd4a5b..3f2ec59f0 100644 +--- a/src/orca/orca_modifier_manager.py ++++ b/src/orca/orca_modifier_manager.py +@@ -115,7 +115,7 @@ class OrcaModifierManager: + debug.printMessage(debug.LEVEL_INFO, msg, True) + + self.unset_orca_modifiers(reason) +- self._original_xmodmap = subprocess.check_output(['xkbcomp', os.environ['DISPLAY'], '-']) ++ self._original_xmodmap = subprocess.check_output(['@xkbcomp@', os.environ['DISPLAY'], '-']) + self._create_orca_xmodmap() + + def update_key_map(self, keyboard_event): +@@ -162,7 +162,7 @@ class OrcaModifierManager: + return + + self._caps_lock_cleared = False +- p = subprocess.Popen(['xkbcomp', '-w0', '-', os.environ['DISPLAY']], ++ p = subprocess.Popen(['@xkbcomp@', '-w0', '-', os.environ['DISPLAY']], + stdin=subprocess.PIPE, stdout=None, stderr=None) + p.communicate(self._original_xmodmap) + +@@ -223,7 +223,7 @@ class OrcaModifierManager: + if modified: + msg = "ORCA MODIFIER MANAGER: Updating xmodmap" + debug.printMessage(debug.LEVEL_INFO, msg, True) +- p = subprocess.Popen(['xkbcomp', '-w0', '-', os.environ['DISPLAY']], ++ p = subprocess.Popen(['@xkbcomp@', '-w0', '-', os.environ['DISPLAY']], + stdin=subprocess.PIPE, stdout=None, stderr=None) + p.communicate(bytes('\n'.join(lines), 'UTF-8')) + else: diff --git a/pkgs/applications/misc/orca/default.nix b/pkgs/by-name/or/orca/package.nix similarity index 85% rename from pkgs/applications/misc/orca/default.nix rename to pkgs/by-name/or/orca/package.nix index dcb578dd5678..2ae6a649c84c 100644 --- a/pkgs/applications/misc/orca/default.nix +++ b/pkgs/by-name/or/orca/package.nix @@ -1,24 +1,20 @@ { lib , pkg-config , fetchurl -, buildPythonApplication -, autoreconfHook +, meson +, ninja , wrapGAppsHook , gobject-introspection , gettext , yelp-tools , itstool -, python -, pygobject3 +, python3 , gtk3 , gnome , substituteAll , at-spi2-atk , at-spi2-core -, pyatspi , dbus -, dbus-python -, pyxdg , xkbcomp , procps , lsof @@ -27,20 +23,18 @@ , speechd , brltty , liblouis -, setproctitle , gst_all_1 -, gst-python }: -buildPythonApplication rec { +python3.pkgs.buildPythonApplication rec { pname = "orca"; - version = "45.2"; + version = "46.1"; format = "other"; src = fetchurl { url = "mirror://gnome/sources/${pname}/${lib.versions.major version}/${pname}-${version}.tar.xz"; - sha256 = "8PLFeaW+7f5WU7x/4kSBxNaqxd0fccHnoghZXzx473Y="; + hash = "sha256-z2deNQwYrA+ilDbGVZ0dqXX3///vqAjr5HbY+enRERQ="; }; patches = [ @@ -54,7 +48,8 @@ buildPythonApplication rec { ]; nativeBuildInputs = [ - autoreconfHook + meson + ninja wrapGAppsHook pkg-config gettext @@ -63,13 +58,13 @@ buildPythonApplication rec { gobject-introspection ]; - pythonPath = [ + pythonPath = with python3.pkgs; [ pygobject3 - pyatspi dbus-python pyxdg brltty liblouis + psutil speechd gst-python setproctitle @@ -78,7 +73,7 @@ buildPythonApplication rec { strictDeps = false; buildInputs = [ - python + python3 gtk3 at-spi2-atk at-spi2-core @@ -89,6 +84,12 @@ buildPythonApplication rec { gst_all_1.gst-plugins-good ]; + dontWrapGApps = true; # Prevent double wrapping + + preFixup = '' + makeWrapperArgs+=("''${gappsWrapperArgs[@]}") + ''; + passthru = { updateScript = gnome.updateScript { packageName = pname; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 040fa763bf61..9eeca4e65e44 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33748,10 +33748,6 @@ with pkgs; oranda = callPackage ../applications/misc/oranda { }; - orca = python3Packages.callPackage ../applications/misc/orca { - inherit pkg-config; - }; - orca-c = callPackage ../applications/audio/orca-c { }; organicmaps = qt6Packages.callPackage ../applications/misc/organicmaps { };