All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blktap2: Remove set() for Python 2.3
@ 2009-07-17  7:26 KUWAMURA Shin'ya
  2009-07-17 13:30 ` Ian Jackson
  2009-07-21  3:41 ` Simon Horman
  0 siblings, 2 replies; 6+ messages in thread
From: KUWAMURA Shin'ya @ 2009-07-17  7:26 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: Text/Plain, Size: 156 bytes --]

Hi,

This removes set() for Python 2.3, since set() is added from Python 2.4.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
-- 
  KUWAMURA Shin'ya

[-- Attachment #2: fix-blktap2-remove-set.patch --]
[-- Type: Text/X-Patch, Size: 1283 bytes --]

# HG changeset patch
# User KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
# Date 1247803999 -32400
# Node ID a32f75dd8932f2301247009172915f1a1c380c89
# Parent  63b8d3d7aa8e88a06c734f94e0a399602e1bbfa7
blktap2: Remove set() for Python 2.3

set() is removed for Python 2.3.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>

diff -r 63b8d3d7aa8e -r a32f75dd8932 tools/python/xen/xend/server/BlktapController.py
--- a/tools/python/xen/xend/server/BlktapController.py	Fri Jul 17 11:43:13 2009 +0900
+++ b/tools/python/xen/xend/server/BlktapController.py	Fri Jul 17 13:13:19 2009 +0900
@@ -13,7 +13,7 @@ TAPDISK_DEVICE  = '/dev/xen/blktap-2/tap
 TAPDISK_DEVICE  = '/dev/xen/blktap-2/tapdev'
 TAPDISK_CONTROL = TAPDISK_SYSFS + '/blktap'
 
-blktap1_disk_types = set([
+blktap1_disk_types = [
     'aio',
     'sync',
     'vmdk',
@@ -21,16 +21,16 @@ blktap1_disk_types = set([
     'qcow',
     'qcow2',
     'ioemu',
-    ])
+    ]
 
-blktap2_disk_types = set([
+blktap2_disk_types = [
     'aio',
     'ram',
     'qcow',
     'vhd',
-    ])
+    ]
 
-blktap_disk_types = blktap1_disk_types | blktap2_disk_types
+blktap_disk_types = blktap1_disk_types + blktap2_disk_types
 
 def doexec(args, inputtext=None):
     """Execute a subprocess, then return its return code, stdout and stderr"""

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] blktap2: Remove set() for Python 2.3
  2009-07-17  7:26 [PATCH] blktap2: Remove set() for Python 2.3 KUWAMURA Shin'ya
@ 2009-07-17 13:30 ` Ian Jackson
  2009-07-21  3:41 ` Simon Horman
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Jackson @ 2009-07-17 13:30 UTC (permalink / raw)
  To: KUWAMURA Shin'ya; +Cc: xen-devel

KUWAMURA Shin'ya writes ("[Xen-devel] [PATCH] blktap2: Remove set() for Python 2.3"):
> This removes set() for Python 2.3, since set() is added from Python 2.4.

This looks reasonable to me, although I haven't tested it.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>

Ian.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] blktap2: Remove set() for Python 2.3
  2009-07-17  7:26 [PATCH] blktap2: Remove set() for Python 2.3 KUWAMURA Shin'ya
  2009-07-17 13:30 ` Ian Jackson
@ 2009-07-21  3:41 ` Simon Horman
  2009-07-21  4:11   ` KUWAMURA Shin'ya
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Horman @ 2009-07-21  3:41 UTC (permalink / raw)
  To: KUWAMURA Shin'ya; +Cc: xen-devel

On Fri, Jul 17, 2009 at 04:26:38PM +0900, KUWAMURA Shin'ya wrote:
> Hi,
> 
> This removes set() for Python 2.3, since set() is added from Python 2.4.

set() seems to be used in a number of other places in the code.
Is that a problem?

# grep -r [^a-z_]set\( tools/python/xen/
tools/python/xen/util/acmpolicy.py:            bad_renamings = set(vmlabel_map.keys()) - set(oldvmnames)
tools/python/xen/util/acmpolicy.py:            bad_renamings = set(reslabel_map.keys()) - set(oldresnames)
tools/python/xen/util/acmpolicy.py:               len( set(res_stes).intersection( set(vm_stes) ) ) == 0:
tools/python/xen/util/acmpolicy.py:        unknown_ste = set()
tools/python/xen/util/acmpolicy.py:        unknown_chw = set()
tools/python/xen/util/acmpolicy.py:        if len(vmlabels) != len(set(vmlabels)) or \
tools/python/xen/util/acmpolicy.py:           len(resnames) != len(set(resnames)) or \
tools/python/xen/util/acmpolicy.py:           len(stes)     != len(set(stes))     or \
tools/python/xen/util/acmpolicy.py:           len(chws)     != len(set(chws)):
tools/python/xen/util/acmpolicy.py:                unknown_chw |= (set(chws_by_vm[v]) - set(chws))
tools/python/xen/util/acmpolicy.py:                unknown_ste |= (set(stes_by_vm[v]) - set(stes))
tools/python/xen/util/acmpolicy.py:                unknown_ste |= (set(stes_by_res[r]) - set(stes))
tools/python/xen/util/pci.py:    if len(l) != len(set(l)):
tools/python/xen/xend/XendAPI.py:            'classes' : set(),
tools/python/xen/xend/XendDomainInfo.py:        # just itterating through set(map(..., pci_devs))
tools/python/xen/xend/XendDomainInfo.py:        done = set()
tools/python/xen/xend/XendDomainInfo.py:            done |= set([key])
tools/python/xen/xend/server/DevController.py:    ev.set()
tools/python/xen/xend/server/DevController.py:    ev.set()
tools/python/xen/xend/server/DevController.py:    ev.set()
tools/python/xen/xend/server/pciif.py:        if len(pci_str_list) != len(set(pci_str_list)):
tools/python/xen/xm/labels.py:        names = list(set(names1).union(names2))
tools/python/xen/xm/main.py:        def set(keys, val):
tools/python/xen/xm/main.py:                lambda x: set(['MAC'], x),
tools/python/xen/xm/main.py:                lambda x: set(['network'], get_net_from_bridge(x)),
tools/python/xen/xm/main.py:                lambda x: set(['other_config', 'ip'], x),
tools/python/xen/xm/main.py:                lambda x: set(['other_config', 'script'], x),
tools/python/xen/xm/main.py:                lambda x: set(['other_config', 'backend'], x),
tools/python/xen/xm/main.py:                lambda x: set(['device'], x),
tools/python/xen/xm/main.py:                lambda x: set(['qos_algorithm_params', 'rate'], x),
tools/python/xen/xm/main.py:                lambda x: set(['other_config', 'accel'], x)
tools/python/xen/xm/main.py:    if len(set(vdevfns)) > 1:
tools/python/xen/xm/opts.py:        self.set(default)
tools/python/xen/xm/opts.py:        self.set(self.default)
tools/python/xen/xm/opts.py:    def set(self, value):
tools/python/xen/xm/opts.py:        self.set(v)
tools/python/xen/xm/opts.py:        return opt.set(val)
tools/python/xen/xm/opts.py:    opt.set(1)
tools/python/xen/xm/opts.py:    opt.set(0)
tools/python/xen/xm/opts.py:        opt.set(1)
tools/python/xen/xm/opts.py:        opt.set(0)
tools/python/xen/xm/opts.py:    opt.set(v)
tools/python/xen/xm/opts.py:    opt.set(v)
tools/python/xen/xm/opts.py:    opt.set(v)
tools/python/xen/xm/opts.py:    opt.set(v)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] blktap2: Remove set() for Python 2.3
  2009-07-21  3:41 ` Simon Horman
@ 2009-07-21  4:11   ` KUWAMURA Shin'ya
  2009-07-23 12:23     ` Isaku Yamahata
  0 siblings, 1 reply; 6+ messages in thread
From: KUWAMURA Shin'ya @ 2009-07-21  4:11 UTC (permalink / raw)
  To: horms; +Cc: xen-devel

Hi,

>>>>> On Tue, 21 Jul 2009 13:41:59 +1000
>>>>> horms@verge.net.au(Simon Horman)  said:
> 
> On Fri, Jul 17, 2009 at 04:26:38PM +0900, KUWAMURA Shin'ya wrote:
>
> > This removes set() for Python 2.3, since set() is added from Python 2.4.
> set() seems to be used in a number of other places in the code.
> Is that a problem?

They cause a problem only when the corresponding feature is used.
# XenAPI, ACM, etc.

But starting xend failed by the following code:
> tools/python/xen/util/pci.py:    if len(l) != len(set(l)):

I removed it on weekly testing ad hoc.

Best regards,
-- 
  KUWAMURA Shin'ya

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] blktap2: Remove set() for Python 2.3
  2009-07-21  4:11   ` KUWAMURA Shin'ya
@ 2009-07-23 12:23     ` Isaku Yamahata
  2009-07-24  7:43       ` KUWAMURA Shin'ya
  0 siblings, 1 reply; 6+ messages in thread
From: Isaku Yamahata @ 2009-07-23 12:23 UTC (permalink / raw)
  To: KUWAMURA Shin'ya; +Cc: horms, xen-devel

How about creating a file which includes the followings
and import it?
 
+# for 2.3 compatibility
+try:
+    set()
+except NameError:
+    from sets import Set as set

On Tue, Jul 21, 2009 at 01:11:39PM +0900, KUWAMURA Shin'ya wrote:
> Hi,
> 
> >>>>> On Tue, 21 Jul 2009 13:41:59 +1000
> >>>>> horms@verge.net.au(Simon Horman)  said:
> > 
> > On Fri, Jul 17, 2009 at 04:26:38PM +0900, KUWAMURA Shin'ya wrote:
> >
> > > This removes set() for Python 2.3, since set() is added from Python 2.4.
> > set() seems to be used in a number of other places in the code.
> > Is that a problem?
> 
> They cause a problem only when the corresponding feature is used.
> # XenAPI, ACM, etc.
> 
> But starting xend failed by the following code:
> > tools/python/xen/util/pci.py:    if len(l) != len(set(l)):
> 
> I removed it on weekly testing ad hoc.
> 
> Best regards,

-- 
yamahata

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] blktap2: Remove set() for Python 2.3
  2009-07-23 12:23     ` Isaku Yamahata
@ 2009-07-24  7:43       ` KUWAMURA Shin'ya
  0 siblings, 0 replies; 6+ messages in thread
From: KUWAMURA Shin'ya @ 2009-07-24  7:43 UTC (permalink / raw)
  To: yamahata; +Cc: horms, xen-devel

[-- Attachment #1: Type: Text/Plain, Size: 352 bytes --]

Hi,

On <20090723122323.GD12574%yamahata@valinux.co.jp>,
 Isaku Yamahata wrote:
> 
> How about creating a file which includes the followings
> and import it?
>  
> +# for 2.3 compatibility
> +try:
> +    set()
> +except NameError:
> +    from sets import Set as set

Good! Xend can start on Python 2.3. Thank you.

Best regards,
-- 
  KUWAMURA Shin'ya

[-- Attachment #2: support-python-2.3.patch --]
[-- Type: Text/X-Patch, Size: 518 bytes --]

diff -r bc3aca17cb88 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py	Thu Jul 23 09:01:30 2009 +0100
+++ b/tools/python/xen/util/pci.py	Fri Jul 24 16:41:22 2009 +0900
@@ -18,6 +18,12 @@ from xen.xend import sxp
 from xen.xend import sxp
 from xen.xend.XendConstants import AUTO_PHP_SLOT
 from xen.xend.XendSXPDev import dev_dict_to_sxp
+
+# for 2.3 compatibility
+try:
+    set()
+except NameError:
+    from sets import Set as set
 
 PROC_PCI_PATH = '/proc/bus/pci/devices'
 PROC_PCI_NUM_RESOURCES = 7

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-07-24  7:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-17  7:26 [PATCH] blktap2: Remove set() for Python 2.3 KUWAMURA Shin'ya
2009-07-17 13:30 ` Ian Jackson
2009-07-21  3:41 ` Simon Horman
2009-07-21  4:11   ` KUWAMURA Shin'ya
2009-07-23 12:23     ` Isaku Yamahata
2009-07-24  7:43       ` KUWAMURA Shin'ya

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.