From c91bcda9d434c58547ce5e2e8f907d8e9d74e3e2 Mon Sep 17 00:00:00 2001 From: msyyc <70930885+msyyc@users.noreply.github.com> Date: Mon, 1 Feb 2021 16:28:50 +0800 Subject: [PATCH] Update auto_codegen.py (#16443) --- .../packaging_tools/auto_codegen.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/tools/azure-sdk-tools/packaging_tools/auto_codegen.py b/tools/azure-sdk-tools/packaging_tools/auto_codegen.py index b582247f772c..cbd97bf93ee9 100644 --- a/tools/azure-sdk-tools/packaging_tools/auto_codegen.py +++ b/tools/azure-sdk-tools/packaging_tools/auto_codegen.py @@ -25,15 +25,17 @@ def get_package_names(sdk_folder): def init_new_service(package_name, folder_name): - ci = Path(folder_name, 'ci.yml') - if not ci.exists(): + setup = Path(folder_name, package_name, 'setup.py') + if not setup.exists(): check_call(f'python -m packaging_tools --build-conf {package_name} -o {folder_name}', shell=True) - with open('ci_template.yml', 'r') as file_in: - content = file_in.readlines() - name = package_name.replace('azure-', '').replace('mgmt-', '') - content = [line.replace('MyService', name) for line in content] - with open(str(ci), 'w') as file_out: - file_out.writelines(content) + ci = Path(folder_name, 'ci.yml') + if not ci.exists(): + with open('ci_template.yml', 'r') as file_in: + content = file_in.readlines() + name = package_name.replace('azure-', '').replace('mgmt-', '') + content = [line.replace('MyService', name) for line in content] + with open(str(ci), 'w') as file_out: + file_out.writelines(content) def main(generate_input, generate_output):