diff --git a/SConstruct b/SConstruct index 37323ec5a9d..8cffad497f7 100644 --- a/SConstruct +++ b/SConstruct @@ -83,7 +83,9 @@ if "clean" in COMMAND_LINE_TARGETS: remove_directory("include/cantera/ext") remove_file("interfaces/cython/cantera/_cantera.cpp") remove_file("interfaces/cython/cantera/_cantera.h") - remove_file("interfaces/cython/setup.py") + remove_file("interfaces/cython/setup.cfg") + remove_file("interfaces/cython/LICENSE.txt") + remove_file("interfaces/cython/README.rst") remove_file("interfaces/python_minimal/setup.py") remove_file("config.log") remove_directory("doc/sphinx/matlab/examples") diff --git a/interfaces/cython/.gitignore b/interfaces/cython/.gitignore index c76ec86cfad..2a5acec62db 100644 --- a/interfaces/cython/.gitignore +++ b/interfaces/cython/.gitignore @@ -2,10 +2,8 @@ cantera/*.cpp cantera/*.c cantera/data cantera/test/data -setup.py -scripts/ctml_writer.py -scripts/ctml_writer -scripts/ck2cti.py -scripts/ck2cti Cantera.egg-info dist +setup.cfg +LICENSE.txt +README.rst diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index f25a792f90c..54dcc8cf789 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -74,16 +74,19 @@ ext = localenv.LoadableModule('#build/python/cantera/_cantera{}'.format(module_e SHLIBPREFIX='', LIBSUFFIXES=[module_ext]) localenv['py_extension'] = ext[0].name -localenv.SubstFile('setup.py', 'setup.py.in') +setup_cfg = localenv.SubstFile("setup.cfg", "setup.cfg.in") +readme = localenv.Command("README.rst", "#README.rst", Copy("$TARGET", "$SOURCE")) +license = localenv.Command("LICENSE.txt", "#build/ext/LICENSE.txt", + Copy("$TARGET", "$SOURCE")) +localenv.Depends(license, localenv["license_target"]) build_cmd = ('cd interfaces/cython &&' ' $python_cmd_esc setup.py build --build-lib=../../build/python') -mod = build(localenv.Command('#build/python/cantera/__init__.py', 'setup.py', +mod = build(localenv.Command("#build/python/cantera/__init__.py", "setup.cfg", build_cmd)) env['python_module'] = mod env['python_extension'] = ext -localenv.Depends(mod, ext) -localenv.Depends(mod, dataFiles + testFiles) +localenv.Depends(mod, [ext, dataFiles, testFiles, setup_cfg, readme, license]) localenv.Depends(ext, localenv['cantera_staticlib']) for f in (multi_glob(localenv, 'cantera', 'py') + diff --git a/interfaces/cython/setup.cfg.in b/interfaces/cython/setup.cfg.in new file mode 100644 index 00000000000..847334942da --- /dev/null +++ b/interfaces/cython/setup.cfg.in @@ -0,0 +1,69 @@ +[metadata] +name = Cantera +version = @cantera_version@ +description = Cantera is an open-source suite of tools for problems involving chemical kinetics, thermodynamics, and transport processes. +long_description = file: README.rst +long_description_content_type = text/x-rst +license_files = LICENSE.txt +url = https://cantera.org +author = Cantera Developers +author_email = steering@cantera.org +keywords = chemistry physics +license = BSD 3-Clause License +classifiers = + Development Status :: 5 - Production/Stable + Intended Audience :: Education + Intended Audience :: Science/Research + License :: OSI Approved :: BSD License + Operating System :: MacOS :: MacOS X + Operating System :: Microsoft :: Windows + Operating System :: POSIX :: Linux + Programming Language :: C + Programming Language :: C++ + Programming Language :: Cython + Programming Language :: Fortran + Programming Language :: Python :: 3 :: Only + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.9 + Programming Language :: Python :: Implementation :: CPython + Topic :: Scientific/Engineering :: Chemistry + Topic :: Scientific/Engineering :: Physics +project_urls = + Documentation = https://cantera.org/documentation + Funding = https://numfocus.org/donate-to-cantera + Source = https://github.com/Cantera/cantera + Tracker = https://github.com/Cantera/cantera/issues + +[options] +zip_safe = False +include_package_data = True +install_requires = + numpy >= 1.12.0 + ruamel.yaml >= 0.15.34 +python_requires = ~=@py_min_ver_str@ +packages = + cantera + cantera.data + cantera.test + cantera.test.data + cantera.examples + +[options.package_data] +cantera.data = *.*, */*.* +cantera.test.data = *.*, */*.* +cantera.examples = */*.* +cantera = *.pxd + +[options.extras_require] +hdf5 = h5py +pandas = pandas + +[options.entry_points] +console_scripts = + ck2cti = cantera.ck2cti:script_entry_point + ctml_writer = cantera.ctml_writer:main + ck2yaml = cantera.ck2yaml:script_entry_point + cti2yaml = cantera.cti2yaml:main + ctml2yaml = cantera.ctml2yaml:main diff --git a/interfaces/cython/setup.py b/interfaces/cython/setup.py new file mode 100644 index 00000000000..a930748fe18 --- /dev/null +++ b/interfaces/cython/setup.py @@ -0,0 +1,7 @@ +from setuptools import setup, Extension + +extension = Extension("cantera._cantera", sources=[]) + +setup( + ext_modules=[extension], +) diff --git a/interfaces/cython/setup.py.in b/interfaces/cython/setup.py.in deleted file mode 100644 index 85e9a01f748..00000000000 --- a/interfaces/cython/setup.py.in +++ /dev/null @@ -1,103 +0,0 @@ -import os -from setuptools import setup - -# Monkey patch to prevent bdist_msi from incorrectly overwriting the value of -# build-lib specified on the command line. -# See http://bugs.python.org/issue1109963 - -# This patch works by returning False the first time that the -# 'has_ext_modules' method is called in bdist_msi.run, which is where the -# replacement of build_lib happens. Subsequent calls to 'has_ext_modules' -# should use the correct value so that the resulting installer is specific to -# this Python version. Known to affect Python versions 2.6 through 3.7. If -# this bug is ever fixed, this patch should be made conditional on the Python -# version. -if os.name == 'nt': - from distutils.command.bdist_msi import bdist_msi - bdist_run_orig = bdist_msi.run - def bdist_run_new(self): - has_ext_modules_orig = self.distribution.has_ext_modules - self._first_call = True - def has_ext_modules(): - if self._first_call: - self._first_call = False - return False - else: - return has_ext_modules_orig() - - self.distribution.has_ext_modules = has_ext_modules - return bdist_run_orig(self) - - bdist_msi.run = bdist_run_new - -# Monkey patch to resolve https://bugs.python.org/issue34251 -# (Affects Python 3.7.0) -if os.name == 'nt': - import msilib - msilib.Win64 = msilib.AMD64 - -# Copy the long_description from docs/sphinx/index.rst -long_description = """ -Cantera is a suite of object-oriented software tools for problems involving -chemical kinetics, thermodynamics, and/or transport processes. - -Cantera provides types (or classes) of objects representing phases of -matter, interfaces between these phases, reaction managers, time-dependent -reactor networks, and steady one-dimensional reacting flows. Cantera is -currently used for applications including combustion, detonations, -electrochemical energy conversion and storage, fuel cells, batteries, aqueous -electrolyte solutions, plasmas, and thin film deposition. - -Cantera can be used from Python and Matlab, or in applications written -in C++ and Fortran 90. -""" - -setup( - name="Cantera", - version="@cantera_version@", - description="The Cantera Python Interface", - long_description=long_description, - author="Raymond Speth", - author_email="speth@mit.edu", - url="https://cantera.org", - packages=[ - 'cantera', - 'cantera.data', - 'cantera.test', - 'cantera.test.data', - 'cantera.examples', - ], - entry_points={ - 'console_scripts': [ - 'ck2cti=cantera.ck2cti:script_entry_point', - 'ctml_writer=cantera.ctml_writer:main', - 'ck2yaml=cantera.ck2yaml:script_entry_point', - 'cti2yaml=cantera.cti2yaml:main', - 'ctml2yaml=cantera.ctml2yaml:main', - ], - }, - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'Intended Audience :: Education', - 'Intended Audience :: Science/Research', - 'License :: OSI Approved :: BSD License', - 'Operating System :: MacOS :: MacOS X', - 'Operating System :: Microsoft :: Windows', - 'Operating System :: POSIX :: Linux', - 'Programming Language :: C++', - 'Programming Language :: Fortran', - 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', - 'Topic :: Scientific/Engineering :: Chemistry', - ], - package_data={ - 'cantera.data': ['*.*', '*/*.*'], - 'cantera.test.data': ['*.*', '*/*.*'], - 'cantera.examples': ['*/*.*'], - 'cantera': ["@py_extension@", '*.pxd'], - }, - zip_safe=False, - python_requires=">=@py_min_ver_str@", -)