@@ -44,7 +44,9 @@ def add_entries(self, entries):
4444 write_finish_entry (write_p )
4545
4646 def add_files (
47- self , * paths , flags = 0 , lookup = False , pathname = None , ** attributes
47+ self , * paths , flags = 0 , lookup = False ,
48+ pathname = None , recursive = True ,
49+ ** attributes
4850 ):
4951 """Read files through the OS and add them to the archive.
5052
@@ -58,6 +60,9 @@ def add_files(
5860 is called to enable the lookup of user and group names
5961 pathname (str | None):
6062 the path of the file in the archive, defaults to the source path
63+ recursive (bool):
64+ when False, if a path in `paths` is a directory,
65+ only the directory itself is added.
6166 attributes (dict): passed to `ArchiveEntry.modify()`
6267
6368 Raises:
@@ -103,6 +108,8 @@ def add_files(
103108 write_data (write_p , data , len (data ))
104109 write_finish_entry (write_p )
105110 entry_clear (entry_p )
111+ if not recursive :
112+ break
106113
107114 def add_file (self , path , ** kw ):
108115 "Single-path alias of `add_files()`"
0 commit comments