1#!/bin/bash
2INTERPRETER_UNDER_TEST="$1"
3if [[ ! -x "${INTERPRETER_UNDER_TEST}" ]]; then
4    echo "Interpreter must be the command line argument."
5    exit 4
6fi
7EXECUTABLE="$0" exec "${INTERPRETER_UNDER_TEST}" -E - <<END_OF_PYTHON
8import os
9import zipfile
10
11namespace = {}
12
13filename = os.environ['EXECUTABLE']
14print(f'Opening {filename} as a zipfile.')
15with zipfile.ZipFile(filename, mode='r') as exe_zip:
16  for file_info in exe_zip.infolist():
17    data = exe_zip.read(file_info)
18    exec(data, namespace, namespace)
19    break  # Only use the first file in the archive.
20
21print('Favorite number in executable:', namespace["FAVORITE_NUMBER"])
22
23### Archive contents will be appended after this file. ###
24END_OF_PYTHON
25PK-�����\*OI_?S����������-��E�������E�������# Test data file to be stored within a zip file.
26FAVORITE_NUMBER = 5
27PK-�����\*OI_?SE���E��������������������-PK,�������-�����������������������/�������x�������PK���������������PK������/���x�����