diff options
author | nfnty <git@nfnty.se> | 2017-02-10 07:13:21 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2017-02-10 07:13:21 +0100 |
commit | bd44cd7539fe018c1453dee8ff3de72f98515259 (patch) | |
tree | 75820bfa740c3a19132ebf9fe1a584ba2927a9fa /ranger | |
parent | d8b807c5a9ef74856b1ece387a21692118c34984 (diff) | |
download | ranger-bd44cd7539fe018c1453dee8ff3de72f98515259.tar.gz |
core.main: Improve version info
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/__init__.py | 3 | ||||
-rw-r--r-- | ranger/core/main.py | 27 |
2 files changed, 13 insertions, 17 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py index 0cb94a69..9072566d 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -10,7 +10,6 @@ program you want to use to open your files with. from __future__ import (absolute_import, division, print_function) -import sys import os # Information @@ -28,7 +27,7 @@ MACRO_DELIMITER = '%' MACRO_DELIMITER_ESC = '%%' DEFAULT_PAGER = 'less' USAGE = '%prog [options] [path]' -VERSION = 'ranger-master %s\n\nPython %s' % (__version__, sys.version) +VERSION = 'ranger-master {0}'.format(__version__) # These variables are ignored if the corresponding diff --git a/ranger/core/main.py b/ranger/core/main.py index 0189aa2b..32f4e111 100644 --- a/ranger/core/main.py +++ b/ranger/core/main.py @@ -10,7 +10,7 @@ import sys import tempfile from logging import getLogger -from ranger import __version__ +from ranger import VERSION LOG = getLogger(__name__) @@ -33,9 +33,14 @@ def main( ranger.arg = OpenStruct(args.__dict__) # COMPAT setup_logging(debug=args.debug, logfile=args.logfile) - LOG.info("Ranger version %s", __version__) - LOG.info('Running on Python ' + sys.version.replace('\n', '')) - LOG.info("Process ID is %s", os.getpid()) + info_msg = [ + 'ranger version: {0}'.format(VERSION), + 'Python version: {0}'.format(' '.join(line.strip() for line in sys.version.splitlines())), + 'Locale: {0}'.format('.'.join(str(s) for s in locale.getlocale())), + ] + for line in info_msg: + LOG.info(line) + LOG.info('Process ID: %s', os.getpid()) try: locale.setlocale(locale.LC_ALL, '') @@ -165,19 +170,11 @@ def main( except Exception: # pylint: disable=broad-except import traceback ex_traceback = traceback.format_exc() - - exit_msg += '''\ -ranger version: {0} -Python version: {1} -Locale: {2} -'''.format(ranger.__version__, sys.version.split()[0], - '.'.join(str(s) for s in locale.getlocale())) - + exit_msg += '\n'.join(info_msg) + '\n' try: - exit_msg += "Current file: '{0}'\n".format(fm.thisfile.path) + exit_msg += "Current file: {0}\n".format(repr(fm.thisfile.path)) except Exception: # pylint: disable=broad-except pass - exit_msg += ''' {0} ranger crashed. Please report this traceback at: @@ -220,7 +217,7 @@ def xdg_path(env_var): def parse_arguments(): """Parse the program arguments""" from optparse import OptionParser # pylint: disable=deprecated-module - from ranger import CONFDIR, CACHEDIR, DATADIR, USAGE, VERSION + from ranger import CONFDIR, CACHEDIR, DATADIR, USAGE parser = OptionParser(usage=USAGE, version=VERSION) |