1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

version display: add -V/--version flag to wb-manager and wayback/pywb commands to display version and exit (#654)

update CHANGES
comment out default locales in config.yaml
only show warning for installing i18n extra when locales actually specified in config

bump to 2.6.0b3
This commit is contained in:
Ilya Kreymer 2021-06-24 11:28:48 -07:00 committed by GitHub
parent cff2a9efc5
commit 81308780ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 35 additions and 6 deletions

View File

@ -1,3 +1,11 @@
pywb 2.6.0b3 changelist
~~~~~~~~~~~~~~~~~~~~~~~
* Display 'ignoring locales' warning only if locales specified (don't specify any by default)
* Add -V flag to wb-manager and pywb/wayback commands to display current version and exit
pywb 2.6.0b2 changelist
~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -17,6 +17,12 @@ enable_memento: true
# Replay content in an iframe
framed_replay: true
locales:
- en
- es
# uncomment and change to set default locale
# default_locale: en
# uncomment to set available locales
# locales:
# - en
# - es

View File

@ -2,6 +2,13 @@ from gevent.monkey import patch_all; patch_all()
from argparse import ArgumentParser
import logging
import pkg_resources
#=============================================================================
def get_version():
"""Get version of the pywb"""
return "pywb " + pkg_resources.get_distribution("pywb").version
#=============================================================================
@ -40,6 +47,8 @@ class BaseCli(object):
:param str desc: The description for the application to be started
"""
parser = ArgumentParser(description=desc)
parser.add_argument("-V", "--version", action="version", version=get_version())
parser.add_argument('-p', '--port', type=int, default=default_port,
help='Port to listen on (default %s)' % default_port)
parser.add_argument('-b', '--bind', default='0.0.0.0',

View File

@ -8,7 +8,7 @@ import re
import six
from distutils.util import strtobool
from pkg_resources import resource_string
from pkg_resources import resource_string, get_distribution
from argparse import ArgumentParser, RawTextHelpFormatter
@ -28,8 +28,12 @@ def get_input(msg): # pragma: no cover
return input(msg)
#=============================================================================
def get_version():
"""Get version of the pywb"""
return "wb-manager " + get_distribution("pywb").version
#=============================================================================
class CollectionsManager(object):
""" This utility is designed to
simplify the creation and management of web archive collections
@ -335,6 +339,8 @@ Create manage file based web archive collections
# epilog=epilog,
formatter_class=RawTextHelpFormatter)
parser.add_argument("-V", "--version", action="version", version=get_version())
subparsers = parser.add_subparsers(dest='type')
subparsers.required = True

View File

@ -126,7 +126,7 @@ class JinjaEnv(object):
default_locale = default_locale or 'en'
self.default_locale = default_locale
if locales_root_dir:
if locales:
try:
from babel.support import Translations
for loc in locales:

View File

@ -1,4 +1,4 @@
__version__ = '2.6.0b2'
__version__ = '2.6.0b3'
if __name__ == '__main__':
print(__version__)