diff options
| author | Chris Larson <chris_larson@mentor.com> | 2010-12-31 11:00:27 +0000 |
|---|---|---|
| committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:46:39 +0000 |
| commit | 4addbd191dec44d01e8d9961e645948c0ebd04c8 (patch) | |
| tree | 733ca121d5f57fec9634fd047c26749aced188de /bitbake/lib/pysh/subprocess_fix.py | |
| parent | 489d17596d2c532f2d8db3ef8c0f122ca49bb466 (diff) | |
| download | poky-4addbd191dec44d01e8d9961e645948c0ebd04c8.tar.gz | |
Move the pysh package into the bb package
The pysh we're using is modified, and we don't want to risk it conflicting
with one from elsewhere.
(Bitbake rev: 1cbf8a9403b4b60d59bfd90a51c3e4246ab834d6)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/pysh/subprocess_fix.py')
| -rw-r--r-- | bitbake/lib/pysh/subprocess_fix.py | 77 |
1 files changed, 0 insertions, 77 deletions
diff --git a/bitbake/lib/pysh/subprocess_fix.py b/bitbake/lib/pysh/subprocess_fix.py deleted file mode 100644 index 46eca22802..0000000000 --- a/bitbake/lib/pysh/subprocess_fix.py +++ /dev/null | |||
| @@ -1,77 +0,0 @@ | |||
| 1 | # subprocess - Subprocesses with accessible I/O streams | ||
| 2 | # | ||
| 3 | # For more information about this module, see PEP 324. | ||
| 4 | # | ||
| 5 | # This module should remain compatible with Python 2.2, see PEP 291. | ||
| 6 | # | ||
| 7 | # Copyright (c) 2003-2005 by Peter Astrand <astrand@lysator.liu.se> | ||
| 8 | # | ||
| 9 | # Licensed to PSF under a Contributor Agreement. | ||
| 10 | # See http://www.python.org/2.4/license for licensing details. | ||
| 11 | |||
| 12 | def list2cmdline(seq): | ||
| 13 | """ | ||
| 14 | Translate a sequence of arguments into a command line | ||
| 15 | string, using the same rules as the MS C runtime: | ||
| 16 | |||
| 17 | 1) Arguments are delimited by white space, which is either a | ||
| 18 | space or a tab. | ||
| 19 | |||
| 20 | 2) A string surrounded by double quotation marks is | ||
| 21 | interpreted as a single argument, regardless of white space | ||
| 22 | contained within. A quoted string can be embedded in an | ||
| 23 | argument. | ||
| 24 | |||
| 25 | 3) A double quotation mark preceded by a backslash is | ||
| 26 | interpreted as a literal double quotation mark. | ||
| 27 | |||
| 28 | 4) Backslashes are interpreted literally, unless they | ||
| 29 | immediately precede a double quotation mark. | ||
| 30 | |||
| 31 | 5) If backslashes immediately precede a double quotation mark, | ||
| 32 | every pair of backslashes is interpreted as a literal | ||
| 33 | backslash. If the number of backslashes is odd, the last | ||
| 34 | backslash escapes the next double quotation mark as | ||
| 35 | described in rule 3. | ||
| 36 | """ | ||
| 37 | |||
| 38 | # See | ||
| 39 | # http://msdn.microsoft.com/library/en-us/vccelng/htm/progs_12.asp | ||
| 40 | result = [] | ||
| 41 | needquote = False | ||
| 42 | for arg in seq: | ||
| 43 | bs_buf = [] | ||
| 44 | |||
| 45 | # Add a space to separate this argument from the others | ||
| 46 | if result: | ||
| 47 | result.append(' ') | ||
| 48 | |||
| 49 | needquote = (" " in arg) or ("\t" in arg) or ("|" in arg) or arg == "" | ||
| 50 | if needquote: | ||
| 51 | result.append('"') | ||
| 52 | |||
| 53 | for c in arg: | ||
| 54 | if c == '\\': | ||
| 55 | # Don't know if we need to double yet. | ||
| 56 | bs_buf.append(c) | ||
| 57 | elif c == '"': | ||
| 58 | # Double backspaces. | ||
| 59 | result.append('\\' * len(bs_buf)*2) | ||
| 60 | bs_buf = [] | ||
| 61 | result.append('\\"') | ||
| 62 | else: | ||
| 63 | # Normal char | ||
| 64 | if bs_buf: | ||
| 65 | result.extend(bs_buf) | ||
| 66 | bs_buf = [] | ||
| 67 | result.append(c) | ||
| 68 | |||
| 69 | # Add remaining backspaces, if any. | ||
| 70 | if bs_buf: | ||
| 71 | result.extend(bs_buf) | ||
| 72 | |||
| 73 | if needquote: | ||
| 74 | result.extend(bs_buf) | ||
| 75 | result.append('"') | ||
| 76 | |||
| 77 | return ''.join(result) | ||
