• Home
  • Raw
  • Download

Lines Matching +full:os +full:- +full:release

3 Miscellaneous utility functions -- anything that doesn't fit into
9 import sys, os, string, re
18 mainly to distinguish platform-specific build directories and
19 platform-specific built distributions. Typically includes the OS name
20 and version and the architecture (as supplied by 'os.uname()'),
21 although the exact information included depends on the OS; eg. for IRIX
27 linux-i586
28 linux-alpha (?)
29 solaris-2.6-sun4u
30 irix-5.3
31 irix64-6.2
34 win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
35 win-ia64 (64bit Windows on Itanium)
36 win32 (all others - specifically, sys.platform is returned)
38 For other non-POSIX platforms, currently just returns 'sys.platform'.
40 if os.name == 'nt':
44 if i == -1:
49 return 'win-amd64'
51 return 'win-ia64'
55 if "_PYTHON_HOST_PLATFORM" in os.environ:
56 return os.environ["_PYTHON_HOST_PLATFORM"]
58 if os.name != "posix" or not hasattr(os, 'uname'):
60 # Mac OS is M68k or PPC, etc.
65 (osname, host, release, version, machine) = os.uname()
67 # Convert the OS name to lowercase, remove '/' characters
68 # (to accommodate BSD/OS), and translate spaces (for "Power Macintosh")
72 machine = string.replace(machine, '/', '-')
75 # At least on Linux/Intel, 'machine' is the processor --
78 return "%s-%s" % (osname, machine)
80 if release[0] >= "5": # SunOS 5 == Solaris 2
82 release = "%d.%s" % (int(release[0]) - 3, release[2:])
88 # fall through to standard osname-release-machine representation
90 return "%s-%s" % (osname, release)
92 return "%s-%s.%s" % (osname, version, release)
96 m = rel_re.match(release)
98 release = m.group()
101 osname, release, machine = _osx_support.get_platform_osx(
103 osname, release, machine)
105 return "%s-%s-%s" % (osname, release, machine)
116 ValueError on non-Unix-ish systems if 'pathname' either starts or
119 if os.sep == '/':
125 if pathname[-1] == '/':
132 return os.curdir
133 return os.path.join(*paths)
140 relative, this is equivalent to "os.path.join(new_root,pathname)".
142 two, which is tricky on DOS/Windows and Mac OS.
144 if os.name == 'posix':
145 if not os.path.isabs(pathname):
146 return os.path.join(new_root, pathname)
148 return os.path.join(new_root, pathname[1:])
150 elif os.name == 'nt':
151 (drive, path) = os.path.splitdrive(pathname)
154 return os.path.join(new_root, path)
156 elif os.name == 'os2':
157 (drive, path) = os.path.splitdrive(pathname)
158 if path[0] == os.sep:
160 return os.path.join(new_root, path)
164 "nothing known about platform '%s'" % os.name
169 """Ensure that 'os.environ' has all the environment variables we
170 guarantee that users can use in config files, command-line options,
172 HOME - user's home directory (Unix only)
173 PLAT - description of the current platform, including hardware
174 and OS (see 'get_platform()')
180 if os.name == 'posix' and 'HOME' not in os.environ:
182 os.environ['HOME'] = pwd.getpwuid(os.getuid())[5]
184 if 'PLAT' not in os.environ:
185 os.environ['PLAT'] = get_platform()
191 """Perform shell/Perl-style variable substitution on 'string'. Every
194 dictionary, or in 'os.environ' if it's not in 'local_vars'.
195 'os.environ' is first checked/augmented to guarantee that it contains
197 variables not found in either 'local_vars' or 'os.environ'.
205 return os.environ[var_name]
208 return re.sub(r'\$([a-zA-Z_][a-zA-Z_0-9]*)', _subst, s)
231 """Split a string up according to Unix shell-like rules for quotes and
235 be backslash-escaped. The backslash is stripped from any two-character
242 # doesn't require character-by-character examination. It was a little
243 # bit of a brain-bender to get it working right, though...
268 if s[end] == "'": # slurp singly-quoted string
270 elif s[end] == '"': # slurp doubly-quoted string
281 s = s[:beg] + s[beg+1:end-1] + s[end:]
282 pos = m.end() - 2
304 if msg[-2:] == ',)': # correct for singleton tuple
305 msg = msg[0:-2] + ')'
333 """Byte-compile a collection of Python source files to either .pyc
337 0 - don't optimize (generate .pyc)
338 1 - normal optimization (like "python -O")
339 2 - extra optimization (like "python -OO")
353 Byte-compilation is either done directly in this interpreter process
363 raise DistutilsByteCompileError('byte-compiling is disabled.')
368 # in debug mode and optimize is 0. If we're not in debug mode (-O
369 # or -OO), we don't know which level of optimization this
371 # byte-compilation and be certain that it's the right thing. Thus,
378 # "Indirect" byte-compilation: write a temporary script and then
387 log.info("writing byte-compilation script '%s'", script_name)
390 script = os.fdopen(script_fd, "w")
404 # slash (os.sep really) to make sure the prefix here is "just
405 # right". This whole prefix business is rather delicate -- the
409 #py_files = map(os.path.abspath, py_files)
411 # prefix = os.path.abspath(prefix)
425 cmd.insert(1, "-O")
427 cmd.insert(1, "-OO")
429 execute(os.remove, (script_name,), "removing %s" % script_name,
432 # "Direct" byte-compilation: use the py_compile module to compile
435 # cross-process recursion. Hey, it works!
440 if file[-3:] != ".py":
446 # cfile - byte-compiled file
447 # dfile - purported source filename (same as 'file' by default)
457 dfile = os.path.join(base_dir, dfile)
459 cfile_base = os.path.basename(cfile)
462 log.info("byte-compiling %s to %s", file, cfile_base)
466 log.debug("skipping byte-compilation of %s to %s",
473 RFC-822 header, by ensuring there are 8 spaces space after each newline.