Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Commit 52b1eb8

Browse files
committed
Check VBoxEventType for valid values
1 parent 2561fd4 commit 52b1eb8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

build.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,8 @@ class %(name)s(Enum):
265265
('%(label)s', %(value)s,
266266
'''%(doc)s'''),"""
267267

268+
VBOXEVENT_ENUM_VALUES = set()
269+
268270

269271
def process_enum_node(node):
270272
name = node.getAttribute("name")
@@ -278,6 +280,8 @@ def process_enum_node(node):
278280
continue
279281
doc = get_doc(child)
280282
label = str(child.getAttribute("name"))
283+
if name == "VBoxEventType":
284+
VBOXEVENT_ENUM_VALUES.add(pythonic_name(label))
281285
value = child.getAttribute("value")
282286
if "0x" in value:
283287
value = int(value[2:], 16)
@@ -328,7 +332,15 @@ def process_interface_node(node):
328332
event_id = node.getAttribute("id")
329333
if event_id:
330334
event_id = pythonic_name(event_id)
331-
event_id = "id = VBoxEventType.%(event_id)s" % dict(event_id=event_id)
335+
# Work-around for a typo in Virtualbox.xidl:
336+
if event_id == "on_cloud_provider_can_uninstall":
337+
event_id = "on_cloud_provider_uninstall"
338+
339+
# Some event IDs aren't actually a part of the VBoxEventType enum
340+
if event_id in VBOXEVENT_ENUM_VALUES:
341+
event_id = "id = VBoxEventType.%(event_id)s" % dict(event_id=event_id)
342+
else:
343+
event_id = ""
332344
class_def = CLASS_DEF % dict(
333345
name=name, extends=extends, doc=doc, uuid=uuid, wsmap=wsmap, event_id=event_id
334346
)

virtualbox/library.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36646,7 +36646,6 @@ class IProgressEvent(IEvent):
3664636646

3664736647
__uuid__ = "daaf9016-1f04-4191-aa2f-1fac9646ae4c"
3664836648
__wsmap__ = "managed"
36649-
id = VBoxEventType.progress_event
3665036649

3665136650
@property
3665236651
def progress_id(self):
@@ -38436,7 +38435,7 @@ class ICloudProviderUninstallEvent(IEvent):
3843638435

3843738436
__uuid__ = "f01f1066-f231-11ea-8eee-33bb2afb0b6e"
3843838437
__wsmap__ = "managed"
38439-
id = VBoxEventType.on_cloud_provider_can_uninstall
38438+
id = VBoxEventType.on_cloud_provider_uninstall
3844038439

3844138440
@property
3844238441
def id_p(self):

0 commit comments

Comments
 (0)