• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Test data for `test_zipfile`, `test_tarfile` (and even some others)
2
3## `test_zipfile`
4
5The test executables in this directory are created manually from `header.sh` and
6the `testdata_module_inside_zip.py` file.  You must have Info-ZIP's zip utility
7installed (`apt install zip` on Debian).
8
9### Purpose of `exe_with_zip` and `exe_with_z64`
10
11These are used to test executable files with an appended zipfile, in a scenario
12where the executable is _not_ a Python interpreter itself so our automatic
13zipimport machinery (that'd look for `__main__.py`) is not being used.
14
15### Updating the test executables
16
17If you update header.sh or the testdata_module_inside_zip.py file, rerun the
18commands below.  These are expected to be rarely changed, if ever.
19
20#### Standard old format (2.0) zip file
21
22```
23zip -0 zip2.zip testdata_module_inside_zip.py
24cat header.sh zip2.zip >exe_with_zip
25rm zip2.zip
26```
27
28#### Modern format (4.5) zip64 file
29
30Redirecting from stdin forces Info-ZIP's zip tool to create a zip64.
31
32```
33zip -0 <testdata_module_inside_zip.py >zip64.zip
34cat header.sh zip64.zip >exe_with_z64
35rm zip64.zip
36```
37