summaryrefslogtreecommitdiffstats
path: root/ranger/__init__.py
blob: b3bf61b2fa10635d8bb9150c60ffa26aaf336982 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# This file is part of ranger, the console file manager.
# License: GNU GPL version 3, see the file "AUTHORS" for details.

"""A console file manager with VI key bindings.

It provides a minimalistic and nice curses interface with a view on the
directory hierarchy.  The secondary task of ranger is to figure out which
program you want to use to open your files with.
"""

from __future__ import (absolute_import, division, print_function)

import os


# Version helper
def version_helper():
    if __release__:
        version_string = 'ranger {0}'.format(__version__)
    else:
        import subprocess
        version_string = 'ranger-master {0}'
        try:
            git_describe = subprocess.check_output(['git', 'describe'],
                                                   universal_newlines=True,
                                                   stderr=subprocess.PIPE)
            version_string = version_string.format(git_describe.strip('\n'))
        except (OSError, subprocess.CalledProcessError):
            version_string = version_string.format(__version__)
    return version_string


# Information
__license__ = 'GPL3'
__version__ = '1.9.2'
__release__ = True
__author__ = __maintainer__ = 'Roman Zimbelmann'
__email__ = 'hut@hut.pm'

# Constants
RANGERDIR = os.path.dirname(__file__)
TICKS_BEFORE_COLLECTING_GARBAGE = 100
TIME_BEFORE_FILE_BECOMES_GARBAGE = 1200
MAX_RESTORABLE_TABS = 3
MACRO_DELIMITER = '%'
MACRO_DELIMITER_ESC = '%%'
DEFAULT_PAGER = 'less'
USAGE = '%prog [options] [path]'
VERSION = version_helper()

# These variables are ignored if the corresponding
# XDG environment variable is non-empty and absolute
CACHEDIR = os.path.expanduser('~/.cache/ranger')
CONFDIR = os.path.expanduser('~/.config/ranger')
DATADIR = os.path.expanduser('~/.local/share/ranger')

args = None  # pylint: disable=invalid-name

from ranger.core.main import main  # NOQA pylint: disable=wrong-import-position