2023-11-04 06:57:53 -03:00
|
|
|
# Test data for `test_zipfile`, `test_tarfile` (and even some others)
|
2019-09-10 13:14:11 -03:00
|
|
|
|
2023-11-04 06:57:53 -03:00
|
|
|
## `test_zipfile`
|
|
|
|
|
|
|
|
The test executables in this directory are created manually from `header.sh` and
|
2023-11-02 08:10:30 -03:00
|
|
|
the `testdata_module_inside_zip.py` file. You must have Info-ZIP's zip utility
|
2019-09-10 13:14:11 -03:00
|
|
|
installed (`apt install zip` on Debian).
|
|
|
|
|
2023-11-04 06:57:53 -03:00
|
|
|
### Purpose of `exe_with_zip` and `exe_with_z64`
|
2019-09-10 13:14:11 -03:00
|
|
|
|
|
|
|
These are used to test executable files with an appended zipfile, in a scenario
|
|
|
|
where the executable is _not_ a Python interpreter itself so our automatic
|
|
|
|
zipimport machinery (that'd look for `__main__.py`) is not being used.
|
|
|
|
|
2023-11-04 06:57:53 -03:00
|
|
|
### Updating the test executables
|
2019-09-10 13:14:11 -03:00
|
|
|
|
|
|
|
If you update header.sh or the testdata_module_inside_zip.py file, rerun the
|
|
|
|
commands below. These are expected to be rarely changed, if ever.
|
|
|
|
|
2023-11-04 06:57:53 -03:00
|
|
|
#### Standard old format (2.0) zip file
|
2019-09-10 13:14:11 -03:00
|
|
|
|
|
|
|
```
|
|
|
|
zip -0 zip2.zip testdata_module_inside_zip.py
|
|
|
|
cat header.sh zip2.zip >exe_with_zip
|
|
|
|
rm zip2.zip
|
|
|
|
```
|
|
|
|
|
2023-11-04 06:57:53 -03:00
|
|
|
#### Modern format (4.5) zip64 file
|
2019-09-10 13:14:11 -03:00
|
|
|
|
2023-11-02 08:10:30 -03:00
|
|
|
Redirecting from stdin forces Info-ZIP's zip tool to create a zip64.
|
2019-09-10 13:14:11 -03:00
|
|
|
|
|
|
|
```
|
|
|
|
zip -0 <testdata_module_inside_zip.py >zip64.zip
|
|
|
|
cat header.sh zip64.zip >exe_with_z64
|
|
|
|
rm zip64.zip
|
|
|
|
```
|