1use std::path::{Path, PathBuf};
2
3use uv_pypi_types::Scheme;
4
5#[derive(Debug, Clone)]
8pub struct Target(PathBuf);
9
10impl Target {
11 pub fn scheme(&self) -> Scheme {
13 Scheme {
14 purelib: self.0.clone(),
15 platlib: self.0.clone(),
16 scripts: self.0.join("bin"),
17 data: self.0.clone(),
18 include: self.0.join("include"),
19 }
20 }
21
22 pub fn site_packages(&self) -> impl Iterator<Item = &Path> {
24 std::iter::once(self.0.as_path())
25 }
26
27 pub fn init(&self) -> std::io::Result<()> {
29 fs_err::create_dir_all(&self.0)?;
30 Ok(())
31 }
32
33 pub fn root(&self) -> &Path {
35 &self.0
36 }
37}
38
39impl From<PathBuf> for Target {
40 fn from(path: PathBuf) -> Self {
41 Self(path)
42 }
43}