[vlc-commits] pkg-rewrite-absolute.py: use == instead of is for char comparison
Alexandre Janniaux
git at videolan.org
Wed Mar 11 14:27:37 CET 2020
vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Wed Mar 11 14:20:01 2020 +0100| [4b4760bbd6b6cf0251520a7731dc8bc324937963] | committer: Marvin Scholz
pkg-rewrite-absolute.py: use == instead of is for char comparison
Fix warnings when executing the script:
contrib/src/pkg-rewrite-absolute.py:19: SyntaxWarning: "is" with a literal. Did you mean "=="?
if c is '=':
contrib/src/pkg-rewrite-absolute.py:30: SyntaxWarning: "is" with a literal. Did you mean "=="?
elif c is ':':
contrib/src/pkg-rewrite-absolute.py:128: SyntaxWarning: "is" with a literal. Did you mean "=="?
input_file = sys.stdin if args.input is '-' else open(args.input, 'r')
contrib/src/pkg-rewrite-absolute.py:136: SyntaxWarning: "is" with a literal. Did you mean "=="?
output_file = sys.stdout if args.output is '-' else open(args.output, 'w')
Signed-off-by: Marvin Scholz <epirat07 at gmail.com>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4b4760bbd6b6cf0251520a7731dc8bc324937963
---
contrib/src/pkg-rewrite-absolute.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/contrib/src/pkg-rewrite-absolute.py b/contrib/src/pkg-rewrite-absolute.py
index 4441f3f4eb..15d55b6467 100755
--- a/contrib/src/pkg-rewrite-absolute.py
+++ b/contrib/src/pkg-rewrite-absolute.py
@@ -16,7 +16,7 @@ class PkgConfigFile():
def parse_pc_line(self, line):
for i, c in enumerate(line):
- if c is '=':
+ if c == '=':
# This is a pkg-config variable line
key = line[:i].strip()
val = line[(i + 1):].strip()
@@ -27,7 +27,7 @@ class PkgConfigFile():
# Add expanded version of variable
self.pc_variables_expanded.update({ key : self.expand_pc_vars(val) })
break
- elif c is ':':
+ elif c == ':':
# This is a pkg-config keyword line
key = line[:i].strip()
val = line[(i + 1):].strip()
@@ -125,7 +125,7 @@ def main():
args.output = args.output or args.input
# Read .pc from input file
- input_file = sys.stdin if args.input is '-' else open(args.input, 'r')
+ input_file = sys.stdin if args.input == '-' else open(args.input, 'r')
pc_file = PkgConfigFile(input_file)
if input_file is not sys.stdin:
input_file.close()
@@ -133,7 +133,7 @@ def main():
rewrite_abs_to_rel(pc_file)
# Write output
- output_file = sys.stdout if args.output is '-' else open(args.output, 'w')
+ output_file = sys.stdout if args.output == '-' else open(args.output, 'w')
pc_file.write(output_file)
if output_file is not sys.stdout:
output_file.close()
More information about the vlc-commits
mailing list