xopto.util.build module

build_so_dll(*args, cc: Optional[str] = None, **kwargs)bool[source]

Build a dll or so library using the available native compiles.

Parameters
  • args (list) – Positional parameters passed to the DLL / SO build function.

  • kwargs (dict) – Keyword parameters passed to the DLL / SO build function.

Returns

res – True on success, else False.

Return type

bool

find_compilers()[source]
find_gcc()[source]

Find a version of installed GCC that matches the number OS bits (32 or 64).

find_gcc_32(gcc='gcc')[source]

Returns version of the installed 32-bit GCC compiler or None.

find_gcc_64(gcc='gcc')str[source]

Returns version of the installed 64-bit GCC compiler or None.

find_mingw()str[source]

Returns the version of installed MINGW compiller or None. If the underlaying OS is 32-bit, only 32-bit compilers are considered, else only 64-bit compilers are considered.

find_mingw_32(gcc='gcc')str[source]

Returns the version of installed 32-bit compiller or None.

find_mingw_64(gcc='gcc')str[source]

Returns the version of installed 32-bit MINGW compiller or None.

find_msvcver(supported: Optional[list] = None, allver: bool = False)str[source]

Find a version of installed MSC build tools.

Parameters
  • allver (bool) – If True, all the found versions are returned, else only the highest version is returned.

  • supported (list) – Optional list of supported MSC build tool versions.

Returns

ver – A list of found MSC build tools if allver is True, else only the highest found version. Returns [] if no MSC build tools are found.

Return type

str

find_msvsver(supported=None, allver=False)[source]

Find a version of installed Visual studio tools.

Parameters
  • allver (bool) – If True, all the found versions are returned, else only the highest version is returned.

  • supported (list) – Optional list of supported MSC build tool versions.

Returns

ver – A list of found Visual Studio installations if allver is True, else only the highest found version. Returns [] if no MSC build tools are found.

Return type

str

gcc_build_so_dll(srclist, inclist=None, liblist=None, libdirlist=None, target=None, deflist=None, gcc='gcc', opt='-O2', soname=None, std=None, implib=False, moveto=None, cwd=None, verbose=False, envvars=None, keepscript=False, shell='bash')[source]

Builds a DLL (SO) using GCC.

mingw_build_dll(srclist, inclist=None, liblist=None, libdirlist=None, target=None, deflist=None, ccopts='', gcc='gcc', opt='-O2', std=None, implib=False, moveto=None, cwd=None, verbose=False, envvars=None, keepscript=False)[source]

Builds a DLL using MIGW tools.

msvc_build_dll(srclist, msvcver=None, target=None, ccopts='', inclist=None, deflist=None, libdirlist=None, liblist=None, verbose=False, envvars=None, cwd=None, moveto=None, implib=False, automachine=True, keepscript=False)[source]

Builds a DLL using MSC build tools.

msvcver2vs(msvcver)[source]
os_bits()int[source]

Returns 32 for 32-bit OS, 64 for 64-bit OS.

subprocess_cmd(command: list, verbose: bool = False, **kwargs)str[source]

Execute a command using subprocess.Popen.

Parameters
  • command (list) – List of str that represent the command and all the arguments.

  • verbose (bool) – Turn on verbose reporting.

  • kwargs (dict) – Keyword arguments passed to subprocess.Popen.__init__().

Returns

err – Error from stderr if any.

Return type

str