代码拉取完成,页面将自动刷新
同步操作将从 OpenHarmony/communication_dsoftbus 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 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
from PyInquirer import prompt
def enable_option(file_name):
option_list = []
try:
with open('.config', 'r') as config_file:
for line in config_file:
if line.startswith('CONFIG_'):
str1 = line.split('=')
option_list.append(str1[0][7:])
except IOError:
print('No config file')
return
if os.path.exists('.config'):
os.remove('.config')
file_data = ''
with open(file_name, 'r') as gni_file:
for line in gni_file:
if '=' in line:
str1 = line.split('=')
if str1[0].strip() in option_list:
line = str1[0] + '= true\n'
else:
line = str1[0] + '= false\n'
file_data += line
flags = os.O_WRONLY | os.O_CREAT
modes = stat.S_IWUSR | stat.S_IRUSR
with os.fdopen(os.open(file_name, flags, modes), 'w')as gni_file
gni_file.write(file_data)
def ask_option():
options_prompt = {
'type': 'list',
'name': 'option',
'message': 'Which platform do you want to config?',
'default': 'standard',
'choices': ['standard', 'small', 'mini']
}
answers = prompt(options_prompt)
return answers['option']
def main():
print('##### Welcome to Dsoftbus #####')
option = ask_option()
subprocess.call(['menuconfig'])
file_gni = './adapter/default_config/feature_config/platform/config.gni'
if (option == 'standard'):
file_gni = file_gni.replace('platform', 'standard')
elif (option == 'small'):
file_gni = file_gni.replace('platform', 'small')
else:
file_gni = file_gni.replace('platform', 'mini')
enable_option(file_gni)
if __name__ == '__main__':
sys.exit(main())
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。