From fa5524890e86d353ee7d2194ccdd6c84e9bd2d31 Mon Sep 17 00:00:00 2001 From: Frazer Clews Date: Thu, 16 Jan 2020 17:11:19 +0000 Subject: bitbake: lib: amend code to use proper singleton comparisons where possible amend the code to handle singleton comparisons properly so it only checks if they only refer to the same object or not, and not bother comparing the values. (Bitbake rev: b809a6812aa15a8a9af97bc382cc4b19571e6bfc) Signed-off-by: Frazer Clews Signed-off-by: Richard Purdie --- bitbake/lib/bb/fetch2/__init__.py | 4 ++-- bitbake/lib/bb/fetch2/git.py | 2 +- bitbake/lib/bb/fetch2/osc.py | 2 +- bitbake/lib/bb/fetch2/perforce.py | 2 +- bitbake/lib/bb/fetch2/ssh.py | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'bitbake/lib/bb/fetch2') diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 731c160892..18a6819d5d 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -1081,7 +1081,7 @@ def try_mirrors(fetch, d, origud, mirrors, check = False): for index, uri in enumerate(uris): ret = try_mirror_url(fetch, origud, uds[index], ld, check) - if ret != False: + if ret: return ret return None @@ -1351,7 +1351,7 @@ class FetchMethod(object): """ # We cannot compute checksums for directories - if os.path.isdir(urldata.localpath) == True: + if os.path.isdir(urldata.localpath): return False if urldata.localpath.find("*") != -1: return False diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index fa41b078f1..fe0a384af2 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -671,7 +671,7 @@ class Git(FetchMethod): # search for version in the line tag = tagregex.search(tag_head) - if tag == None: + if tag is None: continue tag = tag.group('pver') diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index f55db6f791..8f091efd02 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/lib/bb/fetch2/osc.py @@ -41,7 +41,7 @@ class Osc(FetchMethod): else: pv = d.getVar("PV", False) rev = bb.fetch2.srcrev_internal_helper(ud, d) - if rev and rev != True: + if rev: ud.revision = rev else: ud.revision = "" diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index b2ac11ecab..f57c2a4f52 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/lib/bb/fetch2/perforce.py @@ -104,7 +104,7 @@ class Perforce(FetchMethod): if command == 'changes': p4cmd = '%s%s changes -m 1 //%s' % (ud.basecmd, p4opt, pathnrev) elif command == 'print': - if depot_filename != None: + if depot_filename is not None: p4cmd = '%s%s print -o "p4/%s" "%s"' % (ud.basecmd, p4opt, filename, depot_filename) else: raise FetchError('No depot file name provided to p4 %s' % command, ud.url) diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index 34debe399b..5e982ecf38 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/lib/bb/fetch2/ssh.py @@ -58,7 +58,7 @@ class SSH(FetchMethod): '''Class to fetch a module or modules via Secure Shell''' def supports(self, urldata, d): - return __pattern__.match(urldata.url) != None + return __pattern__.match(urldata.url) is not None def supports_checksum(self, urldata): return False -- cgit v1.2.3-54-g00ecf