summary refs log tree commit diff
path: root/pkgs/applications/graphics/vimiv/fixes.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/graphics/vimiv/fixes.patch')
-rw-r--r--pkgs/applications/graphics/vimiv/fixes.patch128
1 files changed, 128 insertions, 0 deletions
diff --git a/pkgs/applications/graphics/vimiv/fixes.patch b/pkgs/applications/graphics/vimiv/fixes.patch
new file mode 100644
index 00000000000..09c06e43058
--- /dev/null
+++ b/pkgs/applications/graphics/vimiv/fixes.patch
@@ -0,0 +1,128 @@
+Patch submitted upstream at https://github.com/karlch/vimiv/pull/32
+
+diff --git a/tests/main_test.py b/tests/main_test.py
+index a1870e7..2edc86d 100644
+--- a/tests/main_test.py
++++ b/tests/main_test.py
+@@ -15,7 +15,7 @@ class MainTest(TestCase):
+ 
+     def test_main_until_quit(self):
+         """Run through vimiv main once."""
+-        v_main.main(True)
++        v_main.main([], True)
+ 
+ 
+ if __name__ == '__main__':
+diff --git a/vimiv/helpers.py b/vimiv/helpers.py
+index 22f0115..bfaf016 100644
+--- a/vimiv/helpers.py
++++ b/vimiv/helpers.py
+@@ -3,7 +3,6 @@
+ """Wrappers around standard library functions used in vimiv."""
+ 
+ import os
+-from subprocess import Popen, PIPE
+ from gi import require_version
+ require_version('Gtk', '3.0')
+ from gi.repository import Gtk
+@@ -20,17 +19,17 @@ scrolltypes["K"] = (Gtk.ScrollType.START, False)
+ scrolltypes["L"] = (Gtk.ScrollType.END, True)
+ 
+ # A list of all external commands
+-external_commands = []
+-try:
+-    p = Popen('echo $PATH | tr \':\' \'\n\' | xargs -n 1 ls -1',
+-              stdout=PIPE, stderr=PIPE, shell=True)
+-    out, err = p.communicate()
+-    out = out.decode('utf-8').split()
+-    for cmd in sorted(list(set(out))):
+-        external_commands.append("!" + cmd)
+-except:
+-    external_commands = []
+-external_commands = tuple(external_commands)
++pathenv = os.environ.get('PATH')
++if pathenv is not None:
++    executables = set()
++    for path in pathenv.split(':'):
++        try:
++            executables |= set(["!" + e for e in os.listdir(path)])
++        except OSError:
++            continue
++    external_commands = tuple(sorted(list(executables)))
++else:
++    external_commands = ()
+ 
+ 
+ def listdir_wrapper(path, show_hidden=False):
+diff --git a/vimiv/imageactions.py b/vimiv/imageactions.py
+index d92eb73..b9bc986 100644
+--- a/vimiv/imageactions.py
++++ b/vimiv/imageactions.py
+@@ -157,8 +157,8 @@ class Thumbnails:
+             # Correct name
+             thumb_ext = ".thumbnail_%dx%d" % (self.thumbsize[0],
+                                               self.thumbsize[1])
+-            outfile_ext = infile.split(".")[0] + thumb_ext + ".png"
+-            outfile_base = os.path.basename(outfile_ext)
++            infile_base = os.path.basename(infile)
++            outfile_base = infile_base.split(".")[0] + thumb_ext + ".png"
+             outfile = os.path.join(self.directory, outfile_base)
+             # Only if they aren't cached already
+             if outfile_base not in self.thumbnails:
+diff --git a/vimiv/main.py b/vimiv/main.py
+index a0e38cf..39f7407 100644
+--- a/vimiv/main.py
++++ b/vimiv/main.py
+@@ -27,7 +27,7 @@ from vimiv.mark import Mark
+ from vimiv.information import Information
+ 
+ 
+-def main(running_tests=False):
++def main(arguments, running_tests=False):
+     """Starting point for vimiv.
+ 
+     Args:
+@@ -36,7 +36,7 @@ def main(running_tests=False):
+     parser = get_args()
+     parse_dirs()
+     settings = parse_config()
+-    settings = parse_args(parser, settings)
++    settings = parse_args(parser, settings, arguments)
+ 
+     args = settings["GENERAL"]["paths"]
+ 
+diff --git a/vimiv/parser.py b/vimiv/parser.py
+index 874a538..9d5afce 100644
+--- a/vimiv/parser.py
++++ b/vimiv/parser.py
+@@ -56,7 +56,7 @@ def get_args():
+     return parser
+ 
+ 
+-def parse_args(parser, settings, arguments=None):
++def parse_args(parser, settings, arguments):
+     """Parse the arguments and return the modified settings.
+ 
+     Args:
+@@ -66,10 +66,7 @@ def parse_args(parser, settings, arguments=None):
+ 
+     Return: Modified settings after parsing the arguments.
+     """
+-    if arguments:
+-        args = parser.parse_args(arguments)
+-    else:
+-        args = parser.parse_args()
++    args = parser.parse_args(arguments)
+     if args.show_version:
+         information = Information()
+         print(information.get_version())
+diff --git a/vimiv/vimiv b/vimiv/vimiv
+index 5497e08..57f34f1 100755
+--- a/vimiv/vimiv
++++ b/vimiv/vimiv
+@@ -5,4 +5,4 @@ import sys
+ import vimiv
+ 
+ if __name__ == '__main__':
+-    sys.exit(vimiv.main.main())
++    sys.exit(vimiv.main.main(sys.argv))