Skip to content

Commit

Permalink
Merge pull request #7 from tdejager/feat/use-input-globs
Browse files Browse the repository at this point in the history
feat: notify of input globs
  • Loading branch information
tdejager authored Sep 20, 2024
2 parents 35d4cdb + 95f91a9 commit 2e46f55
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 2 deletions.
47 changes: 46 additions & 1 deletion crates/pixi-build/src/bin/pixi-build-python/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,48 @@ impl PythonBuildBackend {
}
}

/// Determines the build input globs for given python package
/// even this will be probably backend specific, e.g setuptools
/// has a different way of determining the input globs than hatch etc.
///
/// However, lets take everything in the directory as input for now
fn input_globs() -> Vec<String> {
vec![
// Source files
"**/*.py",
"**/*.pyx",
"**/*.c",
"**/*.cpp",
"**/*.sh",
// Common data files
"**/*.json",
"**/*.yaml",
"**/*.yml",
"**/*.txt",
// Project configuration
"setup.py",
"setup.cfg",
"pyproject.toml",
"requirements*.txt",
"Pipfile",
"Pipfile.lock",
"poetry.lock",
"tox.ini",
// Build configuration
"Makefile",
"MANIFEST.in",
"tests/**/*.py",
"docs/**/*.rst",
"docs/**/*.md",
// Versioning
"VERSION",
"version.py",
]
.iter()
.map(|s| s.to_string())
.collect()
}

#[async_trait::async_trait]
impl Protocol for PythonBuildBackend {
async fn get_conda_metadata(
Expand Down Expand Up @@ -431,7 +473,10 @@ impl Protocol for PythonBuildBackend {
.within_context_async(move || async move { run_build(output, &tool_config).await })
.await?;

Ok(CondaBuildResult { path: package })
Ok(CondaBuildResult {
output_file: package,
input_globs: input_globs(),
})
}
}

Expand Down
6 changes: 5 additions & 1 deletion crates/pixi-build/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ async fn build(factory: impl ProtocolFactory, manifest_path: &Path) -> miette::R
})
.await?;

eprintln!("Successfully build '{}'", result.path.display());
eprintln!("Successfully build '{}'", result.output_file.display());
eprintln!("Use following globs to revalidate: ");
for glob in result.input_globs {
eprintln!(" - {}", glob);
}

Ok(())
}

0 comments on commit 2e46f55

Please sign in to comment.