mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
docs: Correct Python coding style
This commit is contained in:
@@ -16,13 +16,14 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from io import open
|
||||
import re
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
def run_cmd_get_output(cmd):
|
||||
return os.popen(cmd).read().strip()
|
||||
|
||||
|
||||
def files_equal(path_1, path_2):
|
||||
if not os.path.exists(path_1) or not os.path.exists(path_2):
|
||||
return False
|
||||
@@ -34,6 +35,7 @@ def files_equal(path_1, path_2):
|
||||
file_2_contents = f_2.read()
|
||||
return file_1_contents == file_2_contents
|
||||
|
||||
|
||||
def copy_file_if_modified(src_file_path, dst_file_path):
|
||||
if not files_equal(src_file_path, dst_file_path):
|
||||
dst_dir_name = os.path.dirname(dst_file_path)
|
||||
@@ -41,6 +43,7 @@ def copy_file_if_modified(src_file_path, dst_file_path):
|
||||
os.makedirs(dst_dir_name)
|
||||
shutil.copy(src_file_path, dst_file_path)
|
||||
|
||||
|
||||
def copy_if_modified(src_path, dst_path):
|
||||
if os.path.isfile(src_path):
|
||||
copy_file_if_modified(src_path, dst_path)
|
||||
@@ -52,4 +55,3 @@ def copy_if_modified(src_path, dst_path):
|
||||
src_file_path = os.path.join(root, src_file_name)
|
||||
dst_file_path = os.path.join(dst_path + root[src_path_len:], src_file_name)
|
||||
copy_file_if_modified(src_file_path, dst_file_path)
|
||||
|
||||
|
Reference in New Issue
Block a user