diff options
author | Dan Miller <dnmiller@gmail.com> | 2012-11-16 20:54:55 -0800 |
---|---|---|
committer | Dan Miller <dnmiller@gmail.com> | 2012-11-16 20:54:55 -0800 |
commit | 42babb76a21a9c3cfed7c85e34e090b1bf8e4be9 (patch) | |
tree | 9422a795ddd5f65b97a8e911a1578460d783897f /bin | |
parent | f7cd93f2331294f5a487a64184f5172cab4eb2ee (diff) | |
download | cython-42babb76a21a9c3cfed7c85e34e090b1bf8e4be9.tar.gz |
Implementing module name parsing with os.path.
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cython_freeze | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/bin/cython_freeze b/bin/cython_freeze index 2702ce7e0..74f365689 100755 --- a/bin/cython_freeze +++ b/bin/cython_freeze @@ -7,6 +7,7 @@ See Demos/freeze/README.txt for more details. """ import optparse +from os.path import splitext, basename usage= '%prog [-o outfile] [-p] module [module ...]' description = 'Create a C file for embedding Cython modules.' @@ -27,14 +28,7 @@ if options.output: old_stdout = sys.stdout sys.stdout = open(options.output, 'w') -def format_modname(name): - if name.endswith('.pyx'): - name = name[:-4] - elif name.endswith('.py'): - name = name[:-3] - return name.replace('.','_') - -modules = [format_modname(x) for x in args] +modules = [basename(splitext(x)[0]).replace('.', '_') for x in args] print """\ #include <Python.h> |