代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/xts_hats 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2020-2021 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import os
import sys
import subprocess
import hashlib
import json5
def get_file_md5(file_path):
hash_md5 = hashlib.md5()
with open(file_path, "rb") as f:
for chunk in iter(lambda: f.read(4096), b""):
hash_md5.update(chunk)
return hash_md5.hexdigest()
def get_hvigor_version(json_file):
with open(json_file, 'r') as f:
data = json5.load(f)
return data.get('hvigorVersion')
return "0.0.0"
def output_unmatched_project(prject_list, filename):
print("")
print(
"Error: The {} in the following directory does not meet the requirements:"
.format(filename))
for prj in prject_list:
print(prj[0], prj[1])
print("")
def check_hvigor_wrapper_js(hvigor_prj_list):
unmatch_info = []
baseline_md5 = "558a3eec8ee9e753b63f99abe79c0ec3"
for dir in hvigor_prj_list:
filename = os.path.join(dir, 'hvigor', 'hvigor-wrapper.js')
md5 = get_file_md5(filename)
if md5 != baseline_md5:
unmatch_info.append((md5, filename))
if len(unmatch_info):
output_unmatched_project(unmatch_info, 'hvigor-wrapper.js')
print('Please copy from {}'.format('test/xts/acts/arkcompiler/ecmanewfeatures/hvigor/hvigor-wrapper.js'))
return False
return True
def check_hvigor_version(hvigor_prj_list):
unmatch_prj_list = []
baseline_version = '4.0.2'
for dir in hvigor_prj_list:
filename = os.path.join(dir, 'hvigor', 'hvigor-config.json5')
version = get_hvigor_version(filename)
if version != baseline_version:
unmatch_prj_list.append((version, filename))
if len(unmatch_prj_list):
output_unmatched_project(unmatch_prj_list, 'hvigor-config.json5')
print("Plesse use {}".format(baseline_version))
return False
return True
def get_hvigor_prject_list(directory):
hvigor_prj_list = []
for root, dirs, files in os.walk(directory):
for dir in dirs:
if dir == 'hvigor':
hvigor_prj_list.append(root)
return hvigor_prj_list
if __name__ == "__main__":
this_file = os.path.realpath(__file__)
curr_dir = os.path.dirname(this_file)
hvigor_prj_list = get_hvigor_prject_list(curr_dir)
js_valid = check_hvigor_wrapper_js(hvigor_prj_list)
json_valid = check_hvigor_version(hvigor_prj_list)
if not js_valid or not json_valid:
sys.exit(1)
sys.exit(0)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。