From 6194da5247af27c1017d6d0016c25017b84f15fe Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Sun, 27 Sep 2020 08:45:33 -0500 Subject: [PATCH] Update aksetup --- aksetup_helper.py | 7 +++++-- configure.py | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/aksetup_helper.py b/aksetup_helper.py index a168adf..91e9ac0 100644 --- a/aksetup_helper.py +++ b/aksetup_helper.py @@ -716,7 +716,9 @@ def substitute(substitutions, fname): string_var_re = re.compile(r"\$str\{([A-Za-z_0-9]+)\}") fname_in = fname+".in" - lines = open(fname_in, "r").readlines() + with open(fname_in, "r") as inf: + lines = inf.readlines() + new_lines = [] for line in lines: made_change = True @@ -746,7 +748,8 @@ def substitute(substitutions, fname): new_lines.insert(1, "# DO NOT EDIT THIS FILE -- " "it was generated by configure.py\n") new_lines.insert(2, "# %s\n" % (" ".join(sys.argv))) - open(fname, "w").write("".join(new_lines)) + with open(fname, "w") as outf: + outf.write("".join(new_lines)) from os import stat, chmod infile_stat_res = stat(fname_in) diff --git a/configure.py b/configure.py index 63edd4b..85c9841 100755 --- a/configure.py +++ b/configure.py @@ -1,6 +1,4 @@ -#! /usr/bin/env python - -from __future__ import absolute_import +#! /usr/bin/env python3 from aksetup_helper import configure_frontend configure_frontend() -- GitLab