Skip to content

Instantly share code, notes, and snippets.

@mozz100
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mozz100/7a22e54e17a3a2d4ee66 to your computer and use it in GitHub Desktop.
Save mozz100/7a22e54e17a3a2d4ee66 to your computer and use it in GitHub Desktop.
Patch updates for pinned python packages
# Use sed to replace '==x.y' with '<x.y.999'
# and save results to a file
sed -r -e "s/==([0-9]+\.[0-9]+)(\..+)?/<\1.999/" requirements.txt > /tmp/requirements2.txt
# It works by transforming the file like this:
# Django==1.4.8 >> Django<1.4.999
# Jinja2==2.5 >> Jinja2<2.5.999
# M2Crypto==0.19.1 >> M2Crypto<0.19.999
# MySQL-python==1.2.5 >> MySQL-python<1.2.999
# Pillow==2.5.1 >> Pillow<2.5.999
# Use pip with --upgrade and feed in the results
pip install --upgrade -r /tmp/requirements2.txt
# Compare updated environment with existing requirements.txt
pip freeze | diff - requirements.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment