diff options
author | hut <hut@lavabit.com> | 2010-06-18 16:23:31 +0200 |
---|---|---|
committer | hut <hut@lavabit.com> | 2010-06-18 16:23:31 +0200 |
commit | ac226d23ba8b60f7f47805819761f18b1a0a43ad (patch) | |
tree | e44ab85aeb4e6907da9e2f3951b813567a31099a /ranger | |
parent | b289f6796ef213a83595db77c06b7586cdbcb730 (diff) | |
download | ranger-ac226d23ba8b60f7f47805819761f18b1a0a43ad.tar.gz |
Don't write bytecode with --clean switch
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/__main__.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/ranger/__main__.py b/ranger/__main__.py index a3e0ef1c..ac6b2362 100644 --- a/ranger/__main__.py +++ b/ranger/__main__.py @@ -21,6 +21,7 @@ # (ImportError will imply that this module can't be found) # convenient exception handling in ranger.py (ImportError) +import locale import os import sys @@ -152,7 +153,18 @@ def main(): print(errormessage) print('ranger requires the python curses module. Aborting.') sys.exit(1) - import locale + + try: locale.setlocale(locale.LC_ALL, '') + except: print("Warning: Unable to set locale. Expect encoding problems.") + + if not 'SHELL' in os.environ: + 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 @@ -163,17 +175,9 @@ def main(): from ranger.shared import (EnvironmentAware, FileManagerAware, SettingsAware) - try: locale.setlocale(locale.LC_ALL, '') - except: print("Warning: Unable to set locale. Expect encoding problems.") - - if not 'SHELL' in os.environ: - os.environ['SHELL'] = 'bash' - - arg = parse_arguments() - ranger.arg = arg - - if not ranger.arg.debug: + if not arg.debug: curses_interrupt_handler.install_interrupt_handler() + ranger.arg = arg SettingsAware._setup() |