diff --git a/interfaces/cython/.gitignore b/interfaces/cython/.gitignore index 68d3fbce0..38972302e 100644 --- a/interfaces/cython/.gitignore +++ b/interfaces/cython/.gitignore @@ -9,5 +9,8 @@ cantera/test/data/*.dat cantera/test/data/*.csv setup2.py setup3.py +ctml_writer.py +scripts/ctml_writer.py +scripts/ctml_writer Cantera.egg-info dist diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index ee696b5d4..c044595c2 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -40,6 +40,22 @@ def add_dependencies(mod, ext): mglob(localenv, 'cantera/examples/misc', 'py')): localenv.Depends(mod, f) +if os.name == 'nt': + script_ext = '.py' + localenv['py_ctml_writer'] = repr('scripts/ctml_writer.py') +else: + script_ext = '' + localenv['py_ctml_writer'] = repr('scripts/ctml_writer') + +# The actual ctml_writer script +build(env.Command('ctml_writer.py', + '#interfaces/python/ctml_writer.py', + Copy('$TARGET', '$SOURCE'))) + +# thin wrapper +build(env.Command('scripts/ctml_writer%s' % script_ext, + 'scripts/ctml_writer.py.in', + Copy('$TARGET', '$SOURCE'))) def install_module(prefix, python_version): if prefix == 'USER': diff --git a/interfaces/cython/scripts/ctml_writer.py.in b/interfaces/cython/scripts/ctml_writer.py.in new file mode 100644 index 000000000..f5a301eb0 --- /dev/null +++ b/interfaces/cython/scripts/ctml_writer.py.in @@ -0,0 +1,8 @@ +#!/usr/bin/python +import ctml_writer + +if __name__ == "__main__": + import sys + if len(sys.argv) not in (2,3): + raise ValueError('Incorrect number of command line arguments.') + ctml_writer.convert(*sys.argv[1:]) diff --git a/interfaces/cython/setup.py.in b/interfaces/cython/setup.py.in index 0dd775de8..04617b9a8 100644 --- a/interfaces/cython/setup.py.in +++ b/interfaces/cython/setup.py.in @@ -23,7 +23,9 @@ setup(name="Cantera", 'cantera.test', 'cantera.test.data', 'cantera.examples'], + scripts=[@py_ctml_writer@], ext_modules = exts, + py_modules = ['ctml_writer'], package_data = {'cantera.data': ['*.*'], 'cantera.test.data': ['*.*'], 'cantera.examples': ['*/*.*']})