diff options
Diffstat (limited to 'ranger/__init__.py')
-rw-r--r-- | ranger/__init__.py | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/ranger/__init__.py b/ranger/__init__.py index f6913bb5..8bd978d7 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -18,12 +18,6 @@ import os import sys -LOGFILE = '/tmp/errorlog' - -__copyright__ = """ -Copyright (C) 2009, 2010 Roman Zimbelmann <romanz@lavabit.com> -""" - __license__ = 'GPL3' __version__ = '1.0.3' __credits__ = 'Roman Zimbelmann' @@ -31,34 +25,41 @@ __author__ = 'Roman Zimbelmann' __maintainer__ = 'Roman Zimbelmann' __email__ = 'romanz@lavabit.com' -debug = False - -CONFDIR = os.path.expanduser(os.path.join('~', '.config', 'ranger')) -RANGERDIR = os.path.dirname(__file__) - -sys.path.append(CONFDIR) +__copyright__ = """ +Copyright (C) 2009, 2010 Roman Zimbelmann <romanz@lavabit.com> +""" USAGE = '%prog [options] [path/filename]' +DEFAULT_CONFDIR = '~/.ranger' +RANGERDIR = os.path.dirname(__file__) +LOGFILE = '/tmp/errorlog' #for python3-only versions, this could be replaced with: -# #def log(*objects, start='ranger:', sep=' ', end='\n'): # print(start, *objects, end=end, sep=sep, file=open(LOGFILE, 'a')) def log(*objects, **keywords): - """Writes objects to a logfile. - Has the same arguments as print() in python3""" + """ + Writes objects to a logfile (for the purpose of debugging only.) + Has the same arguments as print() in python3. + """ + if LOGFILE is None or arg.clean: + return start = 'start' in keywords and keywords['start'] or 'ranger:' sep = 'sep' in keywords and keywords['sep'] or ' ' _file = 'file' in keywords and keywords['file'] or open(LOGFILE, 'a') end = 'end' in keywords and keywords['end'] or '\n' _file.write(sep.join(map(str, (start, ) + objects)) + end) +def relpath_conf(*paths): + """returns the path relative to rangers configuration directory""" + if arg.clean: + assert 0, "Should not access relpath_conf in clean mode!" + else: + return os.path.join(arg.confdir, *paths) + def relpath(*paths): """returns the path relative to rangers library directory""" return os.path.join(RANGERDIR, *paths) -def relpath_conf(*paths): - """returns the path relative to rangers configuration directory""" - return os.path.join(CONFDIR, *paths) from ranger.__main__ import main |