* [STABLE] Updating Python code to work nicer with Python 2.6
@ 2009-05-12 18:25 Marcin Juszkiewicz
2009-05-12 18:25 ` [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 Marcin Juszkiewicz
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Marcin Juszkiewicz @ 2009-05-12 18:25 UTC (permalink / raw)
To: openembedded-devel
Some time ago I fixed BitBake trunk to not generate DeprecationWarnings
when used with Python 2.6. Some time later Richard Purdie backported it
into bitbake-1.8 branch. Now I tested it with stable/2009 and want to
get it inside.
Patch.bbclass change removes DeprecationWarnings too but has to keep
compatibility with Python 2.4 so I had to use try/except block because
hashlib is 2.5+
^ permalink raw reply [flat|nested] 8+ messages in thread* [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 2009-05-12 18:25 [STABLE] Updating Python code to work nicer with Python 2.6 Marcin Juszkiewicz @ 2009-05-12 18:25 ` Marcin Juszkiewicz 2009-05-13 7:43 ` Koen Kooi 2009-05-12 18:25 ` [STABLE][PATCH 2/2] patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning Marcin Juszkiewicz 2009-05-12 18:29 ` [STABLE] Updating Python code to work nicer with Python 2.6 Koen Kooi 2 siblings, 1 reply; 8+ messages in thread From: Marcin Juszkiewicz @ 2009-05-12 18:25 UTC (permalink / raw) To: openembedded-devel; +Cc: Richard Purdie From: Richard Purdie <rpurdie@linux.intel.com> Some time ago I fixed BitBake trunk to not generate DeprecationWarnings when used with Python 2.6. Some time later Richard Purdie backported it into bitbake-1.8 branch. Now I tested it with stable/2009 and want to get it inside. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com> Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl> --- bitbake/lib/bb/COW.py | 4 ++-- bitbake/lib/bb/cache.py | 3 +-- bitbake/lib/bb/cooker.py | 5 ++--- bitbake/lib/bb/data_smart.py | 5 ++--- bitbake/lib/bb/runqueue.py | 7 +++---- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py index e5063d6..5db4177 100644 --- a/bitbake/lib/bb/COW.py +++ b/bitbake/lib/bb/COW.py @@ -26,7 +26,7 @@ from inspect import getmro import copy -import types, sets +import types types.ImmutableTypes = tuple([ \ types.BooleanType, \ types.ComplexType, \ @@ -35,7 +35,7 @@ types.ImmutableTypes = tuple([ \ types.LongType, \ types.NoneType, \ types.TupleType, \ - sets.ImmutableSet] + \ + frozenset] + \ list(types.StringTypes)) MUTABLE = "__mutable__" diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index a4a4f47..06985be 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py @@ -31,7 +31,6 @@ import os, re import bb.data import bb.utils -from sets import Set try: import cPickle as pickle @@ -473,6 +472,6 @@ class CacheData: (set elsewhere) """ self.ignored_dependencies = [] - self.world_target = Set() + self.world_target = set() self.bbfile_priority = {} self.bbfile_config_priorities = [] diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 6a6d254..90325d1 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -25,7 +25,6 @@ import sys, os, getopt, glob, copy, os.path, re, time import bb from bb import utils, data, parse, event, cache, providers, taskdata, runqueue -from sets import Set import itertools, sre_constants parsespin = itertools.cycle( r'|/-\\' ) @@ -485,7 +484,7 @@ class BBCooker: # Tweak some variables item = self.bb_cache.getVar('PN', fn, True) - self.status.ignored_dependencies = Set() + self.status.ignored_dependencies = set() self.status.bbfile_priority[fn] = 1 # Remove external dependencies @@ -577,7 +576,7 @@ class BBCooker: self.status = bb.cache.CacheData() ignore = bb.data.getVar("ASSUME_PROVIDED", self.configuration.data, 1) or "" - self.status.ignored_dependencies = Set( ignore.split() ) + self.status.ignored_dependencies = set( ignore.split() ) self.handleCollections( bb.data.getVar("BBFILE_COLLECTIONS", self.configuration.data, 1) ) diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 0d39d20..c93aea7 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py @@ -32,7 +32,6 @@ import copy, os, re, sys, time, types import bb from bb import utils, methodpool from COW import COWDictBase -from sets import Set from new import classobj @@ -142,7 +141,7 @@ class DataSmart: try: self._special_values[keyword].add( base ) except: - self._special_values[keyword] = Set() + self._special_values[keyword] = set() self._special_values[keyword].add( base ) return @@ -154,7 +153,7 @@ class DataSmart: if '_' in var: override = var[var.rfind('_')+1:] if not self._seen_overrides.has_key(override): - self._seen_overrides[override] = Set() + self._seen_overrides[override] = set() self._seen_overrides[override].add( var ) # setting var diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 2df51de..9b3cbdf 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py @@ -23,7 +23,6 @@ Handles preparation and execution of a queue of tasks # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. from bb import msg, data, event, mkdirhier, utils -from sets import Set import bb, os, sys import signal import stat @@ -525,8 +524,8 @@ class RunQueue: self.runq_fnid.append(taskData.tasks_fnid[task]) self.runq_task.append(taskData.tasks_name[task]) - self.runq_depends.append(Set(depends)) - self.runq_revdeps.append(Set()) + self.runq_depends.append(set(depends)) + self.runq_revdeps.append(set()) runq_build.append(0) @@ -622,7 +621,7 @@ class RunQueue: if maps[origdep] == -1: bb.msg.fatal(bb.msg.domain.RunQueue, "Invalid mapping - Should never happen!") newdeps.append(maps[origdep]) - self.runq_depends[listid] = Set(newdeps) + self.runq_depends[listid] = set(newdeps) bb.msg.note(2, bb.msg.domain.RunQueue, "Assign Weightings") -- 1.6.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 2009-05-12 18:25 ` [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 Marcin Juszkiewicz @ 2009-05-13 7:43 ` Koen Kooi 2009-05-14 15:02 ` Otavio Salvador 0 siblings, 1 reply; 8+ messages in thread From: Koen Kooi @ 2009-05-13 7:43 UTC (permalink / raw) To: openembedded-devel On 12-05-09 20:25, Marcin Juszkiewicz wrote: > From: Richard Purdie<rpurdie@linux.intel.com> > > Some time ago I fixed BitBake trunk to not generate DeprecationWarnings > when used with Python 2.6. Some time later Richard Purdie backported it > into bitbake-1.8 branch. Now I tested it with stable/2009 and want to > get it inside. > > Signed-off-by: Richard Purdie<rpurdie@linux.intel.com> > Signed-off-by: Marcin Juszkiewicz<marcin@juszkiewicz.com.pl> Acked-by: Koen Kooi <koen@openembedded.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 2009-05-13 7:43 ` Koen Kooi @ 2009-05-14 15:02 ` Otavio Salvador 0 siblings, 0 replies; 8+ messages in thread From: Otavio Salvador @ 2009-05-14 15:02 UTC (permalink / raw) To: openembedded-devel; +Cc: openembedded-devel Acked-by: Otavio Salvador <otavio@ossystems.com.br> On Wed, May 13, 2009 at 4:43 AM, Koen Kooi <k.kooi@student.utwente.nl> wrote: > On 12-05-09 20:25, Marcin Juszkiewicz wrote: >> >> From: Richard Purdie<rpurdie@linux.intel.com> >> >> Some time ago I fixed BitBake trunk to not generate DeprecationWarnings >> when used with Python 2.6. Some time later Richard Purdie backported it >> into bitbake-1.8 branch. Now I tested it with stable/2009 and want to >> get it inside. >> >> Signed-off-by: Richard Purdie<rpurdie@linux.intel.com> >> Signed-off-by: Marcin Juszkiewicz<marcin@juszkiewicz.com.pl> > > Acked-by: Koen Kooi <koen@openembedded.org> > > > > _______________________________________________ > Openembedded-devel mailing list > Openembedded-devel@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel > -- Otavio Salvador O.S. Systems E-mail: otavio@ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br ^ permalink raw reply [flat|nested] 8+ messages in thread
* [STABLE][PATCH 2/2] patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning 2009-05-12 18:25 [STABLE] Updating Python code to work nicer with Python 2.6 Marcin Juszkiewicz 2009-05-12 18:25 ` [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 Marcin Juszkiewicz @ 2009-05-12 18:25 ` Marcin Juszkiewicz 2009-05-13 7:43 ` Koen Kooi 2009-05-12 18:29 ` [STABLE] Updating Python code to work nicer with Python 2.6 Koen Kooi 2 siblings, 1 reply; 8+ messages in thread From: Marcin Juszkiewicz @ 2009-05-12 18:25 UTC (permalink / raw) To: openembedded-devel Patch.bbclass change removes DeprecationWarnings too but has to keep compatibility with Python 2.4 so I had to use try/except block because hashlib is 2.5+ Signed-off-by: Marcin Juszkiewicz <marcin@juszkiewicz.com.pl> --- classes/patch.bbclass | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/classes/patch.bbclass b/classes/patch.bbclass index 075e826..8d2bde0 100644 --- a/classes/patch.bbclass +++ b/classes/patch.bbclass @@ -13,14 +13,22 @@ def patch_init(d): return "Error: %s not found." % self.path def md5sum(fname): - import md5, sys + import sys + + # when we move to Python 2.5 as minimal supported + # we can kill that try/except as hashlib is 2.5+ + try: + import hashlib + m = hashlib.md5() + except ImportError: + import md5 + m = md5.new() try: f = file(fname, 'rb') except IOError: raise NotFoundError(fname) - m = md5.new() while True: d = f.read(8096) if not d: -- 1.6.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [STABLE][PATCH 2/2] patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning 2009-05-12 18:25 ` [STABLE][PATCH 2/2] patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning Marcin Juszkiewicz @ 2009-05-13 7:43 ` Koen Kooi 2009-05-14 15:01 ` Otavio Salvador 0 siblings, 1 reply; 8+ messages in thread From: Koen Kooi @ 2009-05-13 7:43 UTC (permalink / raw) To: openembedded-devel On 12-05-09 20:25, Marcin Juszkiewicz wrote: > Patch.bbclass change removes DeprecationWarnings too but has to keep > compatibility with Python 2.4 so I had to use try/except block because > hashlib is 2.5+ > > Signed-off-by: Marcin Juszkiewicz<marcin@juszkiewicz.com.pl> Acked-by: Koen Kooi <koen@openembedded.org> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE][PATCH 2/2] patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning 2009-05-13 7:43 ` Koen Kooi @ 2009-05-14 15:01 ` Otavio Salvador 0 siblings, 0 replies; 8+ messages in thread From: Otavio Salvador @ 2009-05-14 15:01 UTC (permalink / raw) To: openembedded-devel; +Cc: openembedded-devel Acked-by: Otavio Salvador <otavio@ossystems.com.br> On Wed, May 13, 2009 at 4:43 AM, Koen Kooi <k.kooi@student.utwente.nl> wrote: > On 12-05-09 20:25, Marcin Juszkiewicz wrote: >> >> Patch.bbclass change removes DeprecationWarnings too but has to keep >> compatibility with Python 2.4 so I had to use try/except block because >> hashlib is 2.5+ >> >> Signed-off-by: Marcin Juszkiewicz<marcin@juszkiewicz.com.pl> > > Acked-by: Koen Kooi <koen@openembedded.org> > > > _______________________________________________ > Openembedded-devel mailing list > Openembedded-devel@lists.openembedded.org > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel > -- Otavio Salvador O.S. Systems E-mail: otavio@ossystems.com.br http://www.ossystems.com.br Mobile: +55 53 9981-7854 http://projetos.ossystems.com.br ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [STABLE] Updating Python code to work nicer with Python 2.6 2009-05-12 18:25 [STABLE] Updating Python code to work nicer with Python 2.6 Marcin Juszkiewicz 2009-05-12 18:25 ` [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 Marcin Juszkiewicz 2009-05-12 18:25 ` [STABLE][PATCH 2/2] patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning Marcin Juszkiewicz @ 2009-05-12 18:29 ` Koen Kooi 2 siblings, 0 replies; 8+ messages in thread From: Koen Kooi @ 2009-05-12 18:29 UTC (permalink / raw) To: openembedded-devel On 12-05-09 20:25, Marcin Juszkiewicz wrote: > Some time ago I fixed BitBake trunk to not generate DeprecationWarnings > when used with Python 2.6. Some time later Richard Purdie backported it > into bitbake-1.8 branch. Now I tested it with stable/2009 and want to > get it inside. > > Patch.bbclass change removes DeprecationWarnings too but has to keep > compatibility with Python 2.4 so I had to use try/except block because > hashlib is 2.5+ Less users pasting those 'errors' to me is always a good thing :) regards, KOen ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-05-14 15:09 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-05-12 18:25 [STABLE] Updating Python code to work nicer with Python 2.6 Marcin Juszkiewicz 2009-05-12 18:25 ` [STABLE][PATCH 1/2] bitbake: Update to work without warnings with python 2.6 Marcin Juszkiewicz 2009-05-13 7:43 ` Koen Kooi 2009-05-14 15:02 ` Otavio Salvador 2009-05-12 18:25 ` [STABLE][PATCH 2/2] patch.bbclass: use hashlib with Python 2.5+ - removes DeprecationWarning Marcin Juszkiewicz 2009-05-13 7:43 ` Koen Kooi 2009-05-14 15:01 ` Otavio Salvador 2009-05-12 18:29 ` [STABLE] Updating Python code to work nicer with Python 2.6 Koen Kooi
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.