diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:02:31 -0500 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2021-03-04 17:11:26 -0500 |
commit | 4340bf34faca7eed8076ba4c388fbe15355f2183 (patch) | |
tree | 6082548a6cb79091d1059a73e7b3b9f59657f6d9 /mesonbuild/scripts | |
parent | 76df995ba69ef5d790462856b3edbd42b28b906a (diff) | |
download | meson-4340bf34faca7eed8076ba4c388fbe15355f2183.zip meson-4340bf34faca7eed8076ba4c388fbe15355f2183.tar.gz meson-4340bf34faca7eed8076ba4c388fbe15355f2183.tar.bz2 |
various python neatness cleanups
All changes were created by running
"pyupgrade --py3-only --keep-percent-format"
and committing the results. I have not touched string formatting for
now.
- use set literals
- simplify .format() parameter naming
- remove __future__
- remove default "r" mode for open()
- use OSError rather than compatibility aliases
- remove stray parentheses in function(generator) scopes
Diffstat (limited to 'mesonbuild/scripts')
-rw-r--r-- | mesonbuild/scripts/meson_exe.py | 2 | ||||
-rw-r--r-- | mesonbuild/scripts/symbolextractor.py | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py index 27db144..d44280f 100644 --- a/mesonbuild/scripts/meson_exe.py +++ b/mesonbuild/scripts/meson_exe.py @@ -82,7 +82,7 @@ def run_exe(exe: ExecutableSerialisation, extra_env: T.Optional[dict] = None) -> try: with open(exe.capture, 'rb') as cur: skip_write = cur.read() == stdout - except IOError: + except OSError: pass if not skip_write: with open(exe.capture, 'wb') as output: diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index 30065cc..e80d9c2fac 100644 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -43,7 +43,7 @@ def dummy_syms(outfilename: str) -> None: def write_if_changed(text: str, outfilename: str) -> None: try: - with open(outfilename, 'r') as f: + with open(outfilename) as f: oldtext = f.read() if text == oldtext: return |