| Home | Trees | Indices | Help |
|
|---|
|
|
1 """SCons.Platform.posix
2
3 Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems.
4
5 There normally shouldn't be any need to import this module directly. It
6 will usually be imported through the generic SCons.Platform.Platform()
7 selection method.
8 """
9
10 #
11 # Copyright (c) 2001 - 2019 The SCons Foundation
12 #
13 # Permission is hereby granted, free of charge, to any person obtaining
14 # a copy of this software and associated documentation files (the
15 # "Software"), to deal in the Software without restriction, including
16 # without limitation the rights to use, copy, modify, merge, publish,
17 # distribute, sublicense, and/or sell copies of the Software, and to
18 # permit persons to whom the Software is furnished to do so, subject to
19 # the following conditions:
20 #
21 # The above copyright notice and this permission notice shall be included
22 # in all copies or substantial portions of the Software.
23 #
24 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
25 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
26 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
29 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
30 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 #
32
33 __revision__ = "src/engine/SCons/Platform/posix.py 72ae09dc35ac2626f8ff711d8c4b30b6138e08e3 2019-08-08 14:50:06 bdeegan"
34
35 import errno
36 import os
37 import os.path
38 import subprocess
39 import sys
40 import select
41
42 import SCons.Util
43 from SCons.Platform import TempFileMunge
44 from SCons.Platform.virtualenv import ImportVirtualenv
45 from SCons.Platform.virtualenv import ignore_virtualenv, enable_virtualenv
46
47 exitvalmap = {
48 2 : 127,
49 13 : 126,
50 }
51
53 """escape shell special characters"""
54 slash = '\\'
55 special = '"$'
56
57 arg = arg.replace(slash, slash+slash)
58 for c in special:
59 arg = arg.replace(c, slash+c)
60
61 # print("ESCAPE RESULT: %s" % arg)
62 return '"' + arg + '"'
63
64
68
71
73 proc = subprocess.Popen(l, env = env, close_fds = True,
74 stdout = stdout,
75 stderr = stderr)
76 return proc.wait()
77
79 # spawn using Popen3 combined with the env command
80 # the command name and the command's stdout is written to stdout
81 # the command's stderr is written to stderr
82 return exec_popen3([sh, '-c', ' '.join(args)],
83 env, stdout, stderr)
84
85
87 # Bearing in mind we have python 2.4 as a baseline, we can just do this:
88 spawn = subprocess_spawn
89 pspawn = piped_env_spawn
90 # Note that this means that 'escape' is no longer used
91
92 if 'ENV' not in env:
93 env['ENV'] = {}
94 env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin'
95 env['OBJPREFIX'] = ''
96 env['OBJSUFFIX'] = '.o'
97 env['SHOBJPREFIX'] = '$OBJPREFIX'
98 env['SHOBJSUFFIX'] = '$OBJSUFFIX'
99 env['PROGPREFIX'] = ''
100 env['PROGSUFFIX'] = ''
101 env['LIBPREFIX'] = 'lib'
102 env['LIBSUFFIX'] = '.a'
103 env['SHLIBPREFIX'] = '$LIBPREFIX'
104 env['SHLIBSUFFIX'] = '.so'
105 env['LIBPREFIXES'] = [ '$LIBPREFIX' ]
106 env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ]
107 env['PSPAWN'] = pspawn
108 env['SPAWN'] = spawn
109 env['SHELL'] = 'sh'
110 env['ESCAPE'] = escape
111 env['TEMPFILE'] = TempFileMunge
112 env['TEMPFILEPREFIX'] = '@'
113 #Based on LINUX: ARG_MAX=ARG_MAX=131072 - 3000 for environment expansion
114 #Note: specific platforms might rise or lower this value
115 env['MAXLINELENGTH'] = 128072
116
117 # This platform supports RPATH specifications.
118 env['__RPATH'] = '$_RPATH'
119
120 # GDC is GCC family, but DMD and LDC have different options.
121 # Must be able to have GCC and DMD work in the same build, so:
122 env['__DRPATH'] = '$_DRPATH'
123
124 if enable_virtualenv and not ignore_virtualenv:
125 ImportVirtualenv(env)
126
127 # Local Variables:
128 # tab-width:4
129 # indent-tabs-mode:nil
130 # End:
131 # vim: set expandtab tabstop=4 shiftwidth=4:
132
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Thu Aug 8 14:51:07 2019 | http://epydoc.sourceforge.net |