@@ -77,7 +77,7 @@ def init_rewriter(line, ctxt):
77
77
78
78
def rewrite_file (infilename , rewritefunc , ctxt ):
79
79
outfilename = infilename + ".new"
80
- if not ctxt ["renameonly " ]:
80
+ if not ctxt ["accept " ]:
81
81
infile = open (infilename , "r" )
82
82
outfile = open (outfilename , "w" )
83
83
try :
@@ -110,27 +110,27 @@ def main():
110
110
"the version numbers in the source." ,
111
111
epilog = "After running, edit docs/changelog.rst and add the new changelog "
112
112
"information under the new heading." )
113
- parser .add_argument ("version" , help = "New version number to add" )
113
+ parser .add_argument ("version" , help = "New version number to add, or \" accept \" to accept changes to .new files " )
114
114
parser .add_argument ("-n" , "--nodelete" , action = "store_true" ,
115
115
help = "Do not delete existing files, leave new files with .new extension" )
116
116
parser .add_argument ("-b" , "--backup" , action = "store_true" ,
117
117
help = "Keep old versions of files around with a .bak extension" )
118
- parser .add_argument ("-r" , "--renameonly" , action = "store_true" ,
119
- help = "Do rename of .new files only; don't rewrite" )
120
118
121
119
args = parser .parse_args ()
122
120
123
- if args .renameonly and args .nodelete :
124
- print ("cannot specify --renameonly and --nodelete together" )
125
- return 1
126
-
127
- if not args .renameonly :
121
+ is_accept = False
122
+ if args .version == "accept" :
123
+ if args .nodelete :
124
+ print ("cannot specify --nodelete with accept command" )
125
+ return 1
126
+ is_accept = True
127
+ else :
128
128
vnexpr = re .compile (r"^[1-9]\d*\.\d+\.\d+$" )
129
129
if not vnexpr .match (args .version ):
130
130
print ("Invalid version number {0}: must be three numeric values separated by dots\n " .format (args .version ))
131
131
return 1
132
132
133
- ctxt = {"version" : args .version , "nodelete" : args .nodelete , "backup" : args .backup , "renameonly " : args . renameonly }
133
+ ctxt = {"version" : args .version , "nodelete" : args .nodelete , "backup" : args .backup , "accept " : is_accept }
134
134
rewrite_file ("README.md" , readme_rewriter , ctxt )
135
135
rewrite_file ("docs/changelog.rst" , changelog_rewriter , ctxt )
136
136
rewrite_file ("docs/conf.py" , doc_conf_rewriter , ctxt )
0 commit comments