Skip to content

Commit dc65c18

Browse files
Revert "eh, shuffle some things closer to the usage"
This reverts commit 5f4e2c5.
1 parent 5f4e2c5 commit dc65c18

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,12 +129,13 @@ impl PythonEnvironment {
129129
return None;
130130
}
131131

132+
let mut sys_path = Vec::new();
133+
132134
#[cfg(not(windows))]
133135
let bin_dir = prefix.join("bin");
134136
#[cfg(windows)]
135137
let bin_dir = prefix.join("Scripts");
136138

137-
let mut sys_path = Vec::new();
138139
sys_path.push(bin_dir); // Add bin/ or Scripts/
139140

140141
if let Some(site_packages) = Self::find_site_packages(prefix) {
@@ -156,13 +157,12 @@ impl PythonEnvironment {
156157
Ok(p) => p,
157158
Err(_) => return None,
158159
};
160+
let mut sys_path = Vec::new();
159161

160162
// which() might return a path inside a bin/Scripts dir, or directly the executable
161163
// We need the prefix, which is usually two levels up from the executable in standard layouts
162164
let bin_dir = python_path.parent()?;
163165
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)