Use native open/io.open for file contents reading/writing

This commit is contained in:
Ivan Kravets committed 2020-03-05 23:52:13 +02:00
1 parent 3275bb59bf
commit ce6b96ea84
10 files changed
+56 -39

No files matched your search

+2 -1
View File
@@ -82,7 +82,8 @@ class LibBuilderFactory(object):
fname, piotool.SRC_BUILD_EXT + piotool.SRC_HEADER_EXT
):
continue
content = fs.get_file_contents(join(root, fname))
with open(join(root, fname)) as fp:
content = fp.read()
if not content:
continue
if "Arduino.h" in content and include_re.search(content):
+2 -2
View File
@@ -18,7 +18,6 @@ from hashlib import md5
from os import makedirs
from os.path import isdir, isfile, join
from platformio import fs
from platformio.compat import WINDOWS, hashlib_encode_data
# Windows CLI has limit with command length to 8192
@@ -67,7 +66,8 @@ def _file_long_data(env, data):
)
if isfile(tmp_file):
return tmp_file
fs.write_file_contents(tmp_file, data)
with open(tmp_file, "w") as fp:
fp.write(data)
return tmp_file