1+ # The MIT License
2+ #
3+ # Copyright (c) 2008 Bob Farrell
4+ # Copyright (c) 2012-2020 Sebastian Ramacher
5+ #
6+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7+ # of this software and associated documentation files (the "Software"), to deal
8+ # in the Software without restriction, including without limitation the rights
9+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+ # copies of the Software, and to permit persons to whom the Software is
11+ # furnished to do so, subject to the following conditions:
12+ #
13+ # The above copyright notice and this permission notice shall be included in
14+ # all copies or substantial portions of the Software.
15+ #
16+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+ # THE SOFTWARE.
23+
124"""
225Module to handle command line argument parsing, for all front-ends.
326"""
427
5-
628import code
729import importlib .util
830import os
931import sys
1032from optparse import OptionParser , OptionGroup
1133
12- from . import __version__
34+ from . import __version__ , __copyright__
1335from .config import default_config_path , loadini , Struct
1436from .translations import _
1537
@@ -23,14 +45,19 @@ def error(self, msg):
2345 raise OptionParserFailed ()
2446
2547
26- def version_banner ():
27- return "bpython version {} on top of Python {} {}" .format (
48+ def version_banner (base = "bpython" ):
49+ return "{} version {} on top of Python {} {}" .format (
50+ base ,
2851 __version__ ,
2952 sys .version .split ()[0 ],
3053 sys .executable ,
3154 )
3255
3356
57+ def copyright_banner ():
58+ return "{} See AUTHORS for details." .format (__copyright__ )
59+
60+
3461def parse (args , extras = None , ignore_stdin = False ):
3562 """Receive an argument list - if None, use sys.argv - parse all args and
3663 take appropriate action. Also receive optional extra options: this should
@@ -110,10 +137,7 @@ def parse(args, extras=None, ignore_stdin=False):
110137
111138 if options .version :
112139 print (version_banner ())
113- print (
114- "(C) 2008-2020 Bob Farrell, Andreas Stuehrk, Sebastian Ramacher, Thomas Ballinger, et al. "
115- "See AUTHORS for detail."
116- )
140+ print (copyright_banner ())
117141 raise SystemExit
118142
119143 if not ignore_stdin and not (sys .stdin .isatty () and sys .stdout .isatty ()):
0 commit comments