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