You are not logged in.
I've done my editing and it's compiling - all but defaults/commands.py and the setingobject.py. Mainly - but not exclusively - I basically just changed the signal code not to look at __code__ and always 'pass' the signal, and then I made all the signals have dummy arguments. I don't know what the side-effects are so I don't know what bugs this'll make, but there certainly are some bugs in the compiled code.
-- The speeds, as expected, are almost identical. --
Additionally, the cython code is far harder to change and is buggy: aka, unless you're going to utilise cython's low level abilities, it's not useful for this. Oh - I've looked at vifm and it is fast, so yes - I get what you mean now. I want ranger that fast too... What's vifm written in?
Last edited by Veedrac (2011-11-01 23:48:52)
Offline
Would you mind sharing a patch and a little guide how to compile ranger with cython? Would be cool to see it with my own eyes if the speed changes in any way. Although I believe you, that the speed doesn't really increase.
Offline
I'll see what I can do - but a gzip of the folder would be easiest . I'll get that to you once - if - I bother to remove the other personalisations not related to cython support.
Also - my set-up script for cython compiles the module to the current directory, not the directory of the .py files and I end up having to move them. Automatically generating a list and making the files in their directory would be easier, but I've no clue how to make the set-up script. Any help here?
Offline
This should be a working DIFF:
Only in ranger-1.5.2-cy: c_setup.py
diff -r ranger-1.5.2/ranger/api/apps.py ranger-1.5.2-cy/ranger/api/apps.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/api/commands.py ranger-1.5.2-cy/ranger/api/commands.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/api/options.py ranger-1.5.2-cy/ranger/api/options.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/colorschemes/default88.py ranger-1.5.2-cy/ranger/colorschemes/default88.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/colorschemes/default.py ranger-1.5.2-cy/ranger/colorschemes/default.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/colorschemes/jungle.py ranger-1.5.2-cy/ranger/colorschemes/jungle.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/colorschemes/snow.py ranger-1.5.2-cy/ranger/colorschemes/snow.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/container/bookmarks.py ranger-1.5.2-cy/ranger/container/bookmarks.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/container/history.py ranger-1.5.2-cy/ranger/container/history.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/container/settingobject.py ranger-1.5.2-cy/ranger/container/settingobject.py
0a1
> # cython: language_level=3
33c34
< 'hidden_filter': lambda x: isinstance(x, str) or hasattr(x, 'match'),
---
> 'hidden_filter': (lambda x: isinstance(x, str) or hasattr(x, 'match')),
76d76
< assert self._check_type(name, value)
diff -r ranger-1.5.2/ranger/container/tags.py ranger-1.5.2-cy/ranger/container/tags.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/core/actions.py ranger-1.5.2-cy/ranger/core/actions.py
0a1
> # cython: language_level=3
71c72
< raise
---
> raise text
804c805
< def _update_current_tab(self):
---
> def _update_current_tab(self, dummy):
diff -r ranger-1.5.2/ranger/core/environment.py ranger-1.5.2-cy/ranger/core/environment.py
0a1
> # cython: language_level=3
194,202c195
> self.cwd.load_content_if_outdated()
diff -r ranger-1.5.2/ranger/core/fm.py ranger-1.5.2-cy/ranger/core/fm.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/core/helper.py ranger-1.5.2-cy/ranger/core/helper.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/core/loader.py ranger-1.5.2-cy/ranger/core/loader.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/core/main.py ranger-1.5.2-cy/ranger/core/main.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/core/runner.py ranger-1.5.2-cy/ranger/core/runner.py
0a1
> # cython: language_level=3
48,49c49,50
< waitfnc = raw_input
< except NameError:
---
> waitfnc = __builtins__["raw_input"]
> except KeyError:
51c52
< waitfnc = input
---
> waitfnc = __builtins__["input"]
diff -r ranger-1.5.2/ranger/core/shared.py ranger-1.5.2-cy/ranger/core/shared.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/data/ranger ranger-1.5.2-cy/ranger/data/ranger
36c36
< """ and None
---
> """
diff -r ranger-1.5.2/ranger/defaults/apps.py ranger-1.5.2-cy/ranger/defaults/apps.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/defaults/commands.py ranger-1.5.2-cy/ranger/defaults/commands.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/defaults/options.py ranger-1.5.2-cy/ranger/defaults/options.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/accumulator.py ranger-1.5.2-cy/ranger/ext/accumulator.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/curses_interrupt_handler.py ranger-1.5.2-cy/ranger/ext/curses_interrupt_handler.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/direction.py ranger-1.5.2-cy/ranger/ext/direction.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/get_executables.py ranger-1.5.2-cy/ranger/ext/get_executables.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/human_readable.py ranger-1.5.2-cy/ranger/ext/human_readable.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/iter_tools.py ranger-1.5.2-cy/ranger/ext/iter_tools.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/keybinding_parser.py ranger-1.5.2-cy/ranger/ext/keybinding_parser.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/lazy_property.py ranger-1.5.2-cy/ranger/ext/lazy_property.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/mount_path.py ranger-1.5.2-cy/ranger/ext/mount_path.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/openstruct.py ranger-1.5.2-cy/ranger/ext/openstruct.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/relative_symlink.py ranger-1.5.2-cy/ranger/ext/relative_symlink.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/shell_escape.py ranger-1.5.2-cy/ranger/ext/shell_escape.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/signals.py ranger-1.5.2-cy/ranger/ext/signals.py
0a1
> # cython: language_level=3
147d147
< assert hasattr(function, '__code__')
154d153
< nargs = function.__code__.co_argcount
157d155
< nargs -= 1
163c161
< handler = SignalHandler(signal_name, function, priority, nargs > 0)
---
> handler = SignalHandler(signal_name, function, priority, True)
diff -r ranger-1.5.2/ranger/ext/spawn.py ranger-1.5.2-cy/ranger/ext/spawn.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/ext/widestring.py ranger-1.5.2-cy/ranger/ext/widestring.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/fsobject/directory.py ranger-1.5.2-cy/ranger/fsobject/directory.py
0a1
> # cython: language_level=3
110c111
< def request_resort(self):
---
> def request_resort(self, dummy):
113c114
< def request_reload(self):
---
> def request_reload(self, dummy):
diff -r ranger-1.5.2/ranger/fsobject/file.py ranger-1.5.2-cy/ranger/fsobject/file.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/fsobject/fsobject.py ranger-1.5.2-cy/ranger/fsobject/fsobject.py
0a1
> # cython: language_level=3
109,111c110,115
< for attr in ('video', 'audio', 'image', 'media', 'document', 'container'):
< exec("%s = lazy_property("
< "lambda self: self.set_mimetype() or self.%s)" % (attr, attr))
---
> video = lazy_property(lambda self: self.set_mimetype() or self.video)
> audio = lazy_property(lambda self: self.set_mimetype() or self.audio)
> image = lazy_property(lambda self: self.set_mimetype() or self.image)
> media = lazy_property(lambda self: self.set_mimetype() or self.media)
> document = lazy_property(lambda self: self.set_mimetype() or self.document)
> container = lazy_property(lambda self: self.set_mimetype() or self.container)
diff -r ranger-1.5.2/ranger/gui/ansi.py ranger-1.5.2-cy/ranger/gui/ansi.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/bar.py ranger-1.5.2-cy/ranger/gui/bar.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/color.py ranger-1.5.2-cy/ranger/gui/color.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/colorscheme.py ranger-1.5.2-cy/ranger/gui/colorscheme.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/context.py ranger-1.5.2-cy/ranger/gui/context.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/curses_shortcuts.py ranger-1.5.2-cy/ranger/gui/curses_shortcuts.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/displayable.py ranger-1.5.2-cy/ranger/gui/displayable.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/mouse_event.py ranger-1.5.2-cy/ranger/gui/mouse_event.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/ui.py ranger-1.5.2-cy/ranger/gui/ui.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/widgets/browsercolumn.py ranger-1.5.2-cy/ranger/gui/widgets/browsercolumn.py
0a1
> # cython: language_level=3
53c54
< def request_redraw(self):
---
> def request_redraw(self, dummy):
diff -r ranger-1.5.2/ranger/gui/widgets/browserview.py ranger-1.5.2-cy/ranger/gui/widgets/browserview.py
0a1
> # cython: language_level=3
89c90
< def _request_clear_if_has_borders(self):
---
> def _request_clear_if_has_borders(self, dummy):
93c94
< def request_clear(self):
---
> def request_clear(self, dummy):
diff -r ranger-1.5.2/ranger/gui/widgets/console.py ranger-1.5.2-cy/ranger/gui/widgets/console.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/widgets/pager.py ranger-1.5.2-cy/ranger/gui/widgets/pager.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/widgets/statusbar.py ranger-1.5.2-cy/ranger/gui/widgets/statusbar.py
0a1
> # cython: language_level=3
34c35
< __doc__ = __doc__
---
> __doc__ = Widget.__doc__
53c54
< def request_redraw(self):
---
> def request_redraw(self, dummy):
diff -r ranger-1.5.2/ranger/gui/widgets/taskview.py ranger-1.5.2-cy/ranger/gui/widgets/taskview.py
0a1
> # cython: language_level=3
diff -r ranger-1.5.2/ranger/gui/widgets/titlebar.py ranger-1.5.2-cy/ranger/gui/widgets/titlebar.py
0a1
> # cython: language_level=3
40c41
< def request_redraw(self):
---
> def request_redraw(self, dummy):
diff -r ranger-1.5.2/ranger.py ranger-1.5.2-cy/ranger.py
36c36
< """ and None
---
> """
AND my oh-so inefficient c_setup.py (run with "python c_setup.py build_ext --inplace" after patching)
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [
Extension("apiapps", ["ranger/api/apps.py"]),
Extension("commands", ["ranger/api/commands.py"]),
Extension("apioptions", ["ranger/api/options.py"]),
Extension("default", ["ranger/colorschemes/default.py"]),
Extension("default88", ["ranger/colorschemes/default88.py"]),
Extension("jungle", ["ranger/colorschemes/jungle.py"]),
Extension("snow", ["ranger/colorschemes/snow.py"]),
Extension("bookmarks", ["ranger/container/bookmarks.py"]),
Extension("history", ["ranger/container/history.py"]),
Extension("tags", ["ranger/container/tags.py"]),
Extension("actions", ["ranger/core/actions.py"]),
Extension("environment", ["ranger/core/environment.py"]),
Extension("fm", ["ranger/core/fm.py"]),
Extension("helper", ["ranger/core/helper.py"]),
Extension("loader", ["ranger/core/loader.py"]),
Extension("main", ["ranger/core/main.py"]),
Extension("runner", ["ranger/core/runner.py"]),
Extension("shared", ["ranger/core/shared.py"]),
Extension("defaultapps", ["ranger/defaults/apps.py"]),
Extension("defaultoptions", ["ranger/defaults/options.py"]),
Extension("accumulator", ["ranger/ext/accumulator.py"]),
Extension("curses_interrupt_handler", ["ranger/ext/curses_interrupt_handler.py"]),
Extension("direction", ["ranger/ext/direction.py"]),
Extension("get_executables", ["ranger/ext/get_executables.py"]),
Extension("human_readable", ["ranger/ext/human_readable.py"]),
Extension("iter_tools", ["ranger/ext/iter_tools.py"]),
Extension("keybinding_parser",["ranger/ext/keybinding_parser.py"]),
Extension("lazy_property", ["ranger/ext/lazy_property.py"]),
Extension("mount_path", ["ranger/ext/mount_path.py"]),
Extension("openstruct", ["ranger/ext/openstruct.py"]),
Extension("relative_symlink", ["ranger/ext/relative_symlink.py"]),
Extension("shell_escape", ["ranger/ext/shell_escape.py"]),
Extension("signals", ["ranger/ext/signals.py"]),
Extension("spawn", ["ranger/ext/spawn.py"]),
Extension("widestring", ["ranger/ext/widestring.py"]),
Extension("directory", ["ranger/fsobject/directory.py"]),
Extension("file", ["ranger/fsobject/file.py"]),
Extension("fsobject", ["ranger/fsobject/fsobject.py"]),
Extension("browsercolumn", ["ranger/gui/widgets/browsercolumn.py"]),
Extension("browserview", ["ranger/gui/widgets/browserview.py"]),
Extension("console", ["ranger/gui/widgets/console.py"]),
Extension("pager", ["ranger/gui/widgets/pager.py"]),
Extension("statusbar", ["ranger/gui/widgets/statusbar.py"]),
Extension("taskview", ["ranger/gui/widgets/taskview.py"]),
Extension("titlebar", ["ranger/gui/widgets/titlebar.py"]),
Extension("ansi", ["ranger/gui/ansi.py"]),
Extension("bar", ["ranger/gui/bar.py"]),
Extension("color", ["ranger/gui/color.py"]),
Extension("colorscheme", ["ranger/gui/colorscheme.py"]),
Extension("context", ["ranger/gui/context.py"]),
Extension("curses_shortcuts", ["ranger/gui/curses_shortcuts.py"]),
Extension("displayable", ["ranger/gui/displayable.py"]),
Extension("mouse_event", ["ranger/gui/mouse_event.py"]),
Extension("ui", ["ranger/gui/ui.py"]),
]
setup(
name = 'Ranger',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)
No promises. Remember to move the generated files to their proper directories.
Offline
I don't know how I can use this patch, I get
% patch -i ../patch
patch: **** Only garbage was found in the patch input.
?
Offline
Hmm... I did highlight should. That's what I get for not testing. Give me a mo', I'll have it fixed.
Offline
Try this. Again no promises.
Only in ranger-1.5.2-cy: c_setup.py
diff -ur ranger-1.5.2/ranger/api/apps.py ranger-1.5.2-cy/ranger/api/apps.py
--- ranger-1.5.2/ranger/api/apps.py 2011-11-04 21:27:50.249432115 +0000
+++ ranger-1.5.2-cy/ranger/api/apps.py 2011-11-01 23:08:09.064902635 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/api/commands.py ranger-1.5.2-cy/ranger/api/commands.py
--- ranger-1.5.2/ranger/api/commands.py 2011-11-04 21:27:56.246066297 +0000
+++ ranger-1.5.2-cy/ranger/api/commands.py 2011-11-01 21:47:58.570963319 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/api/options.py ranger-1.5.2-cy/ranger/api/options.py
--- ranger-1.5.2/ranger/api/options.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/api/options.py 2011-11-01 21:48:00.864284227 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
Only in ranger-1.5.2-cy/ranger/api: __pycache__
diff -ur ranger-1.5.2/ranger/colorschemes/default88.py ranger-1.5.2-cy/ranger/colorschemes/default88.py
--- ranger-1.5.2/ranger/colorschemes/default88.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/colorschemes/default88.py 2011-11-01 21:48:50.614014709 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/colorschemes/default.py ranger-1.5.2-cy/ranger/colorschemes/default.py
--- ranger-1.5.2/ranger/colorschemes/default.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/colorschemes/default.py 2011-11-01 21:48:45.430709458 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/colorschemes/jungle.py ranger-1.5.2-cy/ranger/colorschemes/jungle.py
--- ranger-1.5.2/ranger/colorschemes/jungle.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/colorschemes/jungle.py 2011-11-01 21:48:52.527337678 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/colorschemes/snow.py ranger-1.5.2-cy/ranger/colorschemes/snow.py
--- ranger-1.5.2/ranger/colorschemes/snow.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/colorschemes/snow.py 2011-11-01 21:48:54.163995478 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/container/bookmarks.py ranger-1.5.2-cy/ranger/container/bookmarks.py
--- ranger-1.5.2/ranger/container/bookmarks.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/container/bookmarks.py 2011-11-01 21:49:00.447294770 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/container/history.py ranger-1.5.2-cy/ranger/container/history.py
--- ranger-1.5.2/ranger/container/history.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/container/history.py 2011-11-01 21:49:02.050619420 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
Only in ranger-1.5.2-cy/ranger/container: __pycache__
diff -ur ranger-1.5.2/ranger/container/settingobject.py ranger-1.5.2-cy/ranger/container/settingobject.py
--- ranger-1.5.2/ranger/container/settingobject.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/container/settingobject.py 2011-11-01 23:40:05.587853273 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -30,7 +31,7 @@
'draw_bookmark_borders': bool,
'draw_borders': bool,
'flushinput': bool,
- 'hidden_filter': lambda x: isinstance(x, str) or hasattr(x, 'match'),
+ 'hidden_filter': (lambda x: isinstance(x, str) or hasattr(x, 'match')),
'load_default_rc': (bool, type(None)),
'max_console_history_size': (int, type(None)),
'max_history_size': (int, type(None)),
@@ -73,7 +74,6 @@
assert name in ALLOWED_SETTINGS, "No such setting: {0}!".format(name)
if name not in self._settings:
getattr(self, name)
- assert self._check_type(name, value)
kws = dict(setting=name, value=value,
previous=self._settings[name], fm=self.fm)
self.signal_emit('setopt', **kws)
diff -ur ranger-1.5.2/ranger/container/tags.py ranger-1.5.2-cy/ranger/container/tags.py
--- ranger-1.5.2/ranger/container/tags.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/container/tags.py 2011-11-01 21:49:04.943937078 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/core/actions.py ranger-1.5.2-cy/ranger/core/actions.py
--- ranger-1.5.2/ranger/core/actions.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/actions.py 2011-11-01 22:48:25.651313736 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -68,7 +69,7 @@
def notify(self, text, duration=4, bad=False):
if isinstance(text, Exception):
if ranger.arg.debug:
- raise
+ raise text
bad = True
text = str(text)
self.log.appendleft(text)
@@ -801,7 +802,7 @@
assert len(self.tabs) > 0, "There must be >=1 tabs at all times"
return sorted(self.tabs)
- def _update_current_tab(self):
+ def _update_current_tab(self, dummy):
self.tabs[self.current_tab] = self.env.cwd.path
# --------------------------
diff -ur ranger-1.5.2/ranger/core/environment.py ranger-1.5.2-cy/ranger/core/environment.py
--- ranger-1.5.2/ranger/core/environment.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/environment.py 2011-11-02 22:22:35.500869811 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/core/fm.py ranger-1.5.2-cy/ranger/core/fm.py
--- ranger-1.5.2/ranger/core/fm.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/fm.py 2011-11-01 21:49:32.303788857 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/core/helper.py ranger-1.5.2-cy/ranger/core/helper.py
--- ranger-1.5.2/ranger/core/helper.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/helper.py 2011-11-01 21:49:34.073779267 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/core/loader.py ranger-1.5.2-cy/ranger/core/loader.py
--- ranger-1.5.2/ranger/core/loader.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/loader.py 2011-11-01 21:49:35.690437177 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/core/main.py ranger-1.5.2-cy/ranger/core/main.py
--- ranger-1.5.2/ranger/core/main.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/main.py 2011-11-01 21:49:37.633759981 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
Only in ranger-1.5.2-cy/ranger/core: __pycache__
diff -ur ranger-1.5.2/ranger/core/runner.py ranger-1.5.2-cy/ranger/core/runner.py
--- ranger-1.5.2/ranger/core/runner.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/runner.py 2011-11-01 22:16:15.838435097 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -45,10 +46,10 @@
"""Wait for an ENTER-press"""
sys.stdout.write("Press ENTER to continue")
try:
- waitfnc = raw_input
- except NameError:
+ waitfnc = __builtins__["raw_input"]
+ except KeyError:
# "raw_input" not available in python3
- waitfnc = input
+ waitfnc = __builtins__["input"]
waitfnc()
diff -ur ranger-1.5.2/ranger/core/shared.py ranger-1.5.2-cy/ranger/core/shared.py
--- ranger-1.5.2/ranger/core/shared.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/core/shared.py 2011-11-01 21:49:41.130407706 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/data/ranger ranger-1.5.2-cy/ranger/data/ranger
--- ranger-1.5.2/ranger/data/ranger 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/data/ranger 2011-11-01 21:47:15.687862303 +0000
@@ -33,7 +33,7 @@
rm -f -- "$tempfile"
fi
return $returnvalue
-""" and None
+"""
import sys
from os.path import exists, abspath
Only in ranger-1.5.2-cy/ranger/data: rc.conf
diff -ur ranger-1.5.2/ranger/defaults/apps.py ranger-1.5.2-cy/ranger/defaults/apps.py
--- ranger-1.5.2/ranger/defaults/apps.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/defaults/apps.py 2011-11-01 21:49:52.670345188 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
# This configuration file is licensed under the same terms as ranger.
diff -ur ranger-1.5.2/ranger/defaults/commands.py ranger-1.5.2-cy/ranger/defaults/commands.py
--- ranger-1.5.2/ranger/defaults/commands.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/defaults/commands.py 2011-11-01 21:49:56.473657919 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
# This configuration file is licensed under the same terms as ranger.
diff -ur ranger-1.5.2/ranger/defaults/options.py ranger-1.5.2-cy/ranger/defaults/options.py
--- ranger-1.5.2/ranger/defaults/options.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/defaults/options.py 2011-11-02 22:24:08.297033757 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# -*- coding: utf-8 -*-
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
# This configuration file is licensed under the same terms as ranger.
@@ -138,7 +139,6 @@
#
# return fg, bg, attr
-
# ===================================================================
# Beware: from here on, you are on your own. This part requires python
# knowledge.
Only in ranger-1.5.2-cy/ranger/defaults: __pycache__
diff -ur ranger-1.5.2/ranger/ext/accumulator.py ranger-1.5.2-cy/ranger/ext/accumulator.py
--- ranger-1.5.2/ranger/ext/accumulator.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/accumulator.py 2011-11-01 21:50:03.340287385 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/curses_interrupt_handler.py ranger-1.5.2-cy/ranger/ext/curses_interrupt_handler.py
--- ranger-1.5.2/ranger/ext/curses_interrupt_handler.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/curses_interrupt_handler.py 2011-11-01 21:50:05.050278121 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/direction.py ranger-1.5.2-cy/ranger/ext/direction.py
--- ranger-1.5.2/ranger/ext/direction.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/direction.py 2011-11-01 21:50:06.640269507 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/get_executables.py ranger-1.5.2-cy/ranger/ext/get_executables.py
--- ranger-1.5.2/ranger/ext/get_executables.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/get_executables.py 2011-11-01 21:50:08.136928066 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/human_readable.py ranger-1.5.2-cy/ranger/ext/human_readable.py
--- ranger-1.5.2/ranger/ext/human_readable.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/human_readable.py 2011-11-01 21:50:09.526920535 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/iter_tools.py ranger-1.5.2-cy/ranger/ext/iter_tools.py
--- ranger-1.5.2/ranger/ext/iter_tools.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/iter_tools.py 2011-11-01 21:50:12.696903362 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/keybinding_parser.py ranger-1.5.2-cy/ranger/ext/keybinding_parser.py
--- ranger-1.5.2/ranger/ext/keybinding_parser.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/keybinding_parser.py 2011-11-01 21:50:15.543554608 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/lazy_property.py ranger-1.5.2-cy/ranger/ext/lazy_property.py
--- ranger-1.5.2/ranger/ext/lazy_property.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/lazy_property.py 2011-11-01 21:50:17.123546048 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# From http://blog.pythonisito.com/2008/08/lazy-descriptors.html
class lazy_property(object):
diff -ur ranger-1.5.2/ranger/ext/mount_path.py ranger-1.5.2-cy/ranger/ext/mount_path.py
--- ranger-1.5.2/ranger/ext/mount_path.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/mount_path.py 2011-11-01 21:50:18.406872429 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/openstruct.py ranger-1.5.2-cy/ranger/ext/openstruct.py
--- ranger-1.5.2/ranger/ext/openstruct.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/openstruct.py 2011-11-01 21:50:33.446790951 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
Only in ranger-1.5.2-cy/ranger/ext: __pycache__
diff -ur ranger-1.5.2/ranger/ext/relative_symlink.py ranger-1.5.2-cy/ranger/ext/relative_symlink.py
--- ranger-1.5.2/ranger/ext/relative_symlink.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/relative_symlink.py 2011-11-01 21:50:34.870116572 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/shell_escape.py ranger-1.5.2-cy/ranger/ext/shell_escape.py
--- ranger-1.5.2/ranger/ext/shell_escape.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/shell_escape.py 2011-11-01 21:50:38.676762617 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/signals.py ranger-1.5.2-cy/ranger/ext/signals.py
--- ranger-1.5.2/ranger/ext/signals.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/signals.py 2011-11-01 23:22:01.313727289 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -144,23 +145,20 @@
"""
assert isinstance(signal_name, str)
assert hasattr(function, '__call__')
- assert hasattr(function, '__code__')
assert isinstance(priority, (int, float))
assert isinstance(weak, bool)
try:
handlers = self._signals[signal_name]
except:
handlers = self._signals[signal_name] = []
- nargs = function.__code__.co_argcount
if getattr(function, '__self__', None):
- nargs -= 1
if weak:
function = (function.__func__, weakref.proxy(function.__self__))
elif weak:
function = weakref.proxy(function)
- handler = SignalHandler(signal_name, function, priority, nargs > 0)
+ handler = SignalHandler(signal_name, function, priority, True)
handlers.append(handler)
handlers.sort(key=lambda handler: -handler._priority)
return handler
diff -ur ranger-1.5.2/ranger/ext/spawn.py ranger-1.5.2-cy/ranger/ext/spawn.py
--- ranger-1.5.2/ranger/ext/spawn.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/spawn.py 2011-11-01 21:50:42.946739484 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/ext/widestring.py ranger-1.5.2-cy/ranger/ext/widestring.py
--- ranger-1.5.2/ranger/ext/widestring.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/ext/widestring.py 2011-11-01 21:50:46.816718520 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# -*- encoding: utf8 -*-
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
diff -ur ranger-1.5.2/ranger/fsobject/directory.py ranger-1.5.2-cy/ranger/fsobject/directory.py
--- ranger-1.5.2/ranger/fsobject/directory.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/fsobject/directory.py 2011-11-01 22:47:11.335049677 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -107,10 +108,10 @@
self.request_reload, weak=True)
self.use()
- def request_resort(self):
+ def request_resort(self, dummy):
self.order_outdated = True
- def request_reload(self):
+ def request_reload(self, dummy):
self.content_outdated = True
def get_list(self):
diff -ur ranger-1.5.2/ranger/fsobject/file.py ranger-1.5.2-cy/ranger/fsobject/file.py
--- ranger-1.5.2/ranger/fsobject/file.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/fsobject/file.py 2011-11-01 21:51:29.399821160 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/fsobject/fsobject.py ranger-1.5.2-cy/ranger/fsobject/fsobject.py
--- ranger-1.5.2/ranger/fsobject/fsobject.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/fsobject/fsobject.py 2011-11-01 23:17:11.931961671 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -106,9 +107,12 @@
return [c if i % 3 == 1 else (int(c) if c else 0) for i, c in \
enumerate(_extract_number_re.split(self.basename_lower))]
- for attr in ('video', 'audio', 'image', 'media', 'document', 'container'):
- exec("%s = lazy_property("
- "lambda self: self.set_mimetype() or self.%s)" % (attr, attr))
+ video = lazy_property(lambda self: self.set_mimetype() or self.video)
+ audio = lazy_property(lambda self: self.set_mimetype() or self.audio)
+ image = lazy_property(lambda self: self.set_mimetype() or self.image)
+ media = lazy_property(lambda self: self.set_mimetype() or self.media)
+ document = lazy_property(lambda self: self.set_mimetype() or self.document)
+ container = lazy_property(lambda self: self.set_mimetype() or self.container)
def __str__(self):
"""returns a string containing the absolute path"""
Only in ranger-1.5.2-cy/ranger/fsobject: __pycache__
diff -ur ranger-1.5.2/ranger/gui/ansi.py ranger-1.5.2-cy/ranger/gui/ansi.py
--- ranger-1.5.2/ranger/gui/ansi.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/ansi.py 2011-11-01 21:51:34.703125763 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2010 David Barnett <davidbarnett2@gmail.com>
# Copyright (C) 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
diff -ur ranger-1.5.2/ranger/gui/bar.py ranger-1.5.2-cy/ranger/gui/bar.py
--- ranger-1.5.2/ranger/gui/bar.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/bar.py 2011-11-01 21:51:36.006452035 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/color.py ranger-1.5.2-cy/ranger/gui/color.py
--- ranger-1.5.2/ranger/gui/color.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/color.py 2011-11-01 21:51:37.423111027 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/colorscheme.py ranger-1.5.2-cy/ranger/gui/colorscheme.py
--- ranger-1.5.2/ranger/gui/colorscheme.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/colorscheme.py 2011-11-01 21:51:38.689770832 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/context.py ranger-1.5.2-cy/ranger/gui/context.py
--- ranger-1.5.2/ranger/gui/context.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/context.py 2011-11-01 21:51:40.059763411 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/curses_shortcuts.py ranger-1.5.2-cy/ranger/gui/curses_shortcuts.py
--- ranger-1.5.2/ranger/gui/curses_shortcuts.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/curses_shortcuts.py 2011-11-01 21:51:41.263090224 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
# Copyright (C) 2010 David Barnett <davidbarnett2@gmail.com>
#
diff -ur ranger-1.5.2/ranger/gui/displayable.py ranger-1.5.2-cy/ranger/gui/displayable.py
--- ranger-1.5.2/ranger/gui/displayable.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/displayable.py 2011-11-01 21:52:01.592980088 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/mouse_event.py ranger-1.5.2-cy/ranger/gui/mouse_event.py
--- ranger-1.5.2/ranger/gui/mouse_event.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/mouse_event.py 2011-11-01 21:52:03.439636750 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
Only in ranger-1.5.2-cy/ranger/gui: __pycache__
diff -ur ranger-1.5.2/ranger/gui/ui.py ranger-1.5.2-cy/ranger/gui/ui.py
--- ranger-1.5.2/ranger/gui/ui.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/ui.py 2011-11-01 21:52:04.899628840 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/widgets/browsercolumn.py ranger-1.5.2-cy/ranger/gui/widgets/browsercolumn.py
--- ranger-1.5.2/ranger/gui/widgets/browsercolumn.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/widgets/browsercolumn.py 2011-11-02 22:21:46.344469447 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# -*- encoding: utf8 -*-
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
@@ -50,7 +51,7 @@
self.settings.signal_bind('setopt.display_size_in_main_column',
self.request_redraw, weak=True)
- def request_redraw(self):
+ def request_redraw(self, dummy):
self.need_redraw = True
def resize(self, y, x, hei, wid):
diff -ur ranger-1.5.2/ranger/gui/widgets/browserview.py ranger-1.5.2-cy/ranger/gui/widgets/browserview.py
--- ranger-1.5.2/ranger/gui/widgets/browserview.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/widgets/browserview.py 2011-11-01 22:49:47.564203311 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -86,11 +87,11 @@
self.resize(self.y, self.x, self.hei, self.wid)
- def _request_clear_if_has_borders(self):
+ def _request_clear_if_has_borders(self, dummy):
if self.settings.draw_borders:
self.request_clear()
- def request_clear(self):
+ def request_clear(self, dummy):
self.need_clear = True
def draw(self):
diff -ur ranger-1.5.2/ranger/gui/widgets/console.py ranger-1.5.2-cy/ranger/gui/widgets/console.py
--- ranger-1.5.2/ranger/gui/widgets/console.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/widgets/console.py 2011-11-01 21:52:15.719570225 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/widgets/pager.py ranger-1.5.2-cy/ranger/gui/widgets/pager.py
--- ranger-1.5.2/ranger/gui/widgets/pager.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/widgets/pager.py 2011-11-01 21:52:16.866230680 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
# Copyright (C) 2010 David Barnett <davidbarnett2@gmail.com>
#
diff -ur ranger-1.5.2/ranger/gui/widgets/statusbar.py ranger-1.5.2-cy/ranger/gui/widgets/statusbar.py
--- ranger-1.5.2/ranger/gui/widgets/statusbar.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/widgets/statusbar.py 2011-11-01 23:18:37.138166737 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -31,7 +32,7 @@
from ranger.gui.bar import Bar
class StatusBar(Widget):
- __doc__ = __doc__
+ __doc__ = Widget.__doc__
owners = {}
groups = {}
timeformat = '%Y-%m-%d %H:%M'
@@ -50,7 +51,7 @@
self.settings.signal_bind('setopt.display_size_in_status_bar',
self.request_redraw, weak=True)
- def request_redraw(self):
+ def request_redraw(self, dummy):
self.need_redraw = True
def notify(self, text, duration=0, bad=False):
diff -ur ranger-1.5.2/ranger/gui/widgets/taskview.py ranger-1.5.2-cy/ranger/gui/widgets/taskview.py
--- ranger-1.5.2/ranger/gui/widgets/taskview.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/widgets/taskview.py 2011-11-01 21:52:21.232873690 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
diff -ur ranger-1.5.2/ranger/gui/widgets/titlebar.py ranger-1.5.2-cy/ranger/gui/widgets/titlebar.py
--- ranger-1.5.2/ranger/gui/widgets/titlebar.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger/gui/widgets/titlebar.py 2011-11-01 22:50:15.767383853 +0000
@@ -1,3 +1,4 @@
+# cython: language_level=3
# Copyright (C) 2009, 2010, 2011 Roman Zimbelmann <romanz@lavabit.com>
#
# This program is free software: you can redistribute it and/or modify
@@ -37,7 +38,7 @@
Widget.__init__(self, *args, **keywords)
self.fm.signal_bind('tab.change', self.request_redraw, weak=True)
- def request_redraw(self):
+ def request_redraw(self, dummy):
self.need_redraw = True
def draw(self):
Only in ranger-1.5.2-cy/ranger: __pycache__
diff -ur ranger-1.5.2/ranger.py ranger-1.5.2-cy/ranger.py
--- ranger-1.5.2/ranger.py 2011-10-24 00:51:28.000000000 +0100
+++ ranger-1.5.2-cy/ranger.py 2011-11-01 21:47:15.687862303 +0000
@@ -33,7 +33,7 @@
rm -f -- "$tempfile"
fi
return $returnvalue
-""" and None
+"""
import sys
from os.path import exists, abspath
Offline
Ok, that one looks much better! Thanks!
One thing seems to keep me away from testing it:
% python c_setup.py build_ext --inplace
Traceback (most recent call last):
File "c_setup.py", line 3, in <module>
from Cython.Distutils import build_ext
ImportError: No module named Cython.Distutils
cython from the repo is installed, where do I get this module from?
Offline
Try just loading python and doing "import Cython", and then try with python2. The repo's should work for both. Also make sure you aren't running python with the -S flag here. That's all I can think of.
Offline
Ok, now it worked. Now I only can't find a binary file named ranger to execute ranger. How do I get that file?
Offline
Hi!
Ranger is great, and while looking at scope.sh (line 28), I saw that it uses the following code to find the extension of a file:
extension=$(echo "$path" | grep '\.' | grep -o '[^.]\+$')
Why not just use the following ?
extension="${path##*.}"
I know there isn't a big difference, but you don't need to stare at the screen for 3 minutes to understand what it does...
Have a nice day !
Offline
Ok, now it worked. Now I only can't find a binary file named ranger to execute ranger. How do I get that file?
Maybe you're misunderstanding Cython. Cython compiles extension module for python files to use - this means that the first file you use to load it all will still have to be a python one. Just go to ranger.py in the root of your directory and run that.
NOTE: I Forgot to say: apiapps.so and apioptions.so and defaultapps.so and defaultoptions.so are only named like that to avoid name clashes. However, this breaks them. Just delete them. If you want them compiled as well, ask me later.
It may be uncertain if it's using the Cython files. The fastest way to tell is to cd to the directory, run python and then:
import ranger.colorschemes.default
print(ranger.colorschemes.default)
It should say if it uses the .so
Offline
You are right, I don't really understand how cython works, but now I know a little thanks to your describtion, thanks for that!
edit: Now I wanted to try compiling again, I had to, because I accidently deleted the whole thing. Now I get this.
[...]
gcc -pthread -shared -Wl,--hash-style=gnu -Wl,--as-needed build/temp.linux-i686-2.7/ranger/container/tags.o -L/usr/lib -lpython2.7 -o /home/army/Programme/AUR/ranger-git/src/ranger-cython/tags.so
cythoning ranger/core/actions.py to ranger/core/actions.c
Error compiling Cython file:
------------------------------------------------------------
...
cwd.load_content()
def notify(self, text, duration=4, bad=False):
if isinstance(text, Exception):
if ranger.arg.debug:
raise
^
------------------------------------------------------------
ranger/core/actions.py:103:4: Reraise not inside except clause
building 'actions' extension
creating build/temp.linux-i686-2.7/ranger/core
gcc -pthread -fno-strict-aliasing -march=i686 -mtune=generic -O2 -pipe -DNDEBUG -march=i686 -mtune=generic -O2 -pipe -fPIC -I/usr/include/python2.7 -c ranger/core/actions.c -o build/temp.linux-i686-2.7/ranger/core/actions.o
ranger/core/actions.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
error: command 'gcc' failed with exit status 1
Damn!
Last edited by Army (2011-11-05 22:44:34)
Offline
That doesn't look like it has the patch on. Did you forget to apply it this time?
Offline
Hello,
I've been searching the thread to make sure that this question has not been asked, but it's so basic I'm sure I've overlooked something. Anyway, here it goes: would it be very difficult to have the d flag trap the SIGHUP that ranger sends when exiting? That's what would be needed for proper detach and, at least for me, it would improve the usefulness of this (already very nice) tool a lot.
Again, sorry if this has been covered, and thanks.
Manolo
Offline
could you add epdfview to the list of known pdf viewers please:
--- /usr/lib/python3.2/site-packages/ranger/defaults/apps.py 2011-10-24 05:51:28.000000000 +0600
+++ /tmp/apps.py 2011-11-13 13:35:19.000000000 +0600
@@ -97,7 +97,7 @@
if f.extension is not None:
if f.extension in ('pdf', ):
- return self.either(c, 'evince', 'zathura', 'apvlv')
+ return self.either(c, 'evince', 'zathura', 'apvlv', 'epdfview')
if f.extension == 'djvu':
return self.either(c, 'evince')
if f.extension in ('xml', ):
is there a way to change it in ~/.config/ranger/apps.py without overriding 'app_default' method? My apps.py:
from ranger.defaults.apps import CustomApplications as DefaultApps
class CustomApplications(DefaultApps):
def app_default(self, c):
f = c.file
if f.extension is not None and f.extension == 'pdf':
return self.either(c, 'epdfview')
return super(self.__class__, self).app_default(c) # call parent method
Offline
sorry I don't have much time on my hands atm.
Hi!
Ranger is great, and while looking at scope.sh (line 28), I saw that it uses the following code to find the extension of a file:extension=$(echo "$path" | grep '\.' | grep -o '[^.]\+$')
Why not just use the following ?
extension="${path##*.}"
I know there isn't a big difference, but you don't need to stare at the screen for 3 minutes to understand what it does...
Have a nice day !
Good idea, I changed it.
is there a way to change it in ~/.config/ranger/apps.py without overriding 'app_default' method? My apps.py:
from ranger.defaults.apps import CustomApplications as DefaultApps class CustomApplications(DefaultApps): def app_default(self, c): f = c.file if f.extension is not None and f.extension == 'pdf': return self.either(c, 'epdfview') return super(self.__class__, self).app_default(c) # call parent method
That is the recommended method to do it. It might be a little inconvenient the first time but it gives you many powers for fine tuning.
"hut_" or "h00th00t" in irc.freenode.net #archlinux
Ranger Mailing List: https://lists.nongnu.org/mailman/listinfo/ranger-users
Offline
Hi hut, could you turn the 'X' dep check into a function, so we can, for example, do something like this:
@depends_on('mplayer')
def app_mplayer(self, c):
cmd = ['mplayer', '-fixed-vo', '-use-filename-title','-xy','1280','-zoom']
if not X():
c.flags+='D'
cmd+=['-vo','fbdev']
if c.mode is 1:
cmd+=['-fs']
elif c.mode is 2:
cmd+=['-loop', '0']
return cmd, c
Offline
Take a look at this example
if f.extension in ('pdf', ):
if 'DISPLAY' in os.environ:
c.flags += 'sd'
if c.mode == 1:
return tup('setsid', 'pdfpres', *c)
else:
return tup('setsid', 'mupdf', *c)
else:
return tup('fbpdf', *c)
Offline
Well, that's sorta like what i already use, i just thought the function method would be cleaner.
Offline
Ah ok, sorry
Offline
Well, that's sorta like what i already use, i just thought the function method would be cleaner.
def X():
return "DISPLAY" in os.environ
Offline
gwash wrote:Well, that's sorta like what i already use, i just thought the function method would be cleaner.
def X(): return "DISPLAY" in os.environ
Yes, that's exactly what i'm using, what i'm proposing is that it comes with ranger, that's all.
It's sorta related to this: https://github.com/hut/ranger/pull/21
Offline
Yes, that's exactly what i'm using, what i'm proposing is that it comes with ranger, that's all.
It's sorta related to this: https://github.com/hut/ranger/pull/21
I see now. Those and yours seem like they'd be pretty useful in combination, also.
Offline
Probably an ignorant question, but… how do I get ranger to simply execute a binary? Currently all I get is the following printed on the terminal:
No applications found for mimetype: application/x-executable
Offline