Commit Graph

66 Commits

Author SHA1 Message Date
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
Ray Speth
c621d5f9db [SCons] Fix dependency resolution for some Python files 2014-05-07 21:56:57 +00:00
Ray Speth
6e72f8930f [SCons] Fix Cython module compilation with MinGW 2014-02-24 03:25:30 +00:00
Ray Speth
3e073aae27 [SCons] Force relink of Python extension when necessary 2014-02-21 19:07:58 +00:00
Ray Speth
aad284cce7 [SCons] Fix library linking issues under Cygwin 2014-02-20 03:01:01 +00:00
Ray Speth
eaceaf7b86 [SCons] Use SCons to compile the Cython extension
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.
2014-01-31 23:15:17 +00:00
Ray Speth
d4a9ca0847 [SCons] Fix simultaneous compilation of Python 2 and Python 3 modules
Use separate SCons Environments so the 'py_include_dirs' variable (which
contains the Numpy include directory) can be distinct for each Python module.
2014-01-30 00:48:03 +00:00
Ray Speth
b5e540c903 [Python] Remove the legacy Python module 2013-12-09 01:35:08 +00:00
Ray Speth
6d5b7999de [SCons] Use specified 'python_compiler' to link Python module
Fixes Issue 179.
2013-10-15 17:06:35 +00:00
Ray Speth
f871dd8cf0 [SCons] Add 'python_compiler' option for Cython module compilation 2013-10-15 14:59:31 +00:00
Ray Speth
2de0ae6350 [SCons/Cython] Fix library_dirs to include BLAS/LAPACK directory 2013-09-30 01:54:12 +00:00
Ray Speth
1cedf904df [Doc] Add all Python examples to the Sphinx docs 2013-08-22 21:46:27 +00:00
Ray Speth
32ea4fd924 [SCons] Fix to skip Python startup messages
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.
2013-08-16 17:25:04 +00:00
Ray Speth
a22ceda566 [Scons] Fix build order dependencies for python modules 2013-08-14 17:55:51 +00:00
Ray Speth
f320290c51 [SCons] Fix Python module path in setup_cantera and post-install message
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.
2013-07-29 01:37:57 +00:00
Ray Speth
a616d4f55f [Test] Fix dependencies so Cython tests run after rebuilding 2013-07-16 22:09:53 +00:00
Ray Speth
4591159cd9 [SCons] Install script for running MixMaster with new Python module 2013-06-21 20:59:00 +00:00