|
7 | 7 | from one_dragon.utils import os_utils |
8 | 8 |
|
9 | 9 | DEFAULT_ENV_PATH = os_utils.get_path_under_work_dir('.install') |
10 | | -DEFAULT_GIT_DIR_PATH = os.path.join(DEFAULT_ENV_PATH, 'MinGit') # 默认的git文件夹路径 |
11 | | -DEFAULT_GIT_PATH = os.path.join(DEFAULT_GIT_DIR_PATH, 'cmd', 'git.exe') # 默认的git.exe文件路径 |
12 | 10 | DEFAULT_UV_DIR_PATH = os.path.join(DEFAULT_ENV_PATH, 'uv') # 默认的uv文件夹路径 |
13 | 11 | DEFAULT_UV_PATH = os.path.join(DEFAULT_UV_DIR_PATH, 'uv.exe') # 默认的uv.exe文件路径 |
14 | 12 | DEFAULT_PYTHON_DIR_PATH = os.path.join(DEFAULT_ENV_PATH, 'python') # 默认的python文件夹路径 |
@@ -51,6 +49,11 @@ class PipSourceEnum(Enum): |
51 | 49 | TSING_HUA = ConfigItem('清华大学', 'https://pypi.tuna.tsinghua.edu.cn/simple') |
52 | 50 | ALIBABA = ConfigItem('阿里云', 'https://mirrors.aliyun.com/pypi/simple') |
53 | 51 |
|
| 52 | +class GitRemoteEnum(Enum): |
| 53 | + |
| 54 | + ORIGIN = ConfigItem('origin') |
| 55 | + UPSTREAM = ConfigItem('upstream') |
| 56 | + |
54 | 57 |
|
55 | 58 | class GitBranchEnum(Enum): |
56 | 59 |
|
@@ -83,22 +86,6 @@ class EnvConfig(YamlConfig): |
83 | 86 | def __init__(self): |
84 | 87 | YamlConfig.__init__(self, module_name='env') |
85 | 88 |
|
86 | | - @property |
87 | | - def git_path(self) -> str: |
88 | | - """ |
89 | | - :return: git的路径 |
90 | | - """ |
91 | | - return self.get('git_path', '') |
92 | | - |
93 | | - @git_path.setter |
94 | | - def git_path(self, new_value: str) -> None: |
95 | | - """ |
96 | | - 更新 git的路径 正常不需要调用 |
97 | | - :param new_value: |
98 | | - :return: |
99 | | - """ |
100 | | - self.update('git_path', new_value) |
101 | | - |
102 | 89 | @property |
103 | 90 | def uv_path(self) -> str: |
104 | 91 | """ |
@@ -289,6 +276,22 @@ def pip_trusted_host(self) -> str: |
289 | 276 | """ |
290 | 277 | return urllib.parse.urlparse(self.pip_source).netloc |
291 | 278 |
|
| 279 | + @property |
| 280 | + def git_remote(self) -> str: |
| 281 | + """ |
| 282 | + 远程 |
| 283 | + :return: |
| 284 | + """ |
| 285 | + return self.get('git_remote', GitRemoteEnum.ORIGIN.value.value) |
| 286 | + |
| 287 | + @git_remote.setter |
| 288 | + def git_remote(self, new_value: str) -> None: |
| 289 | + """ |
| 290 | + 远程 |
| 291 | + :return: |
| 292 | + """ |
| 293 | + self.update('git_remote', new_value) |
| 294 | + |
292 | 295 | @property |
293 | 296 | def git_branch(self) -> str: |
294 | 297 | """ |
|
0 commit comments