Include data files with the new Python module

This commit is contained in:
Ray Speth 2012-09-06 19:56:51 +00:00
parent 1758c86a3f
commit 95b75409be
7 changed files with 19 additions and 3 deletions

View file

@ -1,3 +1,5 @@
cantera/*.cpp
cantera/*.c
cantera/data/*.cti
cantera/data/*.xml
setup.py

View file

@ -1 +1,4 @@
from ._cantera import *
import os as _os
addDirectory(_os.path.join(_os.path.dirname(__file__), 'data'))

View file

@ -11,6 +11,9 @@ cdef extern from "cantera/base/xml.h" namespace "Cantera":
cdef extern from "cantera/base/ctml.h" namespace "ctml":
XML_Node getCtmlTree(string) except +
cdef extern from "cantera/base/global.h" namespace "Cantera":
cdef void CxxAddDirectory "Cantera::addDirectory" (string)
cdef extern from "cantera/thermo/mix_defs.h":
cdef int thermo_type_ideal_gas "Cantera::cIdealGas"
cdef int thermo_type_surf "Cantera::cSurf"

View file

@ -3,3 +3,6 @@ cdef string stringify(x):
# This method works with both Python 2.x and 3.x.
tmp = bytes(x.encode())
return string(tmp)
def addDirectory(directory):
CxxAddDirectory(stringify(directory))

View file

@ -1,5 +1,5 @@
import os
from distutils.core import setup, Extension
from setuptools import setup, find_packages, Extension
from distutils.sysconfig import get_config_var
from Cython.Distutils import build_ext
@ -26,7 +26,8 @@ setup(name="Cantera",
author="Raymond Speth",
author_email="speth@mit.edu",
url="http://code.google.com/p/cantera",
packages = ["cantera", "cantera.test"],
packages = find_packages(),
cmdclass = {'build_ext': build_ext},
ext_modules = exts,
package_data = {'cantera': dataFiles})
package_data = {'cantera': dataFiles,
'cantera.data': ['*.xml', '*.cti']})

View file

@ -127,6 +127,10 @@ else:
localenv['py_extra_link_args'] = repr(['-Wl,-rpath=$$ORIGIN'])
localenv['py_extra_compiler_args'] = repr([])
dataFiles = localenv.RecursiveInstall('#interfaces/cython/cantera/data',
'#data/inputs', ['\\.inp$', '\\.in$'])
build(dataFiles)
make_setup = localenv.SubstFile('#interfaces/cython/setup.py',
'#interfaces/cython/setup.py.in')
build(make_setup)