mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Show only the first two version numbers if the third is zero
This commit is contained in:
parent
db9056d5a1
commit
58b4beca96
@ -217,9 +217,11 @@ else:
|
|||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
'''Return version string that indicates if we are running in a dev env'''
|
'''Return version string for display to user '''
|
||||||
dv = os.environ.get('CALIBRE_DEVELOP_FROM', None)
|
dv = os.environ.get('CALIBRE_DEVELOP_FROM', None)
|
||||||
v = __version__
|
v = __version__
|
||||||
|
if numeric_version[-1] == 0:
|
||||||
|
v = v[:-2]
|
||||||
if getattr(sys, 'frozen', False) and dv and os.path.abspath(dv) in sys.path:
|
if getattr(sys, 'frozen', False) and dv and os.path.abspath(dv) in sys.path:
|
||||||
v += '*'
|
v += '*'
|
||||||
if iswindows and is64bit:
|
if iswindows and is64bit:
|
||||||
|
@ -12,7 +12,7 @@ from optparse import OptionParser as _OptionParser, OptionGroup
|
|||||||
from optparse import IndentedHelpFormatter
|
from optparse import IndentedHelpFormatter
|
||||||
|
|
||||||
from calibre.constants import (config_dir, CONFIG_DIR_MODE, __appname__,
|
from calibre.constants import (config_dir, CONFIG_DIR_MODE, __appname__,
|
||||||
__version__, __author__)
|
get_version, __author__)
|
||||||
from calibre.utils.lock import ExclusiveFile
|
from calibre.utils.lock import ExclusiveFile
|
||||||
from calibre.utils.config_base import (make_config_dir, Option, OptionValues,
|
from calibre.utils.config_base import (make_config_dir, Option, OptionValues,
|
||||||
OptionSet, ConfigInterface, Config, prefs, StringConfig, ConfigProxy,
|
OptionSet, ConfigInterface, Config, prefs, StringConfig, ConfigProxy,
|
||||||
@ -76,7 +76,7 @@ class OptionParser(_OptionParser):
|
|||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
usage='%prog [options] filename',
|
usage='%prog [options] filename',
|
||||||
version='%%prog (%s %s)'%(__appname__, __version__),
|
version=None,
|
||||||
epilog=None,
|
epilog=None,
|
||||||
gui_mode=False,
|
gui_mode=False,
|
||||||
conflict_handler='resolve',
|
conflict_handler='resolve',
|
||||||
@ -89,6 +89,8 @@ class OptionParser(_OptionParser):
|
|||||||
epilog = _('Created by ')+colored(__author__, fg='cyan')
|
epilog = _('Created by ')+colored(__author__, fg='cyan')
|
||||||
usage += '\n\n'+_('''Whenever you pass arguments to %prog that have spaces in them, '''
|
usage += '\n\n'+_('''Whenever you pass arguments to %prog that have spaces in them, '''
|
||||||
'''enclose the arguments in quotation marks.''')+'\n'
|
'''enclose the arguments in quotation marks.''')+'\n'
|
||||||
|
if version is None:
|
||||||
|
version = '%%prog (%s %s)'%(__appname__, get_version())
|
||||||
_OptionParser.__init__(self, usage=usage, version=version, epilog=epilog,
|
_OptionParser.__init__(self, usage=usage, version=version, epilog=epilog,
|
||||||
formatter=CustomHelpFormatter(),
|
formatter=CustomHelpFormatter(),
|
||||||
conflict_handler=conflict_handler, **kwds)
|
conflict_handler=conflict_handler, **kwds)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user