8 Star 1 Fork 12

src-openEuler/distributed-build

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0017-feat-add-script-to-create-soft-link.patch 1.91 KB
一键复制 编辑 原始数据 按行查看 历史
zxstty 提交于 2023-12-06 15:52 +08:00 . change by zjq
From 0d541aba54454543bcfc9f9047f87d1570413b1b Mon Sep 17 00:00:00 2001
From: zxstty <zhaojiaqi18@huawei.com>
Date: Thu, 9 Nov 2023 11:10:53 +0800
Subject: [PATCH] 0017
---
openeuler/script/link.py | 46 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
create mode 100755 openeuler/script/link.py
diff --git a/openeuler/script/link.py b/openeuler/script/link.py
new file mode 100755
index 0000000..585123e
--- /dev/null
+++ b/openeuler/script/link.py
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# Copyright (c) 2021 Hoperun 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 argparse
+
+# create parent directory
+def create_dir(dir):
+ dir_items = dir.split("/")
+ full_name = ""
+ length = len(dir_items) - 1
+ for i in range(length):
+ full_name += "/" + dir_items[i]
+ if not os.path.exists(full_name):
+ os.mkdir(full_name)
+
+def main():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--src_target', required=True)
+ parser.add_argument('--dest_target', required=True)
+ args = parser.parse_args()
+
+ src_target = args.src_target
+ dest_target = args.dest_target
+
+ if os.path.exists(dest_target):
+ os.unlink(dest_target)
+ create_dir(dest_target)
+ return os.symlink(src_target, dest_target)
+
+if __name__ == '__main__':
+ sys.exit(main())
+
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/distributed-build.git
git@gitee.com:src-openeuler/distributed-build.git
src-openeuler
distributed-build
distributed-build
master

搜索帮助