From c5cc377a23446449808bc12fa36140b375e58087 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 18 Apr 2024 18:57:07 +0200 Subject: [PATCH 1/2] try uv trampoline --- crates/rattler/Cargo.toml | 2 + .../uv-trampoline-aarch64-console.exe | Bin 0 -> 18432 bytes .../uv-trampoline-x86_64-console.exe | Bin 0 -> 18944 bytes crates/rattler/src/install/entry_point.rs | 95 ++++++++++-------- crates/rattler/src/install/mod.rs | 3 +- 5 files changed, 54 insertions(+), 46 deletions(-) create mode 100755 crates/rattler/resources/uv-trampoline-aarch64-console.exe create mode 100644 crates/rattler/resources/uv-trampoline-x86_64-console.exe diff --git a/crates/rattler/Cargo.toml b/crates/rattler/Cargo.toml index dde928665..145b5b244 100644 --- a/crates/rattler/Cargo.toml +++ b/crates/rattler/Cargo.toml @@ -48,6 +48,8 @@ tokio-stream = { workspace = true, features = ["sync"] } tracing = { workspace = true } url = { workspace = true, features = ["serde"] } uuid = { workspace = true, features = ["v4", "fast-rng"] } +zip.workspace = true +dunce.workspace = true [dev-dependencies] assert_matches = { workspace = true } diff --git a/crates/rattler/resources/uv-trampoline-aarch64-console.exe b/crates/rattler/resources/uv-trampoline-aarch64-console.exe new file mode 100755 index 0000000000000000000000000000000000000000..7a01a6cb5c3a9d2751897d2a75d713005b2aa9d0 GIT binary patch literal 18432 zcmeHv4Rlk-mH#}+*pe||{DBFO=po2r3vBddTXq1;22wskLTrafj3vsfWm(Y{^*?%@9ByFT^8k&VPq-g`Br<;G+wtQr1PrLt(3?wUK(g5a5Z9x0G z^PX(kA!)nYv+dcFcaA)7X71dtxpU{v9my-c@;K8n#xn3pCK-DjB|T35_w)a}gYNN$ zH^#F)`kzjJUAXP1(;M47L9rv?UmI|>i*A?C=MRa^k{Iani5{Q0=#B=l-QOaWjT@Ie zQ$-#5_xbOC^j5>8!=L&`&#UzhP~J5EJCB~><(-dFS?_VT5$tHrRxW0&C7Q|JyyX)q z)pwQ|*;vi^S&WDo)z(~;^n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N7~-rM({tkI*brj~RxeSWmv*fjB8ChLe1A{wJ?gtF4yk}nkLS13F{W3ltaJEw}WM-M)6O8#(fvEdo?&q^$ z0-sl(-#Z3Fb>}425EqRFheo9DSYjt9vzF(^)`=|nN({vt2{>2bh#rD?xw-9-q)7er z>Du&G4Nq?srg!>$w`;o9Y^j~TSWTJdSe4C+AhQw<1+WiyS!YboXFO|0B+8DB%}}B* z>cXK*O+;(P^rv)axwu0N*f(SPrCHCK0RvvyirfSn-d{L0wWsqqLZj^xM$<$YDrBJk zoE{t(kAscv&r;%328+2(Py zS9)t5UYp0}sr6Oc|7L`>_;H!hURPUbH~TD=Hfyz`(oxgaR%x&Hn*Ft2v)5DiwJ*<-2kIR2l^pwrW>?aR2AqfF_4mEl^j1y)(? z)wR|t%O%b8!k#Z>!g*` &'static [u8] { match platform { Platform::Win32 => unimplemented!("32 bit windows is not supported for entry points"), - Platform::Win64 => include_bytes!("../../resources/launcher64.exe"), - Platform::WinArm64 => unimplemented!("arm64 windows is not supported for entry points"), + Platform::Win64 => include_bytes!("../../resources/uv-trampoline-x86_64-console.exe"), + Platform::WinArm64 => include_bytes!("../../resources/uv-trampoline-aarch64-console.exe"), _ => panic!("unsupported platform"), } } +const LAUNCHER_MAGIC_NUMBER: [u8; 4] = [b'P', b'I', b'X', b'I']; + /// Creates an "entry point" on disk for a Python entrypoint. Entrypoints are executable files that /// directly call a certain Python function. /// @@ -39,21 +46,8 @@ pub fn create_windows_python_entry_point( entry_point: &EntryPoint, python_info: &PythonInfo, target_platform: &Platform, -) -> Result<[PathsEntry; 2], std::io::Error> { - // Construct the path to where we will be creating the python entry point script. - let relative_path_script_py = python_info - .bin_dir - .join(format!("{}-script.py", &entry_point.command)); - - // Write the contents of the launcher script to disk - let script_path = target_dir.join(&relative_path_script_py); - std::fs::create_dir_all( - script_path - .parent() - .expect("since we joined with target_dir there must be a parent"), - )?; +) -> Result<[PathsEntry; 1], std::io::Error> { let script_contents = python_entry_point_template(target_prefix, entry_point, python_info); - let (hash, size) = write_and_hash(&script_path, script_contents)?; // Construct a path to where we will create the python launcher executable. let relative_path_script_exe = python_info @@ -62,34 +56,47 @@ pub fn create_windows_python_entry_point( // Include the bytes of the launcher directly in the binary so we can write it to disk. let launcher_bytes = get_windows_launcher(target_platform); - std::fs::write(target_dir.join(&relative_path_script_exe), launcher_bytes)?; - let fixed_launcher_digest = rattler_digest::parse_digest_from_hex::( - "28b001bb9a72ae7a24242bfab248d767a1ac5dec981c672a3944f7a072375e9a", - ) - .unwrap(); - - Ok([ - PathsEntry { - relative_path: relative_path_script_py, - // todo: clobbering of entry points not handled yet - original_path: None, - path_type: PathType::WindowsPythonEntryPointScript, - no_link: false, - sha256: Some(hash), - sha256_in_prefix: None, - size_in_bytes: Some(size as _), - }, - PathsEntry { - relative_path: relative_path_script_exe, - original_path: None, - path_type: PathType::WindowsPythonEntryPointExe, - no_link: false, - sha256: Some(fixed_launcher_digest), - sha256_in_prefix: None, - size_in_bytes: Some(launcher_bytes.len() as u64), - }, - ]) + let mut payload: Vec = Vec::new(); + { + // We're using the zip writer, but with stored compression + // https://github.com/njsmith/posy/blob/04927e657ca97a5e35bb2252d168125de9a3a025/src/trampolines/mod.rs#L75-L82 + // https://github.com/pypa/distlib/blob/8ed03aab48add854f377ce392efffb79bb4d6091/PC/launcher.c#L259-L271 + let stored = FileOptions::default().compression_method(zip::CompressionMethod::Stored); + let mut archive = ZipWriter::new(Cursor::new(&mut payload)); + let error_msg = "Writing to Vec should never fail"; + archive.start_file("__main__.py", stored).expect(error_msg); + archive + .write_all(script_contents.as_bytes()) + .expect(error_msg); + archive.finish().expect(error_msg); + } + + let python = PathBuf::from(target_prefix).join(&python_info.path); + let python_path = dunce::simplified(&python).display().to_string(); + + let mut launcher: Vec = Vec::with_capacity(launcher_bytes.len() + payload.len()); + launcher.extend_from_slice(launcher_bytes); + launcher.extend_from_slice(&payload); + launcher.extend_from_slice(python_path.as_bytes()); + launcher.extend_from_slice( + &u32::try_from(python_path.as_bytes().len()) + .expect("File Path to be smaller than 4GB") + .to_le_bytes(), + ); + launcher.extend_from_slice(&LAUNCHER_MAGIC_NUMBER); + + let (sha256, size) = write_and_hash(&target_dir.join(&relative_path_script_exe), launcher)?; + + Ok([PathsEntry { + relative_path: relative_path_script_exe, + original_path: None, + path_type: PathType::WindowsPythonEntryPointExe, + no_link: false, + sha256: Some(sha256), + sha256_in_prefix: None, + size_in_bytes: Some(size as u64), + }]) } /// Creates an "entry point" on disk for a Python entrypoint. Entrypoints are executable files that diff --git a/crates/rattler/src/install/mod.rs b/crates/rattler/src/install/mod.rs index f8ae06d8d..67ec34827 100644 --- a/crates/rattler/src/install/mod.rs +++ b/crates/rattler/src/install/mod.rs @@ -386,9 +386,8 @@ pub async fn link_package( &python_info, &platform, ) { - Ok([a, b]) => { + Ok([a]) => { let _ = tx.blocking_send(Ok((number_of_paths_entries, a))); - let _ = tx.blocking_send(Ok((number_of_paths_entries + 1, b))); } Err(e) => { let _ = tx.blocking_send(Err( From 7c8b845d6c71adf3dab18b6c6870c7f1ad893fb3 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 18 Apr 2024 19:27:35 +0200 Subject: [PATCH 2/2] make it work --- crates/rattler-bin/src/commands/create.rs | 17 ++++++++++++++--- crates/rattler/src/install/entry_point.rs | 9 ++++++--- crates/rattler/src/install/mod.rs | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/crates/rattler-bin/src/commands/create.rs b/crates/rattler-bin/src/commands/create.rs index 61669029f..126209cb5 100644 --- a/crates/rattler-bin/src/commands/create.rs +++ b/crates/rattler-bin/src/commands/create.rs @@ -26,7 +26,6 @@ use rattler_solve::{ resolvo, SolverImpl, SolverTask, }; use reqwest::Client; -use std::sync::Arc; use std::{ borrow::Cow, env, @@ -36,6 +35,7 @@ use std::{ str::FromStr, time::Duration, }; +use std::{fs, sync::Arc}; use tokio::task::JoinHandle; #[derive(Debug, clap::Parser)] @@ -60,12 +60,23 @@ pub struct Opt { #[clap(long)] timeout: Option, + + #[clap(long)] + target_prefix: Option, } pub async fn create(opt: Opt) -> anyhow::Result<()> { let channel_config = ChannelConfig::default(); - let target_prefix = env::current_dir()?.join(".prefix"); - + let target_prefix = opt.target_prefix.unwrap_or_else(|| { + env::current_dir() + .expect("could not find current dir") + .join(".prefix") + }); + // First create the target prefix if it doesn't exist yet. + fs::create_dir_all(&target_prefix).expect("could not create target prefix"); + // Canonicalize the target prefix so we can use it in the future. + let target_prefix = + fs::canonicalize(target_prefix).context("could not canonicalize target prefix")?; // Determine the platform we're going to install for let install_platform = if let Some(platform) = opt.platform { Platform::from_str(&platform)? diff --git a/crates/rattler/src/install/entry_point.rs b/crates/rattler/src/install/entry_point.rs index fbb18d798..1c98af0cb 100644 --- a/crates/rattler/src/install/entry_point.rs +++ b/crates/rattler/src/install/entry_point.rs @@ -8,7 +8,7 @@ use rattler_conda_types::{ use rattler_digest::HashingWriter; use rattler_digest::Sha256; use std::{ - fs::File, + fs::{self, File}, io::{self, Cursor, Write}, path::{Path, PathBuf}, }; @@ -24,7 +24,7 @@ pub fn get_windows_launcher(platform: &Platform) -> &'static [u8] { } } -const LAUNCHER_MAGIC_NUMBER: [u8; 4] = [b'P', b'I', b'X', b'I']; +const LAUNCHER_MAGIC_NUMBER: [u8; 4] = [b'U', b'V', b'U', b'V']; /// Creates an "entry point" on disk for a Python entrypoint. Entrypoints are executable files that /// directly call a certain Python function. @@ -74,6 +74,7 @@ pub fn create_windows_python_entry_point( let python = PathBuf::from(target_prefix).join(&python_info.path); let python_path = dunce::simplified(&python).display().to_string(); + println!("Python path: {}", python_path); let mut launcher: Vec = Vec::with_capacity(launcher_bytes.len() + payload.len()); launcher.extend_from_slice(launcher_bytes); @@ -86,7 +87,9 @@ pub fn create_windows_python_entry_point( ); launcher.extend_from_slice(&LAUNCHER_MAGIC_NUMBER); - let (sha256, size) = write_and_hash(&target_dir.join(&relative_path_script_exe), launcher)?; + let target_location = target_dir.join(&relative_path_script_exe); + fs::create_dir_all(target_location.parent().unwrap())?; + let (sha256, size) = write_and_hash(&target_location, launcher)?; Ok([PathsEntry { relative_path: relative_path_script_exe, diff --git a/crates/rattler/src/install/mod.rs b/crates/rattler/src/install/mod.rs index 67ec34827..453dfe4be 100644 --- a/crates/rattler/src/install/mod.rs +++ b/crates/rattler/src/install/mod.rs @@ -396,7 +396,7 @@ pub async fn link_package( } } }); - number_of_paths_entries += 2; + number_of_paths_entries += 1; } else { driver.spawn_throttled_and_forget(move || { // Return immediately if the receiver was closed. This can happen if a previous step