μHAL (v2.8.17)
Part of the IPbus software repository
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Functions | Variables
pybind11.setup_helpers Namespace Reference

Classes

class  build_ext
 
class  ParallelCompile
 
class  Pybind11Extension
 

Functions

def tmp_chdir ()
 
def has_flag (compiler, flag)
 
def auto_cpp_level (compiler)
 
def intree_extensions (paths, package_dir=None)
 
def naive_recompile (obj, src)
 
def no_recompile (obg, src)
 
bool has_flag (Any compiler, str flag)
 
Union[str, int] auto_cpp_level (Any compiler)
 
List[Pybind11Extensionintree_extensions (Iterable[str] paths, Optional[Dict[str, str]] package_dir=None)
 
bool naive_recompile (str obj, str src)
 
bool no_recompile (str obg, str src)
 

Variables

string WIN = sys.platform.startswith("win32") and "mingw" not in sysconfig.get_platform()
 
int PY2 = sys.version_info[0] < 3
 
 MACOS = sys.platform.startswith("darwin")
 
string STD_TMPL = "/std:c++{}" if WIN else "-std=c++{}"
 
 tmp_chdir_lock = threading.Lock()
 
 cpp_cache_lock = threading.Lock()
 
 cpp_flag_cache = None
 
 S = TypeVar("S", bound="ParallelCompile")
 
 CCompilerMethod
 

Detailed Description

This module provides helpers for C++11+ projects using pybind11.

LICENSE:

Copyright (c) 2016 Wenzel Jakob <wenzel.jakob@epfl.ch>, All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
   may be used to endorse or promote products derived from this software
   without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Function Documentation

◆ auto_cpp_level() [1/2]

Union[str, int] pybind11.setup_helpers.auto_cpp_level ( Any  compiler)
Return the max supported C++ std level (17, 14, or 11). Returns latest on Windows.

Definition at line 256 of file setup_helpers.py.

References pybind11.setup_helpers.has_flag().

◆ auto_cpp_level() [2/2]

def pybind11.setup_helpers.auto_cpp_level (   compiler)
Return the max supported C++ std level (17, 14, or 11). Returns latest on Windows.

Definition at line 262 of file setup_helpers.py.

References pybind11.setup_helpers.has_flag().

Referenced by pybind11.setup_helpers.build_ext.build_extensions().

◆ has_flag() [1/2]

bool pybind11.setup_helpers.has_flag ( Any  compiler,
str  flag 
)
Return the flag if a flag name is supported on the
specified compiler, otherwise None (can be used as a boolean).
If multiple flags are passed, return the first that matches.

Definition at line 232 of file setup_helpers.py.

References pybind11.setup_helpers.tmp_chdir().

◆ has_flag() [2/2]

def pybind11.setup_helpers.has_flag (   compiler,
  flag 
)
Return the flag if a flag name is supported on the
specified compiler, otherwise None (can be used as a boolean).
If multiple flags are passed, return the first that matches.

Definition at line 238 of file setup_helpers.py.

References pybind11.setup_helpers.tmp_chdir().

Referenced by pybind11.setup_helpers.auto_cpp_level().

◆ intree_extensions() [1/2]

List[Pybind11Extension] pybind11.setup_helpers.intree_extensions ( Iterable[str paths,
Optional[Dict[str, str]]   package_dir = None 
)
Generate Pybind11Extensions from source files directly located in a Python
source tree.

``package_dir`` behaves as in ``setuptools.setup``.  If unset, the Python
package root parent is determined as the first parent directory that does
not contain an ``__init__.py`` file.

Definition at line 293 of file setup_helpers.py.

◆ intree_extensions() [2/2]

def pybind11.setup_helpers.intree_extensions (   paths,
  package_dir = None 
)
Generate Pybind11Extensions from source files directly located in a Python
source tree.

``package_dir`` behaves as in ``setuptools.setup``.  If unset, the Python
package root parent is determined as the first parent directory that does
not contain an ``__init__.py`` file.

Definition at line 311 of file setup_helpers.py.

◆ naive_recompile() [1/2]

def pybind11.setup_helpers.naive_recompile (   obj,
  src 
)
This will recompile only if the source file changes. It does not check
header files, so a more advanced function or Ccache is better if you have
editable header files in your package.

Definition at line 347 of file setup_helpers.py.

◆ naive_recompile() [2/2]

bool pybind11.setup_helpers.naive_recompile ( str  obj,
str  src 
)
This will recompile only if the source file changes. It does not check
header files, so a more advanced function or Ccache is better if you have
editable header files in your package.

Definition at line 335 of file setup_helpers.py.

◆ no_recompile() [1/2]

def pybind11.setup_helpers.no_recompile (   obg,
  src 
)
This is the safest but slowest choice (and is the default) - will always
recompile sources.

Definition at line 356 of file setup_helpers.py.

◆ no_recompile() [2/2]

bool pybind11.setup_helpers.no_recompile ( str  obg,
str  src 
)
This is the safest but slowest choice (and is the default) - will always
recompile sources.

Definition at line 344 of file setup_helpers.py.

◆ tmp_chdir()

def pybind11.setup_helpers.tmp_chdir ( )

Definition at line 222 of file setup_helpers.py.

Referenced by pybind11.setup_helpers.has_flag().

Variable Documentation

◆ CCompilerMethod

pybind11.setup_helpers.CCompilerMethod
Initial value:
1= Callable[
2 [
3 distutils.ccompiler.CCompiler,
4 List[str],
5 Optional[str],
6 Optional[Union[Tuple[str], Tuple[str, Optional[str]]]],
7 Optional[List[str]],
8 bool,
9 Optional[List[str]],
10 Optional[List[str]],
11 Optional[List[str]],
12 ],
13 List[str],
14]

Definition at line 354 of file setup_helpers.py.

◆ cpp_cache_lock

pybind11.setup_helpers.cpp_cache_lock = threading.Lock()

Definition at line 218 of file setup_helpers.py.

◆ cpp_flag_cache

pybind11.setup_helpers.cpp_flag_cache = None

Definition at line 259 of file setup_helpers.py.

◆ MACOS

pybind11.setup_helpers.MACOS = sys.platform.startswith("darwin")

Definition at line 65 of file setup_helpers.py.

◆ PY2

int pybind11.setup_helpers.PY2 = sys.version_info[0] < 3

Definition at line 64 of file setup_helpers.py.

◆ S

pybind11.setup_helpers.S = TypeVar("S", bound="ParallelCompile")

Definition at line 352 of file setup_helpers.py.

◆ STD_TMPL

string pybind11.setup_helpers.STD_TMPL = "/std:c++{}" if WIN else "-std=c++{}"

Definition at line 66 of file setup_helpers.py.

◆ tmp_chdir_lock

pybind11.setup_helpers.tmp_chdir_lock = threading.Lock()

Definition at line 217 of file setup_helpers.py.

◆ WIN

string pybind11.setup_helpers.WIN = sys.platform.startswith("win32") and "mingw" not in sysconfig.get_platform()

Definition at line 63 of file setup_helpers.py.