Last active
November 30, 2017 10:06
-
-
Save raelmax/208810d67f8348771fb750c141b899d8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Checking if python is installed | |
if ! [ -x "$(command -v python)" ]; then | |
echo 'Error: python is not installed. :(' >&2 | |
exit 1 | |
fi | |
# Build directory | |
export OLDDIR=$PWD | |
export TMPDIR=`mktemp -d /tmp/pex-build.XXXXXX` | |
# Download and unzip pex | |
curl -L https://github.com/pantsbuild/pex/archive/master.zip -o "$TMPDIR/master.zip" | |
cd $TMPDIR | |
unzip master.zip | |
cd pex-master | |
# Installing pex in a local folder | |
mkdir ../lib/ | |
PYTHONPATH=../lib/ python setup.py install --install-lib="../lib" --install-scripts="../scripts" | |
# Generating a pex from pex | |
cd .. | |
PYTHONPATH="$PWD/lib" "$TMPDIR/scripts/pex" pex requests -c pex -o "$OLDDIR/pex" | |
# Cleaning up | |
rm -rf $TMPDIR | |
############### | |
printf "\n\n\n\n\n" | |
printf "Congratz! Now you can use ./pex from this directory to create standalone python packages!\n" | |
printf "Docs: https://pex.readthedocs.io" | |
printf "\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment