Skip to content

Commit

Permalink
Use '==' instead of 'is' for literal comparisons
Browse files Browse the repository at this point in the history
Using 'is' in this context is wrong (Python reserves the right to have
more than one object for a given string) and starts causing warnings
with Python 3.8.
  • Loading branch information
rswarbrick authored and imphil committed Mar 11, 2020
1 parent 7a9691a commit 19772e4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions fusesoc/capi1/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,15 +201,15 @@ def _build_dict(v, env):
"FILES_ROOT": files_root,
}
flow = self._get_flow(flags)
if flow is "sim":
if flow == "sim":
for s in ["pre_build_scripts", "pre_run_scripts", "post_run_scripts"]:
v = getattr(self.scripts, s)
if v:
scripts[s[0:-8]] = _build_dict(v, env)
# For backwards compatibility we only use the script from the
# top-level core in synth flows. We also rename them here to match
# the backend stages and set the SYSTEM_ROOT env var
elif flow is "synth" and flags["is_toplevel"]:
elif flow == "synth" and flags["is_toplevel"]:
env["SYSTEM_ROOT"] = self.files_root
v = self.scripts.pre_synth_scripts
if v:
Expand Down Expand Up @@ -333,7 +333,7 @@ def get_vpi(self, flags):
return vpi

def get_work_root(self, flags):
if self._get_flow(flags) is "synth":
if self._get_flow(flags) == "synth":
s = "bld-"
else:
s = "sim-"
Expand Down Expand Up @@ -401,9 +401,9 @@ def _get_flow(self, flags):
]:
flow = "synth"
elif "target" in flags:
if flags["target"] is "synth":
if flags["target"] == "synth":
flow = "synth"
elif flags["target"] is "sim":
elif flags["target"] == "sim":
flow = "sim"
return flow

Expand Down

0 comments on commit 19772e4

Please sign in to comment.