Skip to content

Commit fa70147

Browse files
committed
fix(win): fix windows sync: native exe detection and stale dist-info check
- Windows conda envs have python.exe in venv root, not Scripts/; is_native check was always False so sync never ran - Removed OMNIPKG_ENABLE_SYNC guard; sync now runs by default on Windows - __editable__.omnipkg-*.dist-info (pip dot format) was invisible to conflicting_installs glob which only matched omnipkg-*.dist-info; stale editable installs (2.2.3, 2.5.0) were never detected as conflicts - Removed scary Windows warning about live processes Modified: • src/omnipkg/core.py (+12/-15 lines) • .gitignore (+1/-0 lines) [gitship-generated]
1 parent 4b45f30 commit fa70147

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,4 @@ src/omnipkg/_vendor/uv_ffi/__pycache__/
207207
src/omnipkg/_vendor/wheels/
208208
*hunk_merger*.json
209209
.hunk_merger_state.json
210+
.gitattributes

src/omnipkg/core.py

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6301,13 +6301,17 @@ def _self_heal_omnipkg_installation(self):
63016301

63026302
# === SAFETY CHECK 1: Determine if we're the native interpreter ===
63036303
if platform.system() == "Windows":
6304-
native_exe = self.config_manager.venv_path / "Scripts" / "python.exe"
6304+
native_exe_candidates = [
6305+
self.config_manager.venv_path / "python.exe",
6306+
self.config_manager.venv_path / "Scripts" / "python.exe",
6307+
]
63056308
else:
6306-
native_exe = self.config_manager.venv_path / "bin" / "python"
6309+
native_exe_candidates = [self.config_manager.venv_path / "bin" / "python"]
63076310

63086311
current_exe = Path(sys.executable).resolve()
6312+
native_exe = native_exe_candidates[0]
63096313
native_exe_resolved = native_exe.resolve()
6310-
is_native = current_exe == native_exe_resolved
6314+
is_native = any(current_exe == c.resolve() for c in native_exe_candidates)
63116315

63126316
# Non-native interpreters should NEVER trigger syncs (prevents race conditions)
63136317
if not is_native:
@@ -6321,12 +6325,7 @@ def _self_heal_omnipkg_installation(self):
63216325
safe_print(" ℹ️ Sync disabled via OMNIPKG_DISABLE_SYNC")
63226326
return
63236327

6324-
# Windows: Extra conservative - disable sync by default unless explicitly enabled
6325-
if platform.system() == "Windows":
6326-
if os.environ.get("OMNIPKG_ENABLE_SYNC") != "1":
6327-
if "--verbose" in sys.argv or "-V" in sys.argv:
6328-
safe_print(" ℹ️ Windows sync disabled (set OMNIPKG_ENABLE_SYNC=1 to enable)")
6329-
return
6328+
# Windows sync enabled by default (path detection fixed)
63306329

63316330
try:
63326331
# === TIER 0: FILE-BASED CACHE CHECK (MICROSECONDS) ===
@@ -6401,11 +6400,7 @@ def _self_heal_omnipkg_installation(self):
64016400

64026401
# === TIER 3: HEALING REQUIRED (ONLY WHEN NECESSARY) ===
64036402
# Extra safety: Warn on Windows
6404-
if platform.system() == "Windows":
6405-
safe_print(
6406-
" ⚠️ Sync needed on Windows - this may cause issues if other processes are active"
6407-
)
6408-
safe_print(" 💡 Set OMNIPKG_DISABLE_SYNC=1 to disable auto-sync")
6403+
64096404

64106405
self._perform_concurrent_healing(master_version_str, install_spec, sync_needed)
64116406

@@ -6607,8 +6602,10 @@ def _check_sync_status_ultra_fast(self, master_version: str) -> List[Tuple[str,
66076602

66086603
# If none of the expected patterns exist, sync is needed
66096604
# First, check for ANY installed omnipkg metadata. This is the ground truth.
6605+
# Also check __editable__.omnipkg-*.dist-info pattern (pip uses dot not triple-underscore)
6606+
_all_di = list(site_packages.glob("omnipkg-*.dist-info")) + list(site_packages.glob("__editable__.omnipkg-*.dist-info"))
66106607
conflicting_installs = [
6611-
p for p in site_packages.glob("omnipkg-*.dist-info")
6608+
p for p in _all_di
66126609
if p.name != expected_dist_info and p.name != expected_editable_dist_info
66136610
]
66146611

0 commit comments

Comments
 (0)