Commit 5096ec45 authored by 智勇's avatar 智勇

增加‘--’适配

parent 50db106d
...@@ -8,6 +8,7 @@ import os.path ...@@ -8,6 +8,7 @@ import os.path
import re import re
import copy import copy
import sys import sys
import string
f = io.open('replace_config.yaml', 'r', encoding='utf-8') f = io.open('replace_config.yaml', 'r', encoding='utf-8')
res = yaml.load(f) res = yaml.load(f)
...@@ -16,11 +17,9 @@ print("全部配置信息:", res) ...@@ -16,11 +17,9 @@ print("全部配置信息:", res)
# 获取当前项目的配置 # 获取当前项目的配置
env = os.environ env = os.environ
project = env.get('SYSTEM_NAME') project = env.get('SYSTEM_NAME')
distPath = os.path.abspath(project + '/dist')
config = res.get(project, res.get('common')) config = res.get(project, res.get('common'))
config = sorted(config.items(), key=lambda rule: (rule[1]['order'], rule[0])) config = sorted(config.items(), key=lambda rule: (rule[1]['order'], rule[0]))
print(project, "的配置信息:", config) print(project, "的配置信息:", config)
print("dist路径:", distPath)
namespace = env.get('NAMESPACE') namespace = env.get('NAMESPACE')
print('namespace:', namespace) print('namespace:', namespace)
...@@ -37,8 +36,17 @@ def findFile (dir): ...@@ -37,8 +36,17 @@ def findFile (dir):
for sub in os.listdir(dir): for sub in os.listdir(dir):
findFile(dir + '/' + sub) findFile(dir + '/' + sub)
distPaths = []
if '--' in project:
distPaths.append(os.path.abspath(project.split('--')[0] + '/dist'))
distPaths.append(os.path.abspath(project.split('--')[1] + '/dist'))
else:
distPaths.append(os.path.abspath(project + '/dist'))
# 过滤符合要求的文件路径 # 过滤符合要求的文件路径
findFile(distPath) for distPath in distPaths:
print("dist路径:", distPath)
findFile(distPath)
# 替换文件中的内容 # 替换文件中的内容
for file in files: for file in files:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment