diff --git a/SConstruct b/SConstruct index 7c147190d..5fbbc1d00 100644 --- a/SConstruct +++ b/SConstruct @@ -329,14 +329,16 @@ config_options = [ defaults.prefix, PathVariable.PathAccept), EnumVariable( 'python_package', - """If you plan to work in Python 2, then you need the 'full' Cantera Python + """If you plan to work in Python, then you need the ``full`` Cantera Python package. If, on the other hand, you will only use Cantera from some other language (e.g. MATLAB or Fortran 90/95) and only need Python - to process CTI files, then you only need a 'minimal' subset of the - package and Cython and NumPy are not necessary. The 'none' option - doesn't install any components of the Python interface. The 'default' - behavior is to build the full Python 2 module if the required - prerequisites (NumPy and Cython) are installed.""", + to process CTI files, then you only need a ``minimal`` subset of the + package and Cython and NumPy are not necessary. The ``none`` option + doesn't install any components of the Python interface. The default + behavior is to build the full Python module for whichever version of + Python is running SCons if the required prerequisites (NumPy and + Cython) are installed. Note: ``y`` is a synonym for ``full`` and ``n`` + is a synonym for ``none``.""", 'default', ('new', 'full', 'minimal', 'none', 'n', 'y', 'default')), PathVariable( 'python_cmd', @@ -386,7 +388,7 @@ config_options = [ the empty string or the 'prefix' option is not set, then the package will be installed to the system default 'site-packages' directory. To install to the current user's 'site-packages' directory, use - 'python_prefix=USER'.""", + 'python2_prefix=USER'.""", defaults.python_prefix, PathVariable.PathAccept), EnumVariable( 'python3_package', @@ -415,7 +417,7 @@ config_options = [ the empty string or the 'prefix' option is not set, then the package will be installed to the system default 'site-packages' directory. To install to the current user's 'site-packages' directory, use - 'python_prefix=USER'.""", + 'python3_prefix=USER'.""", defaults.python_prefix, PathVariable.PathAccept), EnumVariable( 'matlab_toolbox', diff --git a/doc/sphinx/compiling/config-options.rst b/doc/sphinx/compiling/config-options.rst index 85df4958a..481529fa3 100644 --- a/doc/sphinx/compiling/config-options.rst +++ b/doc/sphinx/compiling/config-options.rst @@ -76,15 +76,17 @@ Options List .. _python-package: -* ``python_package``: [ ``new`` | ``full`` | ``minimal`` | ``none`` | ``default`` ] - If you plan to work in Python 2, then you need the ``full`` Cantera Python +* ``python_package``: [ ``y`` | ``n`` | ``full`` | ``minimal`` | ``none`` | ``default`` ] + If you plan to work in Python, then you need the ``full`` Cantera Python package. If, on the other hand, you will only use Cantera from some other language (e.g. MATLAB or Fortran 90/95) and only need Python to process CTI files, then you only need a ``minimal`` subset of the package and Cython and NumPy are not necessary. The ``none`` option doesn't install any components of the Python interface. The default - behavior is to build the full Python 2 module if the required - prerequisites (NumPy and Cython) are installed. + behavior is to build the full Python module for whichever version of + Python is running SCons if the required prerequisites (NumPy and + Cython) are installed. Note: ``y`` is a synonym for ``full`` and ``n`` + is a synonym for ``none``. - default: ``'default'`` @@ -101,14 +103,14 @@ Options List * ``python_array_home``: [ ``/path/to/python_array_home`` ] If NumPy was installed using the ``--home`` option, set this to the home - directory for NumPy for Python 2. + directory for NumPy for Python. - default: ``''`` .. _python-prefix: * ``python_prefix``: [ ``/path/to/python_prefix`` ] - Use this option if you want to install the Cantera Python 2 package to + Use this option if you want to install the Cantera Python package to an alternate location. On Unix-like systems, the default is the same as the ``prefix`` option. If the ``python_prefix`` option is set to the empty string or the ``prefix`` option is not set, then the package @@ -118,9 +120,50 @@ Options List - default: ``''`` +.. _python2-package: + +* ``python2_package``: [ ``y`` | ``n`` | ``full`` | ``minimal`` | ``none`` | ``default`` ] + Controls whether or not the Python 2 module will be built. By + default, the module will be built if the Python 2 interpreter + and the required dependencies (NumPy for Python 2 and Cython + for the version of Python for which SCons is installed) can be + found. + + - default: ``'default'`` + +.. _python2-cmd: + +* ``python2_cmd``: [ ``/path/to/python2_cmd`` ] + The path to the Python 2 interpreter. The default is + ``python2``; if this executable cannot be found, this + value must be specified to build the Python 2 module. + + - default: ``'python2'`` + +.. _python2-array-home: + +* ``python2_array_home``: [ ``/path/to/python2_array_home`` ] + If NumPy was installed using the ``--home`` option, set this to the home + directory for NumPy for Python 2. + + - default: ``''`` + +.. _python2-prefix: + +* ``python2_prefix``: [ ``/path/to/python2_prefix`` ] + Use this option if you want to install the Cantera Python 2 package to + an alternate location. On Unix-like systems, the default is the same + as the ``prefix`` option. If the ``python_prefix`` option is set to + the empty string or the ``prefix`` option is not set, then the package + will be installed to the system default ``site-packages`` directory. + To install to the current user's ``site-packages`` directory, use + ``python2_prefix=USER``. + + - default: ``''`` + .. _python3-package: -* ``python3_package``: [ ``y`` | ``n`` | ``default`` ] +* ``python3_package``: [ ``y`` | ``n`` | ``full`` | ``minimal`` | ``none`` | ``default`` ] Controls whether or not the Python 3 module will be built. By default, the module will be built if the Python 3 interpreter and the required dependencies (NumPy for Python 3 and Cython @@ -155,7 +198,7 @@ Options List the empty string or the ``prefix`` option is not set, then the package will be installed to the system default ``site-packages`` directory. To install to the current user's ``site-packages`` directory, use - ``python_prefix=USER``. + ``python3_prefix=USER``. - default: ``''`` diff --git a/doc/sphinx/compiling/configure-build.rst b/doc/sphinx/compiling/configure-build.rst index 6aad50de7..d7e80d61d 100644 --- a/doc/sphinx/compiling/configure-build.rst +++ b/doc/sphinx/compiling/configure-build.rst @@ -54,33 +54,58 @@ Common Options * :ref:`sundials_include ` * :ref:`sundials_libdir ` -Python 2 Module Options -^^^^^^^^^^^^^^^^^^^^^^^ +General Python Module Options +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -By default, SCons will attempt to build the Cython-based Python module for -Python 2, if both Numpy and Cython are installed. The following options control -how the Python 2 module is built: +By default, SCons will try to build the full Python interface for +whichever version of Python is running SCons. This requires that +NumPy is installed for that version of Python, and that Cython is +installed for whichever Python is running SCons. The following SCons +options control how the Python module is built: * :ref:`python_cmd ` * :ref:`python_package ` * :ref:`python_prefix ` +Note that these general options should not be used at the same time +as the Python-version specific options discussed below. If SCons +detects that it is being run with Python 2, and the +:ref:`python2_package ` option to ``none``. + +Python 2 Module Options +^^^^^^^^^^^^^^^^^^^^^^^ + +By default, if SCons detects a Python 2 interpreter installed in a +default location (i.e., ``python2`` is on the ``PATH`` environment +variable) or ``python2_package`` is ``full``, SCons will try to build +the Python module for Python 2. The following SCons options control how +the Python 2 module is built: + +* :ref:`python2_cmd ` +* :ref:`python2_package ` +* :ref:`python2_prefix ` + Python 3 Module Options ^^^^^^^^^^^^^^^^^^^^^^^ -If SCons detects a Python 3 interpreter installed in a default location -(i.e., ``python3`` is on the ``PATH`` environment variable) or -``python3_package`` is ``y``, SCons will try to build the Python module -for Python 3. The following SCons options control how the Python 3 module is -built: +By default, if SCons detects a Python 3 interpreter installed in a +default location (i.e., ``python3`` is on the ``PATH`` environment +variable) or ``python3_package`` is ``full``, SCons will try to build +the Python module for Python 3. The following SCons options control how +the Python 3 module is built: * :ref:`python3_cmd ` * :ref:`python3_package ` * :ref:`python3_prefix ` -Note that even when building the Python 3 Cantera module, you should still use -Python 2 with SCons, as SCons does not currently support Python 3. - Windows Only Options ^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/sphinx/compiling/special-cases.rst b/doc/sphinx/compiling/special-cases.rst index 78dafd607..7e08fb679 100644 --- a/doc/sphinx/compiling/special-cases.rst +++ b/doc/sphinx/compiling/special-cases.rst @@ -48,5 +48,5 @@ Intel Compilers Another option is to set the :ref:`prefix ` option to a directory for which you have write permissions, and specify the ``USER`` value to the - :ref:`python_prefix ` or :ref:`python3_prefix ` + :ref:`python2_prefix ` or :ref:`python3_prefix ` option.