From de188c234d1518224aee82f61e4218437b4f5589 Mon Sep 17 00:00:00 2001 From: Stoeffel Date: Tue, 18 Oct 2016 08:28:58 +0200 Subject: [PATCH] :art: don't read by line --- native_package_install.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/native_package_install.py b/native_package_install.py index c60c5cc..b539555 100755 --- a/native_package_install.py +++ b/native_package_install.py @@ -143,14 +143,11 @@ def get_source_dirs(vendor_dir, package): def replace_in_file(filePath, src, target): """ find replace in a file """ - lines = [] + output = "" with open(filePath) as infile: - for line in infile: - line = line.replace(src, target) - lines.append(line) + output = infile.read().replace(src, target) with open(filePath, 'w') as outfile: - for line in lines: - outfile.write(line) + outfile.write(output) def find_all_native_files(path):