Path of PEX extracted files

1,041 views
Skip to first unread message

Eric Wang

unread,
Aug 10, 2015, 6:58:26 PM8/10/15
to Pants Developers
Is there any way of getting the SHA1 of the PEX file after it's built? Perhaps saved into an environment variable that something like Jenkins could then read. PEX currently extracts them to the default root folder in a subfolder using the SHA1 as the name. Or perhaps a PEX_ROOT type option that forces it to extract into a folder w/o creating a subfolder with the SHA1, deleting all files inside prior to writing.

I'm trying to set the static root option in my nginx config to serve the resource files, and it would be easier if the extracted paths are predictable each time.


Thanks,
Eric

John Sirois

unread,
Aug 11, 2015, 12:19:22 AM8/11/15
to Eric Wang, Pants Developers
On Mon, Aug 10, 2015 at 3:58 PM, Eric Wang <eric...@gmail.com> wrote:
Is there any way of getting the SHA1 of the PEX file after it's built? Perhaps saved into an environment variable that something like Jenkins could then read. PEX currently extracts them to the default root folder in a subfolder using the SHA1 as the name. Or perhaps a PEX_ROOT type option that forces it to extract into a folder w/o creating a subfolder with the SHA1, deleting all files inside prior to writing.

The sha is the `code_hash` in PEX-INFO:
$ unzip -qc dist/pants_local_binary.pex PEX-INFO | python -mjson.tool | grep code_hash
    "code_hash": "2036228415523a1349dda30b118ffb3eb28de8cb",

$ PEX_VERBOSE=5 PEX_ROOT=/tmp/pex_root PEX_FORCE_LOCAL=1 dist/pants_local_binary.pex 2>&1 | grep "zip safe"
pex: PEX is not zip safe, exploding to /tmp/pex_root/code/2036228415523a1349dda30b118ffb3eb28de8cb

 

I'm trying to set the static root option in my nginx config to serve the resource files, and it would be easier if the extracted paths are predictable each time.

It may be much easier to just explode (unzip) the pex to a fixed stable directory of your choice then and execute it via `python [path to unzipped pex]`.



Thanks,
Eric

Reply all
Reply to author
Forward
0 new messages