@@ -370,11 +370,6 @@ fn build_input_globs(
370
370
// Always add the current directory of the package to the globs
371
371
let mut input_globs = vec ! [ "*/**" . to_string( ) ] ;
372
372
373
- // TODO: Remove this condition when working on https://github.com/prefix-dev/pixi/issues/3785
374
- if !source. is_absolute ( ) {
375
- return Ok ( input_globs) ;
376
- }
377
-
378
373
// Get parent directory path
379
374
let parent = if source. is_file ( ) {
380
375
// use the parent path as glob
@@ -386,6 +381,11 @@ fn build_input_globs(
386
381
// If there are sources add them to the globs as well
387
382
if let Some ( package_sources) = package_sources {
388
383
for source in package_sources {
384
+ let source = if source. is_absolute ( ) {
385
+ source
386
+ } else {
387
+ parent. join ( source)
388
+ } ;
389
389
let source_glob = relative_path_joined ( & parent, & source) ?;
390
390
if source. is_dir ( ) {
391
391
input_globs. push ( format ! ( "{}/**" , source_glob) ) ;
@@ -718,4 +718,25 @@ mod tests {
718
718
// The relative path from source_dir to package_source_dir should be "../pkgsrc/**"
719
719
assert_eq ! ( globs, vec![ "*/**" , "../pkgsrc/**" ] ) ;
720
720
}
721
+
722
+ #[ test]
723
+ fn test_build_input_globs_relative_source ( ) {
724
+ use std:: fs;
725
+ use std:: path:: PathBuf ;
726
+ use tempfile:: tempdir;
727
+
728
+ // Create a temp directory to act as the base
729
+ let base_dir = tempdir ( ) . unwrap ( ) ;
730
+ let base_path = base_dir. path ( ) ;
731
+
732
+ // Case: source is a directory, package_sources contains a relative path
733
+ let rel_dir = PathBuf :: from ( "rel_folder" ) ;
734
+ let abs_rel_dir = base_path. join ( & rel_dir) ;
735
+ fs:: create_dir_all ( & abs_rel_dir) . unwrap ( ) ;
736
+
737
+ // Call build_input_globs with base_path as source, and rel_dir as package source (relative)
738
+ let globs = super :: build_input_globs ( base_path, Some ( vec ! [ rel_dir. clone( ) ] ) ) . unwrap ( ) ;
739
+ // The relative path from base_path to rel_dir should be "rel_folder/**"
740
+ assert_eq ! ( globs, vec![ "*/**" , "rel_folder/**" ] ) ;
741
+ }
721
742
}
0 commit comments