Created
January 23, 2014 19:15
-
-
Save query/8584951 to your computer and use it in GitHub Desktop.
Fix Python virtualenvs broken by a change of Python location. Intended to be used with Homebrew, whose Python installation path contains the version number and so changes on upgrades.
This file contains 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/sh | |
# Find and delete broken symbolic links, which cause virtualenv to balk. | |
# "-L" resolves symbolic links to their destination if possible, meaning | |
# that if the filename is still a link ("-type l"), it's a broken one. | |
# Since "-L" doesn't work with "-delete", this calls "rm" instead. | |
find -L $1 -type l -exec rm -- {} + | |
# Just run virtualenv again to handle the rest. | |
virtualenv $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment