diff options
author | Mark Lodato <lodatom@gmail.com> | 2009-10-04 20:01:27 -0400 |
---|---|---|
committer | Mark Lodato <lodatom@gmail.com> | 2009-10-04 20:01:27 -0400 |
commit | 162043e3e3e456df8140243003b0c5a339bfdcec (patch) | |
tree | 04a22471f0b314ce52fa237258461d7c5b2f5ea6 /bin | |
parent | 986559fba7c7d854bb0b5396819801b3bef0c573 (diff) | |
download | cython-162043e3e3e456df8140243003b0c5a339bfdcec.tar.gz |
freeze: add -o option for setting output file
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cython_freeze | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/bin/cython_freeze b/bin/cython_freeze index b28163040..b9441e4ea 100755 --- a/bin/cython_freeze +++ b/bin/cython_freeze @@ -8,9 +8,11 @@ See Demos/freeze/README.rst for more details. import optparse -usage= '%prog module [module ...]' +usage= '%prog [-o outfile] module [module ...]' description = 'Create a C file for embedding Cython modules.' p = optparse.OptionParser(usage=usage, description=description) +p.add_option('-o', '--output', metavar='FILE', + help='write output to FILE instead of standard output') options, args = p.parse_args() @@ -18,6 +20,11 @@ if len(args) < 1: p.print_help() p.exit(1) +if options.output: + import sys + old_stdout = sys.stdout + sys.stdout = open(options.output, 'w') + def format_modname(name): if name.endswith('.pyx'): name = name[:-4] |