Skip to content

Commit ff12252

Browse files
committed
Refactor copyright banner
1 parent 093d844 commit ff12252

File tree

2 files changed

+35
-14
lines changed

2 files changed

+35
-14
lines changed

bpdb/__init__.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import traceback
2727

2828
import bpython
29+
from bpython.args import version_banner, copyright_banner
2930
from .debugger import BPdb
3031
from optparse import OptionParser
3132
from pdb import Restart
@@ -74,12 +75,8 @@ def main():
7475
)
7576
options, args = parser.parse_args(sys.argv)
7677
if options.version:
77-
print("bpdb on top of bpython version", __version__, end="")
78-
print("on top of Python", sys.version.split()[0])
79-
print(
80-
"(C) 2008-2013 Bob Farrell, Andreas Stuehrk et al. "
81-
"See AUTHORS for detail."
82-
)
78+
print(version_banner(base="bpdb"))
79+
print(copyright_banner())
8380
return 0
8481

8582
if len(args) < 2:

bpython/args.py

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,37 @@
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
"""
225
Module to handle command line argument parsing, for all front-ends.
326
"""
427

5-
628
import code
729
import importlib.util
830
import os
931
import sys
1032
from optparse import OptionParser, OptionGroup
1133

12-
from . import __version__
34+
from . import __version__, __copyright__
1335
from .config import default_config_path, loadini, Struct
1436
from .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+
3461
def 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

Comments
 (0)