@@ -52,7 +52,7 @@ pub trait ModuleWriter {
5252 /// the appropriate unix permissions
5353 ///
5454 /// For generated files, `source` is `None`.
55- fn add_data (
55+ fn add_bytes (
5656 & mut self ,
5757 target : impl AsRef < Path > ,
5858 source : Option < & Path > ,
@@ -77,7 +77,7 @@ pub trait ModuleWriterExt: ModuleWriter {
7777
7878 let file =
7979 File :: open ( source) . with_context ( || format ! ( "Failed to open {}" , source. display( ) ) ) ?;
80- self . add_data ( target, Some ( source) , file, executable)
80+ self . add_bytes ( target, Some ( source) , file, executable)
8181 . with_context ( || format ! ( "Failed to write to {}" , target. display( ) ) ) ?;
8282 Ok ( ( ) )
8383 }
@@ -101,7 +101,7 @@ pub trait ModuleWriterExt: ModuleWriter {
101101
102102 /// Creates an empty file at the specified target
103103 fn add_empty_file ( & mut self , target : impl AsRef < Path > ) -> Result < ( ) > {
104- self . add_data ( target, None , io:: empty ( ) , false )
104+ self . add_bytes ( target, None , io:: empty ( ) , false )
105105 }
106106}
107107
@@ -125,7 +125,7 @@ impl PathWriter {
125125}
126126
127127impl ModuleWriter for PathWriter {
128- fn add_data (
128+ fn add_bytes (
129129 & mut self ,
130130 target : impl AsRef < Path > ,
131131 source : Option < & Path > ,
@@ -204,7 +204,7 @@ impl CompressionOptions {
204204}
205205
206206impl ModuleWriter for WheelWriter {
207- fn add_data (
207+ fn add_bytes (
208208 & mut self ,
209209 target : impl AsRef < Path > ,
210210 source : Option < & Path > ,
@@ -304,7 +304,7 @@ impl WheelWriter {
304304 let name = metadata24. get_distribution_escaped ( ) ;
305305 let target = format ! ( "{name}.pth" ) ;
306306 debug ! ( "Adding {} from {}" , target, python_path) ;
307- self . add_data ( target, None , python_path. as_bytes ( ) , false ) ?;
307+ self . add_bytes ( target, None , python_path. as_bytes ( ) , false ) ?;
308308 } else {
309309 eprintln ! (
310310 "⚠️ source code path contains non-Unicode sequences, editable installs may not work."
@@ -373,7 +373,7 @@ pub struct SDistWriter {
373373}
374374
375375impl ModuleWriter for SDistWriter {
376- fn add_data (
376+ fn add_bytes (
377377 & mut self ,
378378 target : impl AsRef < Path > ,
379379 source : Option < & Path > ,
@@ -923,7 +923,7 @@ pub fn write_bindings_module(
923923 } else {
924924 let module = PathBuf :: from ( ext_name) ;
925925 // Reexport the shared library as if it were the top level module
926- writer. add_data (
926+ writer. add_bytes (
927927 module. join ( "__init__.py" ) ,
928928 None ,
929929 format ! (
@@ -1012,13 +1012,13 @@ pub fn write_cffi_module(
10121012 } ;
10131013
10141014 if !editable || project_layout. python_module . is_none ( ) {
1015- writer. add_data (
1015+ writer. add_bytes (
10161016 module. join ( "__init__.py" ) ,
10171017 None ,
10181018 cffi_init_file ( & cffi_module_file_name) . as_bytes ( ) ,
10191019 false ,
10201020 ) ?;
1021- writer. add_data (
1021+ writer. add_bytes (
10221022 module. join ( "ffi.py" ) ,
10231023 None ,
10241024 cffi_declarations. as_bytes ( ) ,
@@ -1259,7 +1259,7 @@ pub fn write_uniffi_module(
12591259 } ;
12601260
12611261 if !editable || project_layout. python_module . is_none ( ) {
1262- writer. add_data ( module. join ( "__init__.py" ) , None , py_init. as_bytes ( ) , false ) ?;
1262+ writer. add_bytes ( module. join ( "__init__.py" ) , None , py_init. as_bytes ( ) , false ) ?;
12631263 for binding in binding_names. iter ( ) {
12641264 writer. add_file (
12651265 module. join ( binding) . with_extension ( "py" ) ,
@@ -1341,7 +1341,7 @@ if __name__ == '__main__':
13411341 let launcher_path = Path :: new ( & metadata. get_distribution_escaped ( ) )
13421342 . join ( bin_name. replace ( '-' , "_" ) )
13431343 . with_extension ( "py" ) ;
1344- writer. add_data ( & launcher_path, None , entrypoint_script. as_bytes ( ) , true ) ?;
1344+ writer. add_bytes ( & launcher_path, None , entrypoint_script. as_bytes ( ) , true ) ?;
13451345 Ok ( ( ) )
13461346}
13471347
@@ -1428,14 +1428,14 @@ pub fn write_dist_info(
14281428) -> Result < ( ) > {
14291429 let dist_info_dir = metadata24. get_dist_info_dir ( ) ;
14301430
1431- writer. add_data (
1431+ writer. add_bytes (
14321432 dist_info_dir. join ( "METADATA" ) ,
14331433 None ,
14341434 metadata24. to_file_contents ( ) ?. as_bytes ( ) ,
14351435 false ,
14361436 ) ?;
14371437
1438- writer. add_data (
1438+ writer. add_bytes (
14391439 dist_info_dir. join ( "WHEEL" ) ,
14401440 None ,
14411441 wheel_file ( tags) ?. as_bytes ( ) ,
@@ -1453,7 +1453,7 @@ pub fn write_dist_info(
14531453 entry_points. push_str ( & entry_points_txt ( entry_type, scripts) ) ;
14541454 }
14551455 if !entry_points. is_empty ( ) {
1456- writer. add_data (
1456+ writer. add_bytes (
14571457 dist_info_dir. join ( "entry_points.txt" ) ,
14581458 None ,
14591459 entry_points. as_bytes ( ) ,
@@ -1550,7 +1550,7 @@ mod tests {
15501550 let tmp_dir = TempDir :: new ( ) ?;
15511551 let mut writer = SDistWriter :: new ( & tmp_dir, & metadata, Override :: empty ( ) , None ) ?;
15521552 assert ! ( writer. file_tracker. 0 . is_empty( ) ) ;
1553- writer. add_data ( "test" , Some ( Path :: new ( "test" ) ) , empty, true ) ?;
1553+ writer. add_bytes ( "test" , Some ( Path :: new ( "test" ) ) , empty, true ) ?;
15541554 assert_eq ! ( writer. file_tracker. 0 . len( ) , 1 ) ;
15551555 writer. finish ( ) ?;
15561556 tmp_dir. close ( ) ?;
@@ -1561,12 +1561,12 @@ mod tests {
15611561 excludes. add ( "test*" ) ?;
15621562 excludes. add ( "!test2" ) ?;
15631563 let mut writer = SDistWriter :: new ( & tmp_dir, & metadata, excludes. build ( ) ?, None ) ?;
1564- writer. add_data ( "test1" , Some ( Path :: new ( "test1" ) ) , empty, true ) ?;
1565- writer. add_data ( "test3" , Some ( Path :: new ( "test3" ) ) , empty, true ) ?;
1564+ writer. add_bytes ( "test1" , Some ( Path :: new ( "test1" ) ) , empty, true ) ?;
1565+ writer. add_bytes ( "test3" , Some ( Path :: new ( "test3" ) ) , empty, true ) ?;
15661566 assert ! ( writer. file_tracker. 0 . is_empty( ) ) ;
1567- writer. add_data ( "test2" , Some ( Path :: new ( "test2" ) ) , empty, true ) ?;
1567+ writer. add_bytes ( "test2" , Some ( Path :: new ( "test2" ) ) , empty, true ) ?;
15681568 assert ! ( !writer. file_tracker. 0 . is_empty( ) ) ;
1569- writer. add_data ( "yes" , Some ( Path :: new ( "yes" ) ) , empty, true ) ?;
1569+ writer. add_bytes ( "yes" , Some ( Path :: new ( "yes" ) ) , empty, true ) ?;
15701570 assert_eq ! ( writer. file_tracker. 0 . len( ) , 2 ) ;
15711571 writer. finish ( ) ?;
15721572 tmp_dir. close ( ) ?;
0 commit comments