Removed the Requirement to Install Python and NodeJS (Now Bundled with Borealis)
This commit is contained in:
36
Dependencies/Python/Lib/test/archivetestdata/README.md
vendored
Normal file
36
Dependencies/Python/Lib/test/archivetestdata/README.md
vendored
Normal file
@ -0,0 +1,36 @@
|
||||
# Test data for `test_zipfile`, `test_tarfile` (and even some others)
|
||||
|
||||
## `test_zipfile`
|
||||
|
||||
The test executables in this directory are created manually from `header.sh` and
|
||||
the `testdata_module_inside_zip.py` file. You must have Info-ZIP's zip utility
|
||||
installed (`apt install zip` on Debian).
|
||||
|
||||
### Purpose of `exe_with_zip` and `exe_with_z64`
|
||||
|
||||
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.
|
||||
|
||||
### Updating the test executables
|
||||
|
||||
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.
|
||||
|
||||
#### Standard old format (2.0) zip file
|
||||
|
||||
```
|
||||
zip -0 zip2.zip testdata_module_inside_zip.py
|
||||
cat header.sh zip2.zip >exe_with_zip
|
||||
rm zip2.zip
|
||||
```
|
||||
|
||||
#### Modern format (4.5) zip64 file
|
||||
|
||||
Redirecting from stdin forces Info-ZIP's zip tool to create a zip64.
|
||||
|
||||
```
|
||||
zip -0 <testdata_module_inside_zip.py >zip64.zip
|
||||
cat header.sh zip64.zip >exe_with_z64
|
||||
rm zip64.zip
|
||||
```
|
BIN
Dependencies/Python/Lib/test/archivetestdata/exe_with_z64
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/exe_with_z64
vendored
Normal file
Binary file not shown.
BIN
Dependencies/Python/Lib/test/archivetestdata/exe_with_zip
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/exe_with_zip
vendored
Normal file
Binary file not shown.
24
Dependencies/Python/Lib/test/archivetestdata/header.sh
vendored
Normal file
24
Dependencies/Python/Lib/test/archivetestdata/header.sh
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
INTERPRETER_UNDER_TEST="$1"
|
||||
if [[ ! -x "${INTERPRETER_UNDER_TEST}" ]]; then
|
||||
echo "Interpreter must be the command line argument."
|
||||
exit 4
|
||||
fi
|
||||
EXECUTABLE="$0" exec "${INTERPRETER_UNDER_TEST}" -E - <<END_OF_PYTHON
|
||||
import os
|
||||
import zipfile
|
||||
|
||||
namespace = {}
|
||||
|
||||
filename = os.environ['EXECUTABLE']
|
||||
print(f'Opening {filename} as a zipfile.')
|
||||
with zipfile.ZipFile(filename, mode='r') as exe_zip:
|
||||
for file_info in exe_zip.infolist():
|
||||
data = exe_zip.read(file_info)
|
||||
exec(data, namespace, namespace)
|
||||
break # Only use the first file in the archive.
|
||||
|
||||
print('Favorite number in executable:', namespace["FAVORITE_NUMBER"])
|
||||
|
||||
### Archive contents will be appended after this file. ###
|
||||
END_OF_PYTHON
|
BIN
Dependencies/Python/Lib/test/archivetestdata/recursion.tar
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/recursion.tar
vendored
Normal file
Binary file not shown.
2
Dependencies/Python/Lib/test/archivetestdata/testdata_module_inside_zip.py
vendored
Normal file
2
Dependencies/Python/Lib/test/archivetestdata/testdata_module_inside_zip.py
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
# Test data file to be stored within a zip file.
|
||||
FAVORITE_NUMBER = 5
|
BIN
Dependencies/Python/Lib/test/archivetestdata/testtar.tar
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/testtar.tar
vendored
Normal file
Binary file not shown.
BIN
Dependencies/Python/Lib/test/archivetestdata/testtar.tar.xz
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/testtar.tar.xz
vendored
Normal file
Binary file not shown.
BIN
Dependencies/Python/Lib/test/archivetestdata/zip_cp437_header.zip
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/zip_cp437_header.zip
vendored
Normal file
Binary file not shown.
BIN
Dependencies/Python/Lib/test/archivetestdata/zipdir.zip
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/zipdir.zip
vendored
Normal file
Binary file not shown.
BIN
Dependencies/Python/Lib/test/archivetestdata/zipdir_backslash.zip
vendored
Normal file
BIN
Dependencies/Python/Lib/test/archivetestdata/zipdir_backslash.zip
vendored
Normal file
Binary file not shown.
Reference in New Issue
Block a user