1#!/usr/bin/env python 2# -*- coding: utf-8 -*- 3# Copyright (c) 2021 Huawei Device Co., Ltd. 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16import os 17import sys 18import subprocess 19 20 21def main(argv): 22 if len(argv) != 3: # this is called by build system, must has 3 args. 23 print("argv count error, return!") 24 return 25 26 path = argv[1] 27 folder = os.path.exists(path) 28 if not folder: 29 os.makedirs(path) 30 print("make folder OK") 31 else: 32 print("folder already existed") 33 34 symlink_path = argv[2] 35 src_path = os.path.abspath(path) 36 print("skia path is : " + src_path) 37 dst_path = os.path.abspath(symlink_path) 38 print("symlink path is: " + dst_path) 39 subprocess.run(['ln', '-sf', dst_path, src_path]) 40 41if __name__ == '__main__': 42 main(sys.argv) 43