diff --git a/interfaces/cython/.gitignore b/interfaces/cython/.gitignore index 38972302e..65213e9be 100644 --- a/interfaces/cython/.gitignore +++ b/interfaces/cython/.gitignore @@ -9,8 +9,11 @@ cantera/test/data/*.dat cantera/test/data/*.csv setup2.py setup3.py -ctml_writer.py +cantera/ctml_writer.py scripts/ctml_writer.py scripts/ctml_writer +cantera/ck2cti.py +scripts/ck2cti.py +scripts/ck2cti Cantera.egg-info dist diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index c044595c2..9c4d2e7e4 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -43,19 +43,27 @@ def add_dependencies(mod, ext): if os.name == 'nt': script_ext = '.py' localenv['py_ctml_writer'] = repr('scripts/ctml_writer.py') + localenv['py_ck2cti'] = repr('scripts/ck2cti.py') else: script_ext = '' localenv['py_ctml_writer'] = repr('scripts/ctml_writer') + localenv['py_ck2cti'] = repr('scripts/ck2cti') -# The actual ctml_writer script -build(env.Command('ctml_writer.py', +# The actual ctml_writer and ck2cti scripts +build(env.Command('cantera/ctml_writer.py', '#interfaces/python/ctml_writer.py', Copy('$TARGET', '$SOURCE'))) +build(env.Command('cantera/ck2cti.py', + '#interfaces/python/ck2cti.py', + Copy('$TARGET', '$SOURCE'))) # thin wrapper build(env.Command('scripts/ctml_writer%s' % script_ext, 'scripts/ctml_writer.py.in', Copy('$TARGET', '$SOURCE'))) +build(env.Command('scripts/ck2cti%s' % script_ext, + 'scripts/ck2cti.py.in', + Copy('$TARGET', '$SOURCE'))) def install_module(prefix, python_version): if prefix == 'USER': diff --git a/interfaces/cython/scripts/ck2cti.py.in b/interfaces/cython/scripts/ck2cti.py.in new file mode 100644 index 000000000..db45ff6a7 --- /dev/null +++ b/interfaces/cython/scripts/ck2cti.py.in @@ -0,0 +1,5 @@ +#!/usr/bin/python +from cantera import ck2cti +import sys + +ck2cti.main(sys.argv[1:]) diff --git a/interfaces/cython/scripts/ctml_writer.py.in b/interfaces/cython/scripts/ctml_writer.py.in index f5a301eb0..ed9b4c58c 100644 --- a/interfaces/cython/scripts/ctml_writer.py.in +++ b/interfaces/cython/scripts/ctml_writer.py.in @@ -1,5 +1,5 @@ #!/usr/bin/python -import ctml_writer +from cantera import ctml_writer if __name__ == "__main__": import sys diff --git a/interfaces/cython/setup.py.in b/interfaces/cython/setup.py.in index 04617b9a8..62c8fb007 100644 --- a/interfaces/cython/setup.py.in +++ b/interfaces/cython/setup.py.in @@ -23,9 +23,9 @@ setup(name="Cantera", 'cantera.test', 'cantera.test.data', 'cantera.examples'], - scripts=[@py_ctml_writer@], + scripts=[@py_ctml_writer@, + @py_ck2cti@], ext_modules = exts, - py_modules = ['ctml_writer'], package_data = {'cantera.data': ['*.*'], 'cantera.test.data': ['*.*'], 'cantera.examples': ['*/*.*']}) diff --git a/interfaces/python/ck2cti.py b/interfaces/python/ck2cti.py index 85cd81af9..de586167e 100755 --- a/interfaces/python/ck2cti.py +++ b/interfaces/python/ck2cti.py @@ -1699,7 +1699,7 @@ duplicate transport data) to be ignored. print('Mechanism contains {0} species and {1} reactions.'.format(len(self.speciesList), len(self.reactions))) -if __name__ == '__main__': +def main(argv): import getopt import sys @@ -1707,7 +1707,7 @@ if __name__ == '__main__': 'permissive', 'help', 'debug'] try: - optlist, args = getopt.getopt(sys.argv[1:], 'dh', longOptions) + optlist, args = getopt.getopt(argv, 'dh', longOptions) options = dict() for o,a in optlist: options[o] = a @@ -1748,3 +1748,7 @@ if __name__ == '__main__': parser.convertMech(inputFile, thermoFile, transportFile, phaseName, outName, permissive=permissive) + +if __name__ == '__main__': + import sys + main(sys.argv[1:])