Skip to content

Commit

Permalink
Merge pull request #2407 from chuckatkins/drop-python2-master
Browse files Browse the repository at this point in the history
Migrate to python3 exclusively
  • Loading branch information
Chuck Atkins authored Aug 7, 2020
2 parents d96750b + f53db5f commit b093a43
Show file tree
Hide file tree
Showing 30 changed files with 1,483 additions and 827 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
sudo: false
language: cpp
dist: xenial
addons:
apt:
update: true
packages:
- python3-pip
env:
matrix:
- BUILD_MATRIX_ENTRY=format
Expand Down
2 changes: 2 additions & 0 deletions CTestCustom.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ list(APPEND CTEST_CUSTOM_WARNING_EXCEPTION
"warning: Using '.*' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking"
"PGC.*compilation completed with warnings"
"Warning: stand-alone `data16' prefix"
"Warning: Type mismatch between actual argument.*"
"Warning: Rank mismatch between actual argument.*"
)
list(APPEND CTEST_CUSTOM_COVERAGE_EXCLUDE
".*/thirdparty/.*"
Expand Down
4 changes: 2 additions & 2 deletions cmake/DetectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,12 @@ if(NOT SHARED_LIBS_SUPPORTED)
endif()

if(ADIOS2_USE_Python STREQUAL AUTO)
find_package(Python COMPONENTS Interpreter Development NumPy)
find_package(Python 3 COMPONENTS Interpreter Development NumPy)
if(Python_FOUND AND ADIOS2_HAVE_MPI)
find_package(PythonModule COMPONENTS mpi4py mpi4py/mpi4py.h)
endif()
elseif(ADIOS2_USE_Python)
find_package(Python REQUIRED COMPONENTS Interpreter Development NumPy)
find_package(Python 3 REQUIRED COMPONENTS Interpreter Development NumPy)
if(ADIOS2_HAVE_MPI)
find_package(PythonModule REQUIRED COMPONENTS mpi4py mpi4py/mpi4py.h)
endif()
Expand Down
102 changes: 83 additions & 19 deletions cmake/upstream/FindPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@ The following components are supported:
* ``Interpreter``: search for Python interpreter.
* ``Compiler``: search for Python compiler. Only offered by IronPython.
* ``Development``: search for development artifacts (include directories and
libraries).
libraries). This component includes two sub-components which can be specified
independently:

* ``Development.Module``: search for artifacts for Python module
developments.
* ``Development.Embed``: search for artifacts for Python embedding
developments.

* ``NumPy``: search for NumPy include directories.

If no ``COMPONENTS`` are specified, ``Interpreter`` is assumed.

If component ``Development`` is specified, it implies sub-components
``Development.Module`` and ``Development.Embed``.

To ensure consistent versions between components ``Interpreter``, ``Compiler``,
``Development`` and ``NumPy``, specify all components at the same time::
``Development`` (or one of its sub-components) and ``NumPy``, specify all
components at the same time::

find_package (Python COMPONENTS Interpreter Development)

Expand All @@ -30,10 +41,11 @@ To manage concurrent versions 3 and 2 of Python, use :module:`FindPython3` and

.. note::

If components ``Interpreter`` and ``Development`` are both specified, this
module search only for interpreter with same platform architecture as the one
defined by ``CMake`` configuration. This contraint does not apply if only
``Interpreter`` component is specified.
If components ``Interpreter`` and ``Development`` (or one of its
sub-components) are both specified, this module search only for interpreter
with same platform architecture as the one defined by ``CMake``
configuration. This contraint does not apply if only ``Interpreter``
component is specified.

Imported Targets
^^^^^^^^^^^^^^^^
Expand All @@ -45,12 +57,12 @@ This module defines the following :ref:`Imported Targets <Imported Targets>`
Python interpreter. Target defined if component ``Interpreter`` is found.
``Python::Compiler``
Python compiler. Target defined if component ``Compiler`` is found.
``Python::Module``
Python library for Python module. Target defined if component
``Development.Module`` is found.
``Python::Python``
Python library for Python embedding. Target defined if component
``Development`` is found.
``Python::Module``
Python library for Python module. Target defined if component ``Development``
is found.
``Development.Embed`` is found.
``Python::NumPy``
NumPy Python library. Target defined if component ``NumPy`` is found.

Expand All @@ -73,42 +85,55 @@ This module will set the following variables in your project
* Anaconda
* Canopy
* IronPython
* PyPy
``Python_STDLIB``
Standard platform independent installation directory.

Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``.
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=True)``
or else ``sysconfig.get_path('stdlib')``.
``Python_STDARCH``
Standard platform dependent installation directory.

Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``.
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=True)``
or else ``sysconfig.get_path('platstdlib')``.
``Python_SITELIB``
Third-party platform independent installation directory.

Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``.
``distutils.sysconfig.get_python_lib(plat_specific=False,standard_lib=False)``
or else ``sysconfig.get_path('purelib')``.
``Python_SITEARCH``
Third-party platform dependent installation directory.

Information returned by
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``.
``distutils.sysconfig.get_python_lib(plat_specific=True,standard_lib=False)``
or else ``sysconfig.get_path('platlib')``.
``Python_SOABI``
Extension suffix for modules.

Information returned by
``distutils.sysconfig.get_config_flag('SOABI')`` or computed from
``distutils.sysconfig.get_config_flag('EXT_SUFFIX')`` or
``python-config --extension-suffix``.
``distutils.sysconfig.get_config_var('SOABI')`` or computed from
``distutils.sysconfig.get_config_var('EXT_SUFFIX')`` or
``python-config --extension-suffix``. If package ``distutils.sysconfig`` is
not available, ``sysconfig.get_config_var('SOABI')`` or
``sysconfig.get_config_var('EXT_SUFFIX')`` are used.
``Python_Compiler_FOUND``
System has the Python compiler.
``Python_COMPILER``
Path to the Python compiler. Only offered by IronPython.
``Python_COMPILER_ID``
A short string unique to the compiler. Possible values include:
* IronPython
``Python_DOTNET_LAUNCHER``
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.
``Python_Development_FOUND``
System has the Python development artifacts.
``Python_Development.Module_FOUND``
System has the Python development artifacts for Python module.
``Python_Development.Embed_FOUND``
System has the Python development artifacts for Python embedding.
``Python_INCLUDE_DIRS``
The Python include directories.
``Python_LIBRARIES``
Expand All @@ -125,6 +150,8 @@ This module will set the following variables in your project
Python minor version.
``Python_VERSION_PATCH``
Python patch version.
``Python_PyPy_VERSION``
Python PyPy version.
``Python_NumPy_FOUND``
System has the NumPy.
``Python_NumPy_INCLUDE_DIRS``
Expand Down Expand Up @@ -237,8 +264,9 @@ Hints
* ``ONLY``: Only the virtual environment is used to look-up for the
interpreter.
* ``STANDARD``: The virtual environment is not used to look-up for the
interpreter. In this case, variable ``Python_FIND_REGISTRY`` (Windows)
or ``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with value ``LAST`` or
interpreter but environment variable ``PATH`` is always considered.
In this case, variable ``Python_FIND_REGISTRY`` (Windows) or
``CMAKE_FIND_FRAMEWORK`` (macOS) can be set with value ``LAST`` or
``NEVER`` to select preferably the interpreter from the virtual
environment.

Expand All @@ -248,6 +276,39 @@ Hints
recommended to also include the component ``Interpreter`` to get expected
result.

``Python_FIND_IMPLEMENTATIONS``
This variable defines, in an ordered list, the different implementations
which will be searched. The ``Python_FIND_IMPLEMENTATIONS`` variable can
hold the following values:

* ``CPython``: this is the standard implementation. Various products, like
``Anaconda`` or ``ActivePython``, rely on this implementation.
* ``IronPython``: This implementation use the ``CSharp`` language for
``.NET Framework`` on top of the `Dynamic Language Runtime` (``DLR``).
See `IronPython <http://ironpython.net>`_.
* ``PyPy``: This implementation use ``RPython`` language and
``RPython translation toolchain`` to produce the python interpreter.
See `PyPy <https://www.pypy.org>`_.

The default value is:

* Windows platform: ``CPython``, ``IronPython``
* Other platforms: ``CPython``

.. note::

This hint has the lowest priority of all hints, so even if, for example,
you specify ``IronPython`` first and ``CPython`` in second, a python
product based on ``CPython`` can be selected because, for example with
``Python_FIND_STRATEGY=LOCATION``, each location will be search first for
``IronPython`` and second for ``CPython``.

.. note::

When ``IronPython`` is specified, on platforms other than ``Windows``, the
``.Net`` interpreter (i.e. ``mono`` command) is expected to be available
through the ``PATH`` variable.

Artifacts Specification
^^^^^^^^^^^^^^^^^^^^^^^

Expand All @@ -260,6 +321,9 @@ setting the following variables:
``Python_COMPILER``
The path to the compiler.

``Python_DOTNET_LAUNCHER``
The ``.Net`` interpreter. Only used by ``IronPython`` implementation.

``Python_LIBRARY``
The path to the library. It will be used to compute the
variables ``Python_LIBRARIES``, ``Python_LIBRAY_DIRS`` and
Expand Down
Loading

0 comments on commit b093a43

Please sign in to comment.