Add support for subdirectories in URL dependencies (#312)

Closes https://github.com/astral-sh/puffin/issues/307.
This commit is contained in:
Charlie Marsh 2023-11-03 12:28:38 -07:00 committed by GitHub
parent cbfd6af125
commit edce4ccb24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 155 additions and 29 deletions

View file

@ -21,7 +21,10 @@ pub(crate) struct BuildArgs {
/// Directory to story the built wheel in
#[clap(short, long)]
wheels: Option<PathBuf>,
/// The source distribution to build, either a directory or a source archive.
sdist: PathBuf,
/// The subdirectory to build within the source distribution.
subdirectory: Option<PathBuf>,
}
/// Build a source distribution to a wheel
@ -49,9 +52,13 @@ pub(crate) async fn build(args: BuildArgs) -> Result<PathBuf> {
venv.interpreter_info().clone(),
fs::canonicalize(venv.python_executable())?,
);
let builder =
SourceDistributionBuilder::setup(&args.sdist, venv.interpreter_info(), &build_dispatch)
.await?;
let builder = SourceDistributionBuilder::setup(
&args.sdist,
args.subdirectory.as_deref(),
venv.interpreter_info(),
&build_dispatch,
)
.await?;
let wheel = builder.build(&wheel_dir)?;
Ok(wheel_dir.join(wheel))
}