aboutsummaryrefslogtreecommitdiff
path: root/devscripts
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-12-16 00:22:38 +0100
committerPhilipp Hagemeister <phihag@phihag.de>2014-12-16 00:24:11 +0100
commitccbfaa83b032587750cf466802d3f9ad162253fe (patch)
tree2fcff8a88e9de3008a5a5e86af572a7a8efd6bfb /devscripts
parentd86007873ef721819241ecd84258e9cce02ec961 (diff)
[devscripts/make_contributing] Switch to optparse (Fixes #4483)
Diffstat (limited to 'devscripts')
-rwxr-xr-xdevscripts/make_contributing.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/devscripts/make_contributing.py b/devscripts/make_contributing.py
index 5fa8cf851..5e454a429 100755
--- a/devscripts/make_contributing.py
+++ b/devscripts/make_contributing.py
@@ -1,20 +1,20 @@
#!/usr/bin/env python
from __future__ import unicode_literals
-import argparse
import io
+import optparse
import re
def main():
- parser = argparse.ArgumentParser()
- parser.add_argument(
- 'INFILE', help='README.md file name to read from')
- parser.add_argument(
- 'OUTFILE', help='CONTRIBUTING.md file name to write to')
- args = parser.parse_args()
-
- with io.open(args.INFILE, encoding='utf-8') as inf:
+ parser = optparse.OptionParser(usage='%prog INFILE OUTFILE')
+ options, args = parser.parse_args()
+ if len(args) != 2:
+ parser.error('Expected an input and an output filename')
+
+ infile, outfile = args
+
+ with io.open(infile, encoding='utf-8') as inf:
readme = inf.read()
bug_text = re.search(
@@ -25,7 +25,7 @@ def main():
out = bug_text + dev_text
- with io.open(args.OUTFILE, 'w', encoding='utf-8') as outf:
+ with io.open(outfile, 'w', encoding='utf-8') as outf:
outf.write(out)
if __name__ == '__main__':