cantera/interfaces/cython/setup.py.in
Bryan W. Weber b979cea3d2 Switch Cython and python interfaces to setuptools
Replace distutils with setuptools in the Cython and python_minimal
interfaces. Add console_scripts option to generate OS specific scripts to run
ck2cti, mixmaster, and ctml_writer

Remove script files that are obsoleted by console_scripts from
setuptools. Remove installation of the script modules from SConstruct.

Fix Python installers so that when a prefix directory is specified on the
command line, setuptools doesn't throw an error. The setuptools documentation at
[1] prefers setting PYTHONUSERBASE rather than PYTHONPATH. Use normpath to avoid
bugs in setuptools on Windows [2].  Specify an empty "--prefix" if the compiler
is clang to fix a bug with Homebrew Python on Mac OSX [3].

[1]: https://pythonhosted.org/setuptools/easy_install.html#custom-installation-locations
[2]: http://stackoverflow.com/q/31629398
[3]: https://github.com/Homebrew/homebrew-python/issues/187
2015-08-02 23:06:16 -04:00

59 lines
2.1 KiB
Python

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.3. 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
setup(name="Cantera",
version="@cantera_version@",
description="The Cantera Python Interface",
long_description="""
""",
author="Raymond Speth",
author_email="speth@mit.edu",
url="http://www.cantera.org",
packages = ['cantera',
'cantera.data',
'cantera.test',
'cantera.test.data',
'cantera.mixmaster',
'cantera.mixmaster.Units',
'cantera.examples'],
entry_points={
'console_scripts': [
'ck2cti=cantera.ck2cti:script_entry_point',
'ctml_writer=cantera.ctml_writer:main',
'mixmaster=cantera.mixmaster.__main__:main',
],
},
package_data = {'cantera.data': ['*.*'],
'cantera.test.data': ['*.*'],
'cantera.examples': ['*/*.*'],
'cantera': ["@py_extension@", '*.pxd']})