[Xfce4-commits] [apps/catfish] 01/01: Detect locate capabilities and adjust command as needed (OpenBSD support)

noreply at xfce.org noreply at xfce.org
Mon Jan 28 03:25:52 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/catfish.

commit b521f1790fee1f342ccbd449106f6477115e20a2
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Sun Jan 27 21:25:46 2019 -0500

    Detect locate capabilities and adjust command as needed (OpenBSD support)
---
 catfish/CatfishSearchEngine.py | 30 +++++++++++++++++++++++++++---
 po/catfish.pot                 | 34 +++++++++++++++++++++-------------
 2 files changed, 48 insertions(+), 16 deletions(-)

diff --git a/catfish/CatfishSearchEngine.py b/catfish/CatfishSearchEngine.py
index 2680210..a36032e 100644
--- a/catfish/CatfishSearchEngine.py
+++ b/catfish/CatfishSearchEngine.py
@@ -547,9 +547,33 @@ class CatfishSearchMethod_Locate(CatfishSearchMethodExternal):
     def __init__(self):
         """Initialize the Locate SearchMethod."""
         CatfishSearchMethodExternal.__init__(self, "locate")
-        self.command = ["locate", "-i", "%path*%keywords*", "--existing"]
+        self.caps = self.get_capabilities()
+        if self.caps["existing"]:
+            self.command = ["locate", "-i", "%path*%keywords*", "--existing"]
+        else:
+            self.command = ["locate", "-i", "%path*%keywords*"]
+
+    def get_capabilities(self):
+        caps = {
+            "existing": False,
+            "regex": False
+        }
+        try:
+            details = subprocess.check_output(["locate", "--help"])
+            details = details.decode("utf-8")
+            if "--existing" in details:
+                caps["existing"] = True
+            if "--regex" in details or "--regexp" in details:
+                caps["regex"] = True
+
+        except subprocess.CalledProcessError:
+            pass
+        return caps
 
     def assemble_query(self, keywords, path):
         """Assemble the search query."""
-        return ["locate", "--regex", "--basename", "-i",
-                "{}".format(string_regex(keywords, path))]
+        if self.caps["regex"]:
+            return ["locate", "--regex", "--basename", "-i",
+                    "{}".format(string_regex(keywords, path))]
+        else:
+            return ["locate", "-i", "%path*", str(keywords)]
diff --git a/po/catfish.pot b/po/catfish.pot
index 2b41d88..5a1b7e6 100644
--- a/po/catfish.pot
+++ b/po/catfish.pot
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2019-01-20 10:17-0500\n"
+"POT-Creation-Date: 2019-01-27 21:24-0500\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -483,29 +483,37 @@ msgstr ""
 
 #: ../data/metainfo/catfish.appdata.xml.in.h:5
 msgid ""
+"This release features improved performance, better desktop integration, and "
+"a number of long-standing bugs. Quoted search strings are now correctly "
+"processed. Files can be dragged into other applications. Thumbnails are only "
+"generated when requested by the user."
+msgstr ""
+
+#: ../data/metainfo/catfish.appdata.xml.in.h:6
+msgid ""
 "This release features several improvements to thumbnail processing and "
 "numerous bug fixes. Icon previews have been improved and will now match "
 "other applications. Items displayed at the bottom of the results window are "
 "now accessible with all desktop themes."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:6
+#: ../data/metainfo/catfish.appdata.xml.in.h:7
 msgid "This is a minor translations-only release."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:7
+#: ../data/metainfo/catfish.appdata.xml.in.h:8
 msgid ""
 "This release features several performance improvements and numerous "
 "translation updates."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:8
+#: ../data/metainfo/catfish.appdata.xml.in.h:9
 msgid ""
 "This release now displays all file timestamps according to timezone instead "
 "of Universal Coordinated Time (UTC)."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:9
+#: ../data/metainfo/catfish.appdata.xml.in.h:10
 msgid ""
 "This release fixes several bugs related to the results window. Files are "
 "once again removed from the results list when deleted. Middle- and right-"
@@ -513,7 +521,7 @@ msgid ""
 "according to timezone instead of Universal Coordinated Time (UTC)."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:10
+#: ../data/metainfo/catfish.appdata.xml.in.h:11
 msgid ""
 "This release includes a significant interface refresh, improves search "
 "speed, and fixes several bugs. The workflow has been improved, utilizing "
@@ -522,42 +530,42 @@ msgid ""
 "integration of PolicyKit when available."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:11
+#: ../data/metainfo/catfish.appdata.xml.in.h:12
 msgid "This release fixes two new bugs and includes updated translations."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:12
+#: ../data/metainfo/catfish.appdata.xml.in.h:13
 msgid ""
 "This release fixes a regression where the application is unable to start on "
 "some systems."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:13
+#: ../data/metainfo/catfish.appdata.xml.in.h:14
 msgid ""
 "This release fixes a regression where multiple search terms were no longer "
 "supported. An InfoBar is now displayed when the search database is outdated, "
 "and the dialogs used to update the database have been improved."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:14
+#: ../data/metainfo/catfish.appdata.xml.in.h:15
 msgid ""
 "This release fixes two issues where locate would not be properly executed "
 "and improves handling of missing symbolic icons."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:15
+#: ../data/metainfo/catfish.appdata.xml.in.h:16
 msgid ""
 "This stable release improved the reliability of the password dialog, cleaned "
 "up unused code, and fixed potential issues with the list and item selection."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:16
+#: ../data/metainfo/catfish.appdata.xml.in.h:17
 msgid ""
 "This release fixed a potential security issue with program startup and fixed "
 "a regression with selecting multiple items."
 msgstr ""
 
-#: ../data/metainfo/catfish.appdata.xml.in.h:17
+#: ../data/metainfo/catfish.appdata.xml.in.h:18
 msgid ""
 "The first release in the 1.0.x series introduced a refreshed interface and "
 "fixed a number of long-standing bugs. Improvements to the default "

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list