From d8084b41f67b1b8470251633529cacf2ba07fb6a Mon Sep 17 00:00:00 2001 From: hut Date: Mon, 4 Apr 2011 21:52:41 +0200 Subject: improved ranger.py --- ranger.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ranger.py b/ranger.py index 240b3687..16c6b1b5 100755 --- a/ranger.py +++ b/ranger.py @@ -34,9 +34,10 @@ return 1 """ import sys +import os.path -# When using the --clean option, not even bytecode should be written. -# Thus, we need to find out if --clean is used as soon as possible. +# Need to find out whether or not the flag --clean was used ASAP, +# because --clean is supposed to disable bytecode compilation try: argv = sys.argv[0:sys.argv.index('--')] except: @@ -46,6 +47,13 @@ sys.dont_write_bytecode = '-c' in argv or '--clean' in argv # Set the actual docstring __doc__ = """Ranger - file browser for the unix terminal""" +# Don't import ./ranger when running an installed binary at /usr/bin/ranger +if os.path.isdir('ranger'): + try: + sys.path.remove(os.path.abspath('.')) + except ValueError: + pass + # Start ranger import ranger sys.exit(ranger.main()) -- cgit 1.4.1-2-gfad0