summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-09-29 19:08:53 +0200
committerhut <hut@lavabit.com>2010-09-29 19:08:53 +0200
commit08f08fb922672f7e24d6af8e4324169362e158b8 (patch)
tree33192c5defc82ed9c3d8963b606bd5b64643f924
parentb4f09c1a287c23e9474747e5b46bc347b294026a (diff)
downloadranger-08f08fb922672f7e24d6af8e4324169362e158b8.tar.gz
Don't write any bytecode with --clean option
-rwxr-xr-xranger.py10
-rw-r--r--ranger/__main__.py3
2 files changed, 10 insertions, 3 deletions
diff --git a/ranger.py b/ranger.py
index c2e067a2..3d0f4525 100755
--- a/ranger.py
+++ b/ranger.py
@@ -33,6 +33,16 @@ fi
 return 1
 """
 
+import sys
+
+# When using the --clean option, not even bytecode should be written.
+# Need to find out if --clean is used as soon as possible.
+try:
+	argv = sys.argv[0:sys.argv.index('--')]
+except:
+	argv = sys.argv
+sys.dont_write_bytecode = '-c' in argv or '--clean' in argv
+
 # Set the actual docstring
 __doc__ = """Ranger - file browser for the unix terminal"""
 
diff --git a/ranger/__main__.py b/ranger/__main__.py
index 4cdf1488..2efec4df 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -167,10 +167,7 @@ def main():
 		os.environ['SHELL'] = 'bash'
 
 	arg = parse_arguments()
-	if arg.clean:
-		sys.dont_write_bytecode = True
 
-	# Need to decide whether to write bytecode or not before importing.
 	import ranger
 	from ranger.ext import curses_interrupt_handler
 	from ranger.core.runner import Runner