<reponame>opengauss-mirror/Yat
#!/usr/bin/env python
# encoding=utf-8
"""
Copyright (c) 2021 Huawei Technologies Co.,Ltd.

openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:

          http://license.coscl.org.cn/MulanPSL2

THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
"""

import os

from yat.guard.utils import get_second_ext


def _split_case_name(script):
    basename = os.path.basename(script)
    name1, ext1 = os.path.splitext(basename)
    name2, ext2 = os.path.splitext(name1)
    if ext2 in get_second_ext():
        return name2, (ext2, ext1)
    else:
        return name1, (ext1,)
