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