@@ -94,15 +94,26 @@ The following options are understood:
9494 this case, any other options are ignored and SOURCE must be an archive, not a
9595 directory.
9696
97- .. option :: --include
97+ .. option :: --include pattern
9898
99- Accept glob-patterns filtering for files to be allowed in output archive. This will run
100- first if :option: ` --exclude ` is also used .
99+ Include only files and directories that match the given glob pattern(s).
100+ Patterns use standard globbing as implemented by :class: ` pathlib.PurePath.match ` .
101101
102- .. option :: --exclude
102+ .. note ::
103103
104- Accept glob-patterns filtering files to be denied inclusion in output archive. This will
105- run second if :option: `--include ` is also used.
104+ If this option is not specified, all files in the given directory are
105+ included by default (subject to any :option: `--exclude ` patterns).
106+
107+ .. option :: --exclude pattern
108+
109+ Exclude files and directories that match the given glob pattern(s).
110+ Patterns use standard globbing as implemented by :class: `pathlib.PurePath.match `.
111+
112+ .. note ::
113+
114+ If both :option: `--include ` and :option: `--exclude ` are specified, the set of
115+ files to be included is picked first. Then any to be excluded are removed from
116+ that set. The order of the options does not affect how they are processed.
106117
107118
108119.. option :: -h , --help
@@ -255,8 +266,8 @@ Including only specific files:
255266 $ python -m zipapp myapp -o myapp.pyz --include "*.py"
256267 $ unzip myapp.pyz -d extracted_myapp
257268 Archive: myapp.pyz
258- extracting: extracted_myapp/__main__.py
259- extracting: extracted_myapp/helper.py
269+ extracting: extracted_myapp/__main__.py
270+ extracting: extracted_myapp/helper.py
260271
261272 Excluding a subtree or file type:
262273
@@ -276,10 +287,10 @@ Excluding a subtree or file type:
276287 $ python -m zipapp myapp -o myapp.pyz --exclude "tests/**" --exclude "*.pyc"
277288 $ unzip myapp.pyz -d extracted_myapp
278289 Archive: myapp.pyz
279- extracting: extracted_myapp/__main__.py
290+ extracting: extracted_myapp/__main__.py
280291 creating: extracted_myapp/build/
281- extracting: extracted_myapp/build/scratch.txt
282- extracting: extracted_myapp/helper.py
292+ extracting: extracted_myapp/build/scratch.txt
293+ extracting: extracted_myapp/helper.py
283294 creating: extracted_myapp/tests/
284295
285296 .. note ::
0 commit comments