-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(linux): ensure secretstorage is bundled in Linux binary (ACS-310) #1211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
43484a4
84a88b2
71ae9ed
d19e4ae
b7add38
a076eb0
b20d2c5
c691900
109ad58
7a9b813
b3d403d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -710,17 +710,20 @@ async function downloadPython(targetPlatform, targetArch, options = {}) { | |
| // Note: Same list exists in python-env-manager.ts - keep them in sync | ||
| // This validation assumes traditional Python packages with __init__.py (not PEP 420 namespace packages) | ||
| // pywin32 is platform-critical for Windows (ACS-306) - required by MCP library | ||
| // Note: We check for 'pywintypes' instead of 'pywin32' because pywin32 installs | ||
| // top-level modules (pywintypes, win32api, win32con, win32com) without a pywin32/__init__.py | ||
| // secretstorage is platform-critical for Linux (ACS-310) - required for OAuth token storage | ||
| const platformCriticalPackages = { | ||
| 'win32': ['pywintypes'], // Check for 'pywintypes' instead of 'pywin32' (pywin32 installs top-level modules) | ||
| 'linux': ['secretstorage'] // Linux OAuth token storage via Freedesktop.org Secret Service | ||
| }; | ||
| const criticalPackages = ['claude_agent_sdk', 'dotenv', 'pydantic_core'] | ||
| .concat(info.nodePlatform === 'win32' ? ['pywintypes'] : []); | ||
| .concat(platformCriticalPackages[info.nodePlatform] || []); | ||
| const missingPackages = criticalPackages.filter(pkg => { | ||
| const pkgPath = path.join(sitePackagesDir, pkg); | ||
| const initFile = path.join(pkgPath, '__init__.py'); | ||
| const initPath = path.join(pkgPath, '__init__.py'); | ||
| // For single-file modules (like pywintypes.py), check for the file directly | ||
| const moduleFile = path.join(sitePackagesDir, pkg + '.py'); | ||
| // Package is valid if directory+__init__.py exists OR single-file module exists | ||
| return !fs.existsSync(initFile) && !fs.existsSync(moduleFile); | ||
| return !(fs.existsSync(pkgPath) && fs.existsSync(initPath)) && !fs.existsSync(moduleFile); | ||
| }); | ||
|
||
|
|
||
| if (missingPackages.length > 0) { | ||
|
|
@@ -819,17 +822,20 @@ async function downloadPython(targetPlatform, targetArch, options = {}) { | |
| // Note: Same list exists in python-env-manager.ts - keep them in sync | ||
| // This validation assumes traditional Python packages with __init__.py (not PEP 420 namespace packages) | ||
| // pywin32 is platform-critical for Windows (ACS-306) - required by MCP library | ||
| // Note: We check for 'pywintypes' instead of 'pywin32' because pywin32 installs | ||
| // top-level modules (pywintypes, win32api, win32con, win32com) without a pywin32/__init__.py | ||
| // secretstorage is platform-critical for Linux (ACS-310) - required for OAuth token storage | ||
| const platformCriticalPackages = { | ||
| 'win32': ['pywintypes'], // Check for 'pywintypes' instead of 'pywin32' (pywin32 installs top-level modules) | ||
| 'linux': ['secretstorage'] // Linux OAuth token storage via Freedesktop.org Secret Service | ||
| }; | ||
| const criticalPackages = ['claude_agent_sdk', 'dotenv', 'pydantic_core'] | ||
| .concat(info.nodePlatform === 'win32' ? ['pywintypes'] : []); | ||
| .concat(platformCriticalPackages[info.nodePlatform] || []); | ||
| const postInstallMissing = criticalPackages.filter(pkg => { | ||
| const pkgPath = path.join(sitePackagesDir, pkg); | ||
| const initFile = path.join(pkgPath, '__init__.py'); | ||
| const initPath = path.join(pkgPath, '__init__.py'); | ||
| // For single-file modules (like pywintypes.py), check for the file directly | ||
| const moduleFile = path.join(sitePackagesDir, pkg + '.py'); | ||
| // Package is valid if directory+__init__.py exists OR single-file module exists | ||
| return !fs.existsSync(initFile) && !fs.existsSync(moduleFile); | ||
| return !(fs.existsSync(pkgPath) && fs.existsSync(initPath)) && !fs.existsSync(moduleFile); | ||
| }); | ||
|
|
||
| if (postInstallMissing.length > 0) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change appears to introduce a regression related to
pywin32validation on Windows. The previous implementation (from ACS-306) validated this dependency on all Windows Python versions, as it was deemed critical for the MCP library. This new logic restricts the check to only Python 3.12+, which could lead to runtime errors for users on older Python versions on Windows.The removed tests (
test_windows_python_311_validates_pywin32,test_windows_python_310_validates_pywin32) confirm this was the intended behavior before. Ifpywin32is still required for all versions, this condition should be reverted.