Commit 986559fb authored by Mark Lodato's avatar Mark Lodato

freeze: use optparse to parse arguments

parent e1a8c058
......@@ -6,11 +6,17 @@ Requires Cython 0.11.2 (or perhaps newer).
See Demos/freeze/README.rst for more details.
"""
import sys
import optparse
if len(sys.argv) < 2:
print >>sys.stderr, "USAGE: %s module [module ...]" % sys.argv[0]
sys.exit(1)
usage= '%prog module [module ...]'
description = 'Create a C file for embedding Cython modules.'
p = optparse.OptionParser(usage=usage, description=description)
options, args = p.parse_args()
if len(args) < 1:
p.print_help()
p.exit(1)
def format_modname(name):
if name.endswith('.pyx'):
......@@ -19,7 +25,7 @@ def format_modname(name):
name = name[:-3]
return name.replace('.','_')
modules = [format_modname(x) for x in sys.argv[1:]]
modules = [format_modname(x) for x in args]
print """
#include <Python.h>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment