Switch to importing the lib3to2 as a check, which is platform agnostic
and doesn't depend on how 3to2 was installed. Also, take advantage of
the fact that the 3to2 converter recurses by default to avoid spawning
a bunch of subprocesses. Finally, don't depend on the location of the
3to2 script and just use the library directly to do the conversion.
Update and make more consistent the specification of Python package
building. Since SCons can be run by Python 3 now, we cannot assume that
the Python running SCons is Python 2. This changes a bunch of
assumptions in SConstruct about where things should be built or
installed. This commit addresses those assumptions by making the options
for Python 2 and Python 3 symmetric.
The 'install' and 'test' targets had some undeclared dependencies on the 'build'
target, such that running 'scons install' or 'scons test' without having first
run 'scons build' would result in incomplete installation or test failures,
respectively.
Fixes#432.
If Cantera is being installed to /usr/local, then on Debian-based distros, we
want the Python module to end up in /usr/local/lib/pythonX.Y/dist-packages,
which is actually the default behavior. However, /usr/local/... is *not* the
default installation prefix for Python modules on some other distros (On Fedora,
at least, it's /usr/) so using the default needs to be conditioned on the actual
distro.
In Cygwin, some versions of SCons append a 'cyg' prefix to DLL names, which
breaks the Python extension module that is supposed to be named just
'_cantera.dll'.
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
This fixes a bug in the Windows installer where the path to python.exe on the
machine where the installer is built is used, and also allows us generate
different shebang lines for the Python 2 and Python 3 modules.
Fixes Issue 247.
3to2 cannot be called as an executable on Windows, but it can be called
as a script. Assume that the 3to2 script is installed in
PYTHONROOT\Scripts, which is the default for installation by pip.
Some calls to the print function weren't being converted to print statements
correctly by 3to2, so now we use the alternative fix, which is to use the
backported print function.
Fixes Issue 216.
Fixes issues with mismatched compilers between the Cython extension and the
cantera library, especially on OS X. Improves build dependency resolution to
eliminate unnecessary recompilation of _cantera.cpp.
This fixes an issue when the Python interpreter prints startup messages that
appear before the expected output lines. Known to be a problem with the Anaconda
Python distribution.
In particular, this fixes paths for Linux distros that put Python modules in
'lib64/pythonX.Y/site-packages'.
Also fixes the reported installation path for the Python module on Windows.
Setting the scons options 'python_prefix=USER' or 'python3_prefix=USER' will
pass the '--user' flag to setup.py, causing the Python module to be installed to
a platform-specific directory on the user's module path.
This includes automatic conversion of the samples from Python 3 syntax to Python
2 syntax when building the Python 2 version of the module and the "3to2" script
is available.