generic_platform: add a method to delete a constraint

This commit is contained in:
Franck Jullien 2021-09-20 07:51:26 +02:00
parent 000aabf85b
commit 0278d3eee8
1 changed files with 8 additions and 0 deletions

View File

@ -190,6 +190,11 @@ class ConstraintManager:
def add_extension(self, io): def add_extension(self, io):
self.available.extend(io) self.available.extend(io)
def delete(self, signal):
for res, obj in self.matched:
if obj == signal:
self.matched.remove((res, obj))
def request(self, name, number=None, loose=False): def request(self, name, number=None, loose=False):
resource = _lookup(self.available, name, number, loose) resource = _lookup(self.available, name, number, loose)
if resource is None: if resource is None:
@ -313,6 +318,9 @@ class GenericPlatform:
def request(self, *args, **kwargs): def request(self, *args, **kwargs):
return self.constraint_manager.request(*args, **kwargs) return self.constraint_manager.request(*args, **kwargs)
def delete(self, *args, **kwargs):
return self.constraint_manager.delete(*args, **kwargs)
def request_all(self, *args, **kwargs): def request_all(self, *args, **kwargs):
return self.constraint_manager.request_all(*args, **kwargs) return self.constraint_manager.request_all(*args, **kwargs)