Skip to content

Commit 43b83dc

Browse files
committed
feat: add bilingual prompts to Configure-PythonPth
- Add configuring_pth_file message when starting configuration - Add pth_file_configured message on success - Add python_pth_config_failed message definition
1 parent dbdbfc4 commit 43b83dc

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

tools/install.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,9 @@ $script:Messages = @{
384384
python_path_directory_exists = "Error: Directory already exists: {0}. Please specify a different path."
385385
extracting_archive = "Extracting archive: {0}"
386386
cleanup_archive = "Cleaning up archive..."
387+
configuring_pth_file = "Configuring .pth file: {0}"
388+
pth_file_configured = ".pth file configured successfully"
389+
python_pth_config_failed = "Failed to configure .pth file"
387390
downloading_touch_env = "Downloading touch_env.py from: {0}"
388391
touch_env_download_failed = "Failed to download touch_env.py: {0}"
389392
ssl_verification_failed = "SSL verification failed, retrying without verification..."
@@ -461,6 +464,9 @@ $script:Messages = @{
461464
python_path_directory_exists = "错误: 目录已存在: {0}。请指定其他路径。"
462465
extracting_archive = "正在解压存档: {0}"
463466
cleanup_archive = "正在清理存档..."
467+
configuring_pth_file = "正在配置 .pth 文件: {0}"
468+
pth_file_configured = ".pth 文件配置成功"
469+
python_pth_config_failed = "配置 .pth 文件失败"
464470
downloading_touch_env = "正在下载 touch_env.py,自: {0}"
465471
touch_env_download_failed = "下载 touch_env.py 失败: {0}"
466472
ssl_verification_failed = "SSL 验证失败,正在重试(不验证证书)..."
@@ -750,7 +756,6 @@ function Install-Git {
750756
# Install-Python: Install portable Python
751757
# Download-PortablePython: Download portable Python
752758
# Extract-PortablePython: Extract portable Python
753-
# Enable-LongPathSupport: Enable Windows long path support
754759
# Configure-PythonPth: Configure Python _pth file
755760

756761
class PythonConfig {
@@ -1037,13 +1042,15 @@ function Configure-PythonPth {
10371042
# Modify python3xx._pth to enable site-packages and ensurepip
10381043
# Extract directory from PythonConfig.PythonPath (which includes python.exe)
10391044
$pythonTargetDir = Split-Path -Parent $script:Config.PythonConfig.PythonPath
1045+
Write-LogInfo "configuring_pth_file" $pythonTargetDir
10401046
try {
10411047
$pthFile = Get-ChildItem -Path $pythonTargetDir -Filter "*._pth" -ErrorAction Stop
10421048
if ($pthFile) {
10431049
$pthContent = Get-Content -Path $pthFile.FullName -Raw -ErrorAction Stop
10441050
# Uncomment import site to enable site-packages
10451051
$pthContent = $pthContent -replace "#import site", "import site"
10461052
Set-Content -Path $pthFile.FullName -Value $pthContent -NoNewline -ErrorAction Stop
1053+
Write-LogInfo "pth_file_configured"
10471054
}
10481055
}
10491056
catch {
@@ -1061,9 +1068,7 @@ function Install-PortablePython {
10611068
try {
10621069
Download-PortablePython -UseCNMirror $UseCNMirror
10631070
Extract-PortablePython
1064-
if ($script:Config.IsAdmin) {
1065-
Enable-LongPathSupport
1066-
}
1071+
10671072
Configure-PythonPth
10681073
# Save portable Python path to global variable
10691074
$portablePython = $script:Config.PythonConfig.PythonPath

0 commit comments

Comments
 (0)