From 37c8ead5f199c318fc810f507b96882c6109c703 Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Thu, 25 Feb 2021 15:00:34 +1030 Subject: phosphor: Fix SyntaxWarnings in obmc-phosphor-systemd.bbclass When running with Python 3.8 these statements will warn with: SyntaxWarning: "is" with a literal. Did you mean "=="? Change-Id: I44a873bce37d189d09bd73e64890cc821205cbbf Signed-off-by: Joel Stanley --- .../classes/obmc-phosphor-systemd.bbclass | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'meta-phosphor/classes') diff --git a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass index 830d0390ca..740f6ec4ac 100644 --- a/meta-phosphor/classes/obmc-phosphor-systemd.bbclass +++ b/meta-phosphor/classes/obmc-phosphor-systemd.bbclass @@ -65,17 +65,17 @@ def SystemdUnit(unit): self.unit = unit def __getattr__(self, item): - if item is 'name': + if item == 'name': return self.unit - if item is 'is_activated': + if item == 'is_activated': return self.unit.startswith('dbus-') - if item is 'is_template': + if item == 'is_template': return '@.' in self.unit - if item is 'is_instance': + if item == 'is_instance': return '@' in self.unit and not self.is_template if item in ['is_service', 'is_target']: return self.unit.split('.')[-1] == item - if item is 'base': + if item == 'base': cls = self.unit.split('.')[-1] base = self.unit.replace('dbus-', '') base = base.replace('.%s' % cls, '') @@ -84,13 +84,13 @@ def SystemdUnit(unit): if self.is_template: base = base.rstrip('@') return base - if item is 'instance' and self.is_instance: + if item == 'instance' and self.is_instance: inst = self.unit.rsplit('@')[-1] return inst.rsplit('.')[0] - if item is 'template' and self.is_instance: + if item == 'template' and self.is_instance: cls = self.unit.split('.')[-1] return '%s@.%s' % (self.base, cls) - if item is 'template' and self.is_template: + if item == 'template' and self.is_template: return '.'.join(self.base.split('@')[:-1]) raise AttributeError(item) @@ -165,11 +165,11 @@ python() { var = 'SYSTEMD_USER_%s' % file user = listvar_to_list(d, var) - if len(user) is 0: + if len(user) == 0: var = 'SYSTEMD_USER_%s' % pkg user = listvar_to_list(d, var) - if len(user) is not 0: - if len(user) is not 1: + if len(user) != 0: + if len(user) != 1: bb.fatal('Too many users assigned to %s: \'%s\'' % (var, ' '.join(user))) user = user[0] -- cgit v1.2.3