Skip to content

Commit

Permalink
Revert "fix: disable reverse uv syncing (#3704)"
Browse files Browse the repository at this point in the history
This reverts commit d2b175e.
  • Loading branch information
jdx committed Dec 19, 2024
1 parent d2b175e commit 2b9f5a9
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
2 changes: 1 addition & 1 deletion docs/cli/sync/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Get tool versions from pyenv

### `--uv`

Sync tool versions from uv
Sync tool versions with uv (2-way sync)

Examples:

Expand Down
2 changes: 1 addition & 1 deletion mise.usage.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -1268,7 +1268,7 @@ This won't overwrite any existing installs but will overwrite any existing symli
$ uv run -p 3.10.0 -- python -V - uses mise-provided python
"
flag "--pyenv" help="Get tool versions from pyenv"
flag "--uv" help="Sync tool versions from uv"
flag "--uv" help="Sync tool versions with uv (2-way sync)"
}
cmd "ruby" help="Symlinks all ruby tool versions from an external tool into mise" {
after_long_help r"Examples:
Expand Down
58 changes: 27 additions & 31 deletions src/cli/sync/python.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use eyre::Result;
use itertools::sorted;
use std::env::consts::{ARCH, OS};

use crate::env::PYENV_ROOT;
use crate::{backend, config, dirs, env, file};
Expand All @@ -16,7 +17,7 @@ pub struct SyncPython {
#[clap(long)]
pyenv: bool,

/// Sync tool versions from uv
/// Sync tool versions with uv (2-way sync)
#[clap(long)]
uv: bool,
}
Expand Down Expand Up @@ -79,36 +80,31 @@ impl SyncPython {
}
}

// TODO: disable reverse syncing until there is a way to deal with these 2 files that uv needs:
// ❯ diff -rq uv mise
// Only in uv/lib/python3.11: EXTERNALLY-MANAGED
// Files uv/lib/python3.11/_sysconfigdata__darwin_darwin.py and mise/lib/python3.11/_sysconfigdata__darwin_darwin.py differ
// See https://github.com/jdx/mise/issues/3654
//let subdirs = file::dir_subdirs(&installed_python_versions_path)?;
//for v in sorted(subdirs) {
// if v.starts_with(".") {
// continue;
// }
// let src = installed_python_versions_path.join(&v);
// if src.is_symlink() {
// continue;
// }
// // ~/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none
// // ~/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu
// let os = OS;
// let arch = if cfg!(target_arch = "x86_64") {
// "x86_64-gnu"
// } else if cfg!(target_arch = "aarch64") {
// "aarch64-none"
// } else {
// ARCH
// };
// let dst = uv_versions_path.join(format!("cpython-{v}-{os}-{arch}"));
// if !dst.exists() {
// file::make_symlink(&src, &dst)?;
// miseprintln!("Synced python@{v} from mise to uv");
// }
//}
let subdirs = file::dir_subdirs(&installed_python_versions_path)?;
for v in sorted(subdirs) {
if v.starts_with(".") {
continue;
}
let src = installed_python_versions_path.join(&v);
if src.is_symlink() {
continue;
}
// ~/.local/share/uv/python/cpython-3.10.16-macos-aarch64-none
// ~/.local/share/uv/python/cpython-3.13.0-linux-x86_64-gnu
let os = OS;
let arch = if cfg!(target_arch = "x86_64") {
"x86_64-gnu"
} else if cfg!(target_arch = "aarch64") {
"aarch64-none"
} else {
ARCH
};
let dst = uv_versions_path.join(format!("cpython-{v}-{os}-{arch}"));
if !dst.exists() {
file::make_symlink(&src, &dst)?;
miseprintln!("Synced python@{v} from mise to uv");
}
}
Ok(())
}
}
Expand Down
2 changes: 1 addition & 1 deletion xtasks/fig/src/mise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2398,7 +2398,7 @@ const completionSpec: Fig.Spec = {
"name": [
"--uv"
],
"description": "Sync tool versions from uv",
"description": "Sync tool versions with uv (2-way sync)",
"isRepeatable": false
}
]
Expand Down

0 comments on commit 2b9f5a9

Please sign in to comment.