From 9edc595440e6e64467d36d2f0f60ce8eee8450f8 Mon Sep 17 00:00:00 2001 From: toonn Date: Wed, 6 Jun 2018 00:07:05 +0200 Subject: Introduce a helper function for versioning The `version_helper` function should make version changes simpler, upon a release simple bump `__version__` and change `__release__` to `True`, afterwards change `__release__` back to `False`. It also tries to call `git describe` so `ranger --version` reports a commit hash if available. This should prevent slip-ups where released versions report ambiguously as being `ranger-master x.y.z` which is what we use for non-release versions. Fixes #1197, which was a misunderstanding caused by a slip-up. --- ranger/__init__.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/ranger/__init__.py b/ranger/__init__.py index 0d7c8fdc..ae1ecc48 100644 --- a/ranger/__init__.py +++ b/ranger/__init__.py @@ -12,9 +12,28 @@ 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.1' +__release__ = False __author__ = __maintainer__ = 'Roman Zimbelmann' __email__ = 'hut@hut.pm' @@ -27,7 +46,7 @@ MACRO_DELIMITER = '%' MACRO_DELIMITER_ESC = '%%' DEFAULT_PAGER = 'less' USAGE = '%prog [options] [path]' -VERSION = 'ranger-master {0}'.format(__version__) +VERSION = version_helper() # These variables are ignored if the corresponding # XDG environment variable is non-empty and absolute -- cgit 1.4.1-2-gfad0 t'>
path: root/tests/unittests/test_preferences.c
blob: c4bcbf77862d0099af375da0e58e0faa05565661 (plain) (blame)
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