Something changed in setuptools that causes the old method of forcing
platform-specific wheels to be built to break for certain configurations
(specifically, Windows builds with Python 3.7). This alternative approach
appears to be more robust.
Also increase the logging from 'pip wheel' to help with debugging
This change mirrors the one for the Cython interface. Pip is used as
the build frontend, setuptools is used as the backend. A wheel file is
built during the 'scons build' phase to ensure that all the machinery is
working properly; this wheel is not used further.
Setuptools versions greater than 60.0.0 deprecate using setup.py install
commands, in preference for PEP 517/518 build backends/frontends. In
this case, we're using pip as the frontend and setuptools as the
backend.
This also uses pip to determine the installation location for the
module. It uses pip's internal API which is subject to change. However,
pip does not expose an external API to get this information, and since
Pip is the one determining where files will be installed, this seems the
most reasonable approach for now.
* -vec-report0 is deprecated
* -diag-disable 1478 is not needed (has no effect)
* `Wcheck` (perform compile-time code checking for certain code) is
changed to to `Wall` (enable warning and error diagnostics) as most
warnings are due to upstream issues in fmtlib
* disable fast math optimization
Beyond, fix CYTHON_FALLTHROUGH for icc
For some versions of Python, the DLL module extension included in the
sysconfig module is not correct. In that case, the file extension needs
to be constructed manually.
To make this information easier to get to, the JSON module is used to
parse data returned by sysconfig from the Python which will be building
the module.
This change mirrors the one for the source distribution. This change
results in a non-executable template file
(setup.cfg.in), which makes edits easier.
This change
removes the requirement to template the Python extension into setup.py,
and adds a Setuptools extension module. This results in correct builds
when bdist_wheel is specified and uses package_data properly.
The sysconfig module is available since Python 3.2. Distutils is
deprecated and slated for removal from Python in the next few years.
Likewise, the "SO" config variable has been deprecated for some time and
was slated for removal in Python 3.8, although that seems not to have
happened.
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.