Commit Graph

82 Commits

Author SHA1 Message Date
Ray Speth
d30b76a96a Fix errors due to setuptools 61.0
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
2022-03-29 22:42:02 -04:00
Ray Speth
1bed0f9b56 [SCons] Fix expected name of .whl file
On macOS, sysconfig.get_platform() returns a string like
'macosx-11.0-arm64', but the wheel filename will actually contain
'macosx_11_0_arm64'.
2022-03-29 22:42:02 -04:00
Bryan Weber
98437271e4 [SCons/Cython] Fix install prefix
If the prefix is set, the Python package should be installed there.
2022-03-23 13:38:09 -04:00
Bryan Weber
66f270f1a3 Flake8/quotes stuff 2022-03-23 13:38:09 -04:00
Bryan Weber
cfc5ee6a3f [SCons] Python minimal uses pip to install
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.
2022-03-23 13:38:09 -04:00
Bryan Weber
5567c71f19 [SCons/Cython] Use pip to build/install interface
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.
2022-03-23 13:38:09 -04:00
Bryan Weber
7ad2c6d2c8 [Cython] Remove bdist_win installer
The Windows binary MSI distribution is deprecated by Python. The
replacement is wheels which are now working.
2022-03-23 13:38:09 -04:00
Bryan Weber
e6448b2e6f [Cython] Remove unnecessary install option
This option was added to support Python 2/3 with Homebrew on Mac OS X.
As Python 2 is no longer supported, this line is no longer needed.
2022-03-23 13:38:09 -04:00
Bryan Weber
4b8e28c126 [SCons/Cython] Remove Darwin prefix setting
This line was added to fix a problem with Python 2 [1,2] in Homebrew
circa 2015 via b979cea. That fix is no longer needed in 2022.

[1]: https://web.archive.org/web/20190629053857/https://github.com/Homebrew/homebrew-python/issues/187
[2]: https://web.archive.org/web/20200221230523/https://bugs.python.org/issue22269
2022-03-23 13:38:09 -04:00
Ray Speth
367d701873 [SCons] Fix script installation path on Fedora 36
Python scripts like ck2yaml were being installed to /usr/local/bin instead
of /usr/bin.

Fixes #1149
2022-01-16 10:27:31 -06:00
Ingmar Schoegl
98b87609f9 [SCons] Change icc compilation options
* -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
2021-12-08 13:59:31 -05:00
Mark E. Fuller
d5e075ac1e make explicit py_version_short 2021-12-02 12:44:11 -05:00
Bryan W. Weber
7f350156ae [Cython] Fix Windows builds
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.
2021-11-26 14:56:00 -05:00
Bryan Weber
bc539f4273 [Cython] Use setup.cfg to configure the package
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.
2021-11-26 14:56:00 -05:00
Bryan Weber
b07ad9e055 [Cython] Scope hypot redefinition
The bug was fixed in Python 3.7.3, so it no longer required.
2021-11-26 14:56:00 -05:00
Bryan Weber
6b58ecb8f4 [Cython] Import sysconfig directly
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.
2021-11-26 14:56:00 -05:00
Ray Speth
29587eeba5 [SCons] Improve staged installations of Python module
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
2021-09-20 12:33:47 -04:00
Bryan Weber
27696feab8 Rename mglob function to multi_glob 2021-05-04 21:36:21 -04:00
Bryan Weber
edf5e4cc77 Limit exported functions from buildutils
Each SConscript module imports what it needs from the stdlib.
2021-05-04 21:36:21 -04:00
Bryan Weber
f5dc022b33 Rename and refactor get_command_output 2021-05-04 21:36:21 -04:00
Raymond Speth
c9811e8e0a [SCons] Suppress deprecation warnings caused by Cython
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.
2021-02-05 11:29:55 -05:00
Raymond Speth
777e099f7e [SCons] Use version-parsing function from pkg_resources
The old distutils.version.StrictVersion function doesn't understand
some modern version strings.
2021-01-21 12:06:09 -05:00
Ingmar Schoegl
a9a3a4af85 [scons] Fix formatting / update Python example folders
- Make path separators consistent on Windows post-install message
- Update list of Python example folders
2020-08-20 13:40:18 -04:00
band-a-prend
24599b86c1 [SCons] Fix 'KeyError' for ' --prefix=${python_prefix}'
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
2020-03-24 17:56:42 -04:00
Ingmar Schoegl
53eca8e559 [Input] Move remaining chemkin input files to test/data 2020-02-04 21:34:15 -05:00
Bryan W. Weber
484441a675 [SCons/Cython] Disable deprecation warnings for clang
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.
2019-12-10 14:04:00 -05:00
Ingmar Schoegl
a85396ef11 [Input/Scons] make gri30 consistent with latest online version
Updated version keeps input and thermo separate, which requires minor
changes in the build scripts.
2019-10-29 21:00:36 -04:00
band-a-prend
582eb42b2f cantera: Fix passing 'python_prefix' variable into installation path
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
2019-08-01 15:53:20 -04:00
Ray Speth
33591282f5 [SCons] Use Cython from the targeted copy of Python
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).
2018-09-19 17:59:59 -04:00
Ray Speth
d6da006e3e [SCons] Only build the Python package for Python 3.x 2018-09-19 17:59:59 -04:00
Bryan W. Weber
2f03a1e531 Reformat postInstallMessage code to be easier to read in SConstruct 2017-11-26 16:48:40 -05:00
Bryan W. Weber
77ee76c5f3 Simplify checking for 3to2
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.
2017-11-26 16:48:40 -05:00
Bryan W. Weber
94ea9b585f Update SConstruct to recognize that Python 3 might be running SCons
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.
2017-11-26 16:48:40 -05:00
Ray Speth
70e10632d4 [SCons] Fix implicit dependencies on 'build' step
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.
2017-02-17 11:51:12 -05:00
Ray Speth
886d7b7cdc Move MixMaster into a separate Python module and Git repository
MixMaster has been moved to https://github.com/Cantera/mixmaster
2017-01-20 16:16:32 -05:00
Ray Speth
4b974219b5 [SCons] Fix installation location for Debian Python packages 2017-01-12 20:23:58 -05:00
Bryan W. Weber
2024d0f08a [SCons] Fix calling 3to2 on Windows with conda 3to2 package
Fixes #408
2016-12-09 20:13:22 -05:00
Bryan W. Weber
ea4b3502c3 [Cython/Test] Install extra data files from main data directory 2016-11-10 15:16:10 -05:00
Ray Speth
e70e5bf5be [SCons] Fix default Python module installation path on Debian/Ubuntu
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.
2016-07-29 14:52:42 -04:00
Ray Speth
feca44aa2d [SCons] Install to lib64 directory on operating systems that use this
Resolves #318.
2016-07-25 14:42:46 -04:00
Ray Speth
03db1d3942 [SCons] Fix installation location for Python module location on OS X
Fixes #296
2015-11-13 20:51:16 -05:00
Ray Speth
1f1f14b523 Fix MinGW compilation error in C++11 mode 2015-10-14 18:45:22 -04:00
Ray Speth
2b7bcf2b3e [Python] Prevent renaming of Python extension module
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'.
2015-08-13 22:22:33 -04:00
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
Ray Speth
07f25621f3 [SCons] Fix include order when compiling Cython module 2015-07-01 12:24:49 -04:00
Ray Speth
e94ec95988 [Python] Specify python executable to be used in shebang line for scripts
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.
2015-01-06 23:37:30 +00:00
Ray Speth
da35e24151 [SCons] Re-cythonize after changes to header files 2014-10-29 15:36:28 +00:00
Bryan W. Weber
eeab08d683 Allow auto conversion of Python examples on Windows
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.
2014-08-25 18:41:56 +00:00
Ray Speth
4f3dd0624f [SCons] Fix build errors when path to Python contains spaces 2014-07-25 18:32:54 +00:00
Ray Speth
217b396ec5 [Python] Fix to conversion of samples from Python 3 to Python 2
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.
2014-05-23 22:46:59 +00:00