Skip to content

Commit 177e276

Browse files
author
Thibaut Oprinsen
committed
fix: fix manifest_dir
fix: fix typo
1 parent 4f94186 commit 177e276

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

src/pack.rs

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ async fn build_local_package(
106106
.arg(output_dir)
107107
.arg("--build-platform")
108108
.arg(platform)
109-
.current_dir(manifest_dir);
109+
.arg("--manifest-path")
110+
.arg(manifest_path);
110111

111112
let is_verbose = tracing::enabled!(tracing::Level::WARN);
112113

@@ -200,14 +201,27 @@ pub async fn pack(options: PackOptions) -> Result<()> {
200201
conda_packages_from_lockfile.push(binary_data.clone())
201202
}
202203
LockedPackageRef::Conda(CondaPackageData::Source(source_data)) => {
203-
let base_dir = options.manifest_path.parent().unwrap_or(Path::new("."));
204-
let pkg_dir = base_dir.join(match &source_data.location {
205-
UrlOrPath::Path(p) => p.to_path().to_string(),
204+
let base_dir = if options.manifest_path.is_file() {
205+
options.manifest_path.parent().unwrap_or(Path::new("."))
206+
} else {
207+
&options.manifest_path
208+
};
209+
let relative_path = match &source_data.location {
210+
UrlOrPath::Path(p) => PathBuf::from(p.to_path().as_str()),
206211
UrlOrPath::Url(u) => {
207212
anyhow::bail!("Unexpected URL for local package source: {}", u)
208213
}
209-
});
214+
};
215+
216+
let pkg_dir = base_dir.join(&relative_path);
210217
let manifest_path = pkg_dir.join("pixi.toml");
218+
let canonical_manifest_path = manifest_path.canonicalize().map_err(|e| {
219+
anyhow!(
220+
"Cannot find manifest file {}: {}",
221+
manifest_path.display(),
222+
e
223+
)
224+
})?;
211225
let build_temp_dir = tempfile::tempdir()
212226
.map_err(|e| anyhow!("could not create temporary build directory: {}", e))?;
213227
let bar = ProgressBar::new_spinner();
@@ -222,7 +236,7 @@ pub async fn pack(options: PackOptions) -> Result<()> {
222236
bar.set_message(format!("Building {expected_filename}"));
223237
bar.enable_steady_tick(std::time::Duration::from_millis(100));
224238
build_local_package(
225-
&manifest_path,
239+
&canonical_manifest_path,
226240
build_temp_dir.path(),
227241
options.platform.as_str(),
228242
)

0 commit comments

Comments
 (0)