SCons.Platform package#

Submodules#

SCons.Platform.aix module#

Platform-specific initialization for IBM AIX systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.aix.generate(env) None[source]#
SCons.Platform.aix.get_xlc(env, xlc=None, packages=[])[source]#

SCons.Platform.cygwin module#

Platform-specific initialization for Cygwin systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.cygwin.generate(env) None[source]#

SCons.Platform.darwin module#

Platform-specific initialization for Mac OS X systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.darwin.generate(env) None[source]#

SCons.Platform.hpux module#

Platform-specific initialization for HP-UX systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.hpux.generate(env) None[source]#

SCons.Platform.irix module#

Platform-specific initialization for SGI IRIX systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.irix.generate(env) None[source]#

SCons.Platform.mingw module#

Platform-specific initialization for the MinGW system.

SCons.Platform.os2 module#

Platform-specific initialization for OS/2 systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.os2.generate(env) None[source]#

SCons.Platform.posix module#

Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.posix.escape(arg)[source]#

escape shell special characters

SCons.Platform.posix.exec_popen3(l, env, stdout, stderr)[source]#
SCons.Platform.posix.exec_subprocess(l, env)[source]#
SCons.Platform.posix.generate(env) None[source]#
SCons.Platform.posix.piped_env_spawn(sh, escape, cmd, args, env, stdout, stderr)[source]#
SCons.Platform.posix.subprocess_spawn(sh, escape, cmd, args, env)[source]#

SCons.Platform.sunos module#

Platform-specific initialization for Sun systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

SCons.Platform.sunos.generate(env) None[source]#

SCons.Platform.virtualenv module#

‘Platform” support for a Python virtualenv.

SCons.Platform.virtualenv.ImportVirtualenv(env) None[source]#

Copies virtualenv-related environment variables from OS environment to env['ENV'] and prepends virtualenv’s PATH to env['ENV']['PATH'].

SCons.Platform.virtualenv.IsInVirtualenv(path)[source]#

Returns True, if path is under virtualenv’s home directory. If not, or if we don’t use virtualenv, returns False.

SCons.Platform.virtualenv.Virtualenv()[source]#

Returns path to the virtualenv home if scons is executing within a virtualenv or None, if not.

SCons.Platform.virtualenv._enable_virtualenv_default()[source]#
SCons.Platform.virtualenv._ignore_virtualenv_default()[source]#
SCons.Platform.virtualenv._inject_venv_path(env, path_list=None) None[source]#

Modify environment such that SCons will take into account its virtualenv when running external tools.

SCons.Platform.virtualenv._inject_venv_variables(env) None[source]#
SCons.Platform.virtualenv._is_path_in(path, base) bool[source]#

Returns true if path is located under the base directory.

SCons.Platform.virtualenv._running_in_virtualenv()[source]#

Returns True if scons is executed within a virtualenv

SCons.Platform.virtualenv.select_paths_in_venv(path_list)[source]#

Returns a list of paths from path_list which are under virtualenv’s home directory.

SCons.Platform.win32 module#

Platform-specific initialization for Win32 systems.

There normally shouldn’t be any need to import this module directly. It will usually be imported through the generic SCons.Platform.Platform() selection method.

class SCons.Platform.win32.ArchDefinition(arch, synonyms=[])[source]#

Bases: object

Determine which windows CPU were running on. A class for defining architecture-specific settings and logic.

SCons.Platform.win32.escape(x)[source]#
SCons.Platform.win32.exec_spawn(l, env)[source]#
SCons.Platform.win32.generate(env)[source]#
SCons.Platform.win32.get_architecture(arch=None)[source]#

Returns the definition for the specified architecture string.

If no string is specified, the system default is returned (as defined by the registry PROCESSOR_ARCHITECTURE value, PROCESSOR_ARCHITEW6432 environment variable, PROCESSOR_ARCHITECTURE environment variable, or the platform machine).

SCons.Platform.win32.get_program_files_dir()[source]#

Get the location of the program files directory

SCons.Platform.win32.get_system_root()[source]#
SCons.Platform.win32.piped_spawn(sh, escape, cmd, args, env, stdout, stderr)[source]#
SCons.Platform.win32.spawn(sh, escape, cmd, args, env)[source]#
SCons.Platform.win32.spawnve(mode, file, args, env)[source]#

Module contents#

SCons platform selection.

Looks for modules that define a callable object that can modify a construction environment as appropriate for a given platform.

Note that we take a more simplistic view of “platform” than Python does. We’re looking for a single string that determines a set of tool-independent variables with which to initialize a construction environment. Consequently, we’ll examine both sys.platform and os.name (and anything else that might come in to play) in order to return some specification which is unique enough for our purposes.

Note that because this subsystem just selects a callable that can modify a construction environment, it’s possible for people to define their own “platform specification” in an arbitrary callable function. No one needs to use or tie in to this subsystem in order to roll their own platform definition.

SCons.Platform.DefaultToolList(platform, env)[source]#

Select a default tool list for the specified platform.

SCons.Platform.Platform(name='darwin')[source]#

Select a canned Platform specification.

class SCons.Platform.PlatformSpec(name, generate)[source]#

Bases: object

class SCons.Platform.TempFileMunge(cmd, cmdstr=None)[source]#

Bases: object

Convert long command lines to use a temporary file.

You can set an Environment variable (usually TEMPFILE) to this, then call it with a string argument, and it will perform temporary file substitution on it. This is used to circumvent limitations on the length of command lines. Example:

env["TEMPFILE"] = TempFileMunge
env["LINKCOM"] = "${TEMPFILE('$LINK $TARGET $SOURCES','$LINKCOMSTR')}"

By default, the name of the temporary file used begins with a prefix of ‘@’. This may be configured for other tool chains by setting the TEMPFILEPREFIX variable. Example:

env["TEMPFILEPREFIX"] = '-@'        # diab compiler
env["TEMPFILEPREFIX"] = '-via'      # arm tool chain
env["TEMPFILEPREFIX"] = ''          # (the empty string) PC Lint

You can configure the extension of the temporary file through the TEMPFILESUFFIX variable, which defaults to ‘.lnk’ (see comments in the code below). Example:

env["TEMPFILESUFFIX"] = '.lnt'   # PC Lint

Entries in the temporary file are separated by the value of the TEMPFILEARGJOIN variable, which defaults to an OS-appropriate value.

A default argument escape function is SCons.Subst.quote_spaces. If you need to apply extra operations on a command argument before writing to a temporary file(fix Windows slashes, normalize paths, etc.), please set TEMPFILEARGESCFUNC variable to a custom function. Example:

import sys
import re
from SCons.Subst import quote_spaces

WINPATHSEP_RE = re.compile(r"\([^"'\]|$)")


def tempfile_arg_esc_func(arg):
    arg = quote_spaces(arg)
    if sys.platform != "win32":
        return arg
    # GCC requires double Windows slashes, let's use UNIX separator
    return WINPATHSEP_RE.sub(r"/", arg)


env["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func
_print_cmd_str(target, source, env, cmdstr) None[source]#
SCons.Platform.platform_default()[source]#

Return the platform string for our execution environment.

The returned value should map to one of the SCons/Platform/*.py files. Since scons is architecture independent, though, we don’t care about the machine architecture.

SCons.Platform.platform_module(name='darwin')[source]#

Return the imported module for the platform.

This looks for a module name that matches the specified argument. If the name is unspecified, we fetch the appropriate default for our execution environment.