Skip to content

Commit 3816817

Browse files
committed
Add --version option to pasteurize
1 parent adcb3e7 commit 3816817

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

libfuturize/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
import future
6767
import future.utils
6868

69-
__version__ = '0.13.0-dev'
69+
__version__ = '0.12.3-dev'
7070

7171
import sys
7272
import logging

libpasteurize/main.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,30 @@
3636
import sys
3737
import logging
3838
import optparse
39-
4039
from lib2to3.main import main, warn, StdoutRefactoringTool
4140
from lib2to3 import refactor
4241

42+
import future
4343
from libpasteurize.fixes import fix_names
4444

45+
__version__ = '0.12.3-dev'
46+
47+
if __version__ != future.__version__:
48+
warn('The libfuturize and future packages have different versions. '
49+
'This may break the pasteurize script. Please ensure the versions '
50+
'are consistent.')
51+
52+
4553

4654
def main(args=None):
4755
"""Main program.
4856
4957
Returns a suggested exit status (0, 1, 2).
5058
"""
5159
# Set up option parser
52-
parser = optparse.OptionParser(usage="futurize [options] file|dir ...")
60+
parser = optparse.OptionParser(usage="pasteurize [options] file|dir ...")
61+
parser.add_option("-V", "--version", action="store_true",
62+
help="Report the version number of pasteurize")
5363
parser.add_option("-a", "--all-imports", action="store_true",
5464
help="Adds all __future__ and future imports to each module")
5565
parser.add_option("-d", "--doctests_only", action="store_true",
@@ -85,6 +95,9 @@ def main(args=None):
8595
warn("not writing files and not printing diffs; that's not very useful")
8696
if not options.write and options.nobackups:
8797
parser.error("Can't use -n without -w")
98+
if options.version:
99+
print(__version__)
100+
return 0
88101
if options.list_fixes:
89102
print("Available transformations for the -f/--fix option:")
90103
for fixname in sorted(avail_fixes):

0 commit comments

Comments
 (0)