Last active
November 9, 2017 05:56
-
-
Save olivier-m/5755638 to your computer and use it in GitHub Desktop.
Install pygit2 in a Python VirtualEnv
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 | |
set -e | |
if [ "${VIRTUAL_ENV}" = "" ]; then | |
echo "Error: Not in a virtual env" | |
exit 1 | |
fi | |
OS=$(uname -s) | |
set -u | |
SRC="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/_tmp" | |
TARGET=${VIRTUAL_ENV} | |
test -d ${SRC} || mkdir ${SRC} | |
cd ${SRC} | |
test -d libgit2 || git clone git://github.com/libgit2/libgit2.git | |
test -d pygit2 || git clone git://github.com/libgit2/pygit2.git | |
# Building libgit2 | |
cd ${SRC}/libgit2 | |
git checkout v0.19.0 | |
rm -rf build && mkdir build | |
cd build | |
cmake .. -DCMAKE_INSTALL_PREFIX=${TARGET} | |
cmake --build . --target install | |
# Building pygit2 | |
cd ${SRC}/pygit2 | |
git checkout v0.19.0 | |
LIBGIT2=${TARGET} python setup.py build_ext -R ${TARGET}/lib | |
python setup.py build | |
if [ "${OS}" = "Darwin" ]; then | |
install_name_tool -add_rpath ${TARGET}/lib $(find build -name '_pygit2.so') | |
install_name_tool -change libgit2.0.dylib @rpath/libgit2.0.dylib $(find build -name '_pygit2.so') | |
fi | |
python setup.py install | |
rm -rf ${SRC} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am trying to use this script to install pygit2 and libgit2 v0.22.0 on OSX for which I changed the version on line 25 and 33 and
libgit2.0.dylib
on line 39 tolibgit2.22.dylib
. Got the following error:Any idea about this?