Skip to content

Commit 5f4e2c5

Browse files
eh, shuffle some things closer to the usage
1 parent 3d33d24 commit 5f4e2c5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

crates/djls-project/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,12 @@ impl PythonEnvironment {
129129
return None;
130130
}
131131

132-
let mut sys_path = Vec::new();
133-
134132
#[cfg(not(windows))]
135133
let bin_dir = prefix.join("bin");
136134
#[cfg(windows)]
137135
let bin_dir = prefix.join("Scripts");
138136

137+
let mut sys_path = Vec::new();
139138
sys_path.push(bin_dir); // Add bin/ or Scripts/
140139

141140
if let Some(site_packages) = Self::find_site_packages(prefix) {
@@ -157,12 +156,13 @@ impl PythonEnvironment {
157156
Ok(p) => p,
158157
Err(_) => return None,
159158
};
160-
let mut sys_path = Vec::new();
161159

162160
// which() might return a path inside a bin/Scripts dir, or directly the executable
163161
// We need the prefix, which is usually two levels up from the executable in standard layouts
164162
let bin_dir = python_path.parent()?;
165163
let prefix = bin_dir.parent()?;
164+
165+
let mut sys_path = Vec::new();
166166
sys_path.push(bin_dir.to_path_buf());
167167

168168
if let Some(site_packages) = Self::find_site_packages(prefix) {

0 commit comments

Comments
 (0)