Skip to content

Commit 805eaf0

Browse files
committed
rinoh: add --versions for use in bug reports
1 parent f30f3ad commit 805eaf0

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ New Features:
3636
prepended to (e.g. *note title paragraph*).
3737
* Support interlaced PNG images (#274). Note that this can slow down rendering
3838
significantly for many/large interlaced images.
39+
* rinoh now accepts the ``--versions`` argument, useful for bug reports
3940

4041
Changed:
4142

src/rinoh/__main__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@
88

99
import argparse
1010
import os
11+
import sys
1112
import webbrowser
1213

1314
from collections import OrderedDict
15+
from contextlib import suppress
1416
from pathlib import Path
17+
from platform import platform
1518

1619
from rinoh import __version__, __release_date__
1720

@@ -80,6 +83,9 @@
8083
parser.add_argument('--version', action='version',
8184
version='%(prog)s {} ({})'.format(__version__,
8285
__release_date__))
86+
parser.add_argument('--versions', action='store_true',
87+
help='list versions of rinohtype and related software (for '
88+
'inclusion in bug reports)')
8389
parser.add_argument('--docs', action='store_true',
8490
help='open the online documentation in the default '
8591
'browser')
@@ -156,6 +162,14 @@ def main():
156162
global parser
157163
args = parser.parse_args()
158164
do_exit = False
165+
if args.versions:
166+
print(f'rinohtype {__version__} ({__release_date__})')
167+
with suppress(ImportError):
168+
import sphinx
169+
print(f'Sphinx {sphinx.__version__}')
170+
print(f'Python {sys.version}')
171+
print(platform())
172+
return
159173
if args.docs:
160174
webbrowser.open(DOCS_URL)
161175
return

0 commit comments

Comments
 (0)