Fixes setup_cantera and the post-install message to reference the path
of the Python module on the target system rather than the staging
directory.
Also, generated .pyc files no long specify the path in the staging
directory. This has no effect on the use of the .pyc files, but helps
avoid warnings/errors from packaging system linters (notably, on
FreeBSD).
Fixes#1094
The deprecation warnings previously observed only on macOS are also
emitted when using Clang 10.0 on Linux. Also, despite supposedly being
resolved in Cython 0.29.14, I still get these warnings in Cython
0.29.21.
The '.format()' method is applied after concatenation of two parts of string
in 'localenv.subst()' function so the '{python_prefix}' in the first sunstring
was assumed as 'format' mapping key instead of env variable '${python_prefix}'.
See early commit: https://github.com/Cantera/cantera/commit/582eb42
The clang compiler on macOS prints a number of warnings about deprecated
fields in the CPython 3.8 API. These warnings are spurious because they
are caused by Cython and will be handled in a future release for Python
3.9. They also appear to only occur on macOS.
The '${python_prefix}' substring for installation prefix path
was accepted as mapping key for '.format()' function resulting in
a 'KeyError' failure of 'cantera/interfaces/cython/SConscript' script
in case of `env[libdirname] == 'lib64'`.
Moreover the early applied pull request[1] didn't take into account
the additional setting of installation prefix path in the cases
when 'libdirname' takes values different from 'lib64'.
This patch resolves both those issues.
[1]: https://github.com/Cantera/cantera/pull/661
Use the Cython module from the Python installation specified by
'python_cmd', rather than the Python installation that is running
SCons. This allows complilation of Cantera for Python versions that
aren't supported by SCons (e.g. Python 3.4).
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.