Skip to content

Commit

Permalink
[Python Minimal] Use setup.cfg configuration
Browse files Browse the repository at this point in the history
This change provides similar benefits as for the other two Python
distributions. It should allow easier uploading to PyPI and now includes
the README and License files.
  • Loading branch information
bryanwweber committed Nov 24, 2021
1 parent e171143 commit 0079ee8
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 31 deletions.
4 changes: 3 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ if "clean" in COMMAND_LINE_TARGETS:
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("interfaces/python_minimal/setup.cfg")
remove_file("interfaces/python_minimal/LICENSE.txt")
remove_file("interfaces/python_minimal/README.rst")
remove_file("config.log")
remove_directory("doc/sphinx/matlab/examples")
remove_file("doc/sphinx/matlab/examples.rst")
Expand Down
5 changes: 3 additions & 2 deletions interfaces/python_minimal/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
setup*.py
scripts/*
cantera/ck2cti.py
cantera/ctml_writer.py
cantera/ck2yaml.py
Expand All @@ -8,3 +6,6 @@ cantera/ctml2yaml.py
build
dist
Cantera_minimal.egg-info
LICENSE.txt
README.rst
setup.cfg
23 changes: 15 additions & 8 deletions interfaces/python_minimal/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,30 @@ Import('env', 'build', 'install')

localenv = env.Clone()

make_setup = build(localenv.SubstFile('setup.py', 'setup.py.in'))
make_setup = build(localenv.SubstFile("setup.cfg", "setup.cfg.in"))

# copy scripts from the full Cython module
for script in ['ctml_writer', 'ck2cti', 'ck2yaml', 'cti2yaml', 'ctml2yaml']:
for script in ["ctml_writer", "ck2cti", "ck2yaml", "cti2yaml", "ctml2yaml"]:
# The actual script
s = build(env.Command('cantera/{}.py'.format(script),
'#interfaces/cython/cantera/{}.py'.format(script),
Copy('$TARGET', '$SOURCE')))
s = build(env.Command(f"cantera/{script}.py",
f"#interfaces/cython/cantera/{script}.py",
Copy("$TARGET", "$SOURCE")))
localenv.Depends(make_setup, s)

build_cmd = ('cd interfaces/python_minimal &&'
' $python_cmd_esc setup.py build --build-lib=../../build/python')
build_cmd = ("cd interfaces/python_minimal && "
"$python_cmd_esc setup.py build --build-base=../../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

readme = localenv.Command("README.rst", "#README.rst", Copy("$TARGET", "$SOURCE"))
# The target of this command must match the file listed in setup.cfg.in
license = localenv.Command("LICENSE.txt", "#License.txt",
Copy("$TARGET", "$SOURCE"))
localenv.Depends(license, localenv["license_target"])
localenv.Depends(mod, [make_setup, readme, license])

if localenv['PYTHON_INSTALLER'] == 'direct':
if localenv['python_prefix'] == 'USER':
# Install to the OS-dependent user site-packages directory
Expand Down
49 changes: 49 additions & 0 deletions interfaces/python_minimal/setup.cfg.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[metadata]
name = Cantera_minimal
version = @cantera_version@
description = A minimal Cantera interface, containing only the input file conversion scripts
long_description = This Cantera interface contains the conversion scripts for input files into the Cantera format. For the full Python interface, please see [Cantera](https://pypi.org/project/cantera).
long_description_content_type = text/markdown
license_files = LICENSE.txt
url = https://cantera.org
author = Cantera Developers
author_email = developers@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 :: Python :: 3 :: Only
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
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 = True
install_requires =
numpy >= 1.12.0
ruamel.yaml >= 0.15.34
python_requires = >=@py_min_ver_str@
packages =
cantera

[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
3 changes: 3 additions & 0 deletions interfaces/python_minimal/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from setuptools import setup

setup()
20 changes: 0 additions & 20 deletions interfaces/python_minimal/setup.py.in

This file was deleted.

0 comments on commit 0079ee8

Please sign in to comment.