Created
October 18, 2016 23:41
-
-
Save bkj/37ab135a8ad32576fa03312d70adbc2a 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 | |
# ./bundle-packages requirements.txt ./target-directory | |
# where | |
# requirements.txt : list of packages to include | |
# ./packages : path to target file | |
virtualenv --no-site-packages packageenv | |
. packageenv/bin/activate | |
pip install -r $1 --target $2 | |
if [ -d $2 ]; then | |
cd $2 | |
find . -name "*.pyc" -delete | |
find . -name "*.egg-info" | xargs rm -rf | |
zip -9mrv $2.zip . | |
mv $2.zip .. | |
cd .. | |
rm -rf $2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment