diff options
| author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-06-23 22:59:04 +1200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-07-08 09:57:26 +0100 |
| commit | 1cf6e14a6c5ddb4daec1c1e0cce113eea8570545 (patch) | |
| tree | b24af53ea6048aa6d441b10cf96ea633a7936d5d /bitbake/lib/progressbar/compat.py | |
| parent | 481048cd2a64a08501bb5ea7ec0bc9ef0a9a5cc9 (diff) | |
| download | poky-1cf6e14a6c5ddb4daec1c1e0cce113eea8570545.tar.gz | |
bitbake: knotty: import latest python-progressbar
Since we're going to make some minor extensions to it, it makes sense to
bring in the latest version of python-progressbar. Its structure has
changed a little but the API hasn't; however we do need to ensure our
overridden _needs_update() function's signature in BBProgress() matches
properly.
(Bitbake rev: c3e51d71b36cbc9e9ed1b35fb93d0978e24bc98a)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/progressbar/compat.py')
| -rw-r--r-- | bitbake/lib/progressbar/compat.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/bitbake/lib/progressbar/compat.py b/bitbake/lib/progressbar/compat.py new file mode 100644 index 0000000000..a39f4a1f4e --- /dev/null +++ b/bitbake/lib/progressbar/compat.py | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | # -*- coding: utf-8 -*- | ||
| 2 | # | ||
| 3 | # progressbar - Text progress bar library for Python. | ||
| 4 | # Copyright (c) 2005 Nilton Volpato | ||
| 5 | # | ||
| 6 | # This library is free software; you can redistribute it and/or | ||
| 7 | # modify it under the terms of the GNU Lesser General Public | ||
| 8 | # License as published by the Free Software Foundation; either | ||
| 9 | # version 2.1 of the License, or (at your option) any later version. | ||
| 10 | # | ||
| 11 | # This library is distributed in the hope that it will be useful, | ||
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 14 | # Lesser General Public License for more details. | ||
| 15 | # | ||
| 16 | # You should have received a copy of the GNU Lesser General Public | ||
| 17 | # License along with this library; if not, write to the Free Software | ||
| 18 | # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 19 | |||
| 20 | """Compatibility methods and classes for the progressbar module.""" | ||
| 21 | |||
| 22 | |||
| 23 | # Python 3.x (and backports) use a modified iterator syntax | ||
| 24 | # This will allow 2.x to behave with 3.x iterators | ||
| 25 | try: | ||
| 26 | next | ||
| 27 | except NameError: | ||
| 28 | def next(iter): | ||
| 29 | try: | ||
| 30 | # Try new style iterators | ||
| 31 | return iter.__next__() | ||
| 32 | except AttributeError: | ||
| 33 | # Fallback in case of a "native" iterator | ||
| 34 | return iter.next() | ||
| 35 | |||
| 36 | |||
| 37 | # Python < 2.5 does not have "any" | ||
| 38 | try: | ||
| 39 | any | ||
| 40 | except NameError: | ||
| 41 | def any(iterator): | ||
| 42 | for item in iterator: | ||
| 43 | if item: return True | ||
| 44 | return False | ||
