MCPcopy Create free account
hub / github.com/ActiveState/code / pack

Function pack

recipes/Python/577485_Self_Extracting_Archiver/recipe-577485.py:25–30  ·  view source on GitHub ↗

Get the source, compress it, and create a packed file.

(path)

Source from the content-addressed store, hash-verified

23 print('Usage: {} <filename>'.format(os.path.basename(sys.argv[0])))
24
25def pack(path):
26 "Get the source, compress it, and create a packed file."
27 data = read_file(path)
28 builder, data = optimize(data)
29 with open(os.path.splitext(path)[0] + '.pyw', 'w') as file:
30 builder(os.path.basename(path), base64.b64encode(data), file)
31
32def read_file(path):
33 "Read the entire file content from path in binary mode."

Callers 15

recipe-544288.pyFile · 0.85
build_mreqFunction · 0.85
get_ifindexFunction · 0.85
get_hwaddrFunction · 0.85
make_ether_headerMethod · 0.85
make_8021x_headerMethod · 0.85
make_eap_pktMethod · 0.85
handleMethod · 0.85
recipe-115419.pyFile · 0.85
packobjFunction · 0.85
__str__Method · 0.85
createMethod · 0.85

Calls 4

builderFunction · 0.85
read_fileFunction · 0.70
optimizeFunction · 0.70
openFunction · 0.50

Tested by

no test coverage detected