2013-08-04 19:57:39 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-03-01 13:56:01 +00:00
|
|
|
PYTHON=python3
|
|
|
|
command -v $PYTHON -m venv >/dev/null 2>&1 || { echo >&2 "Python 3.3 required. Install it and try again. Aborting"; exit 1; }
|
2013-08-04 19:57:39 +00:00
|
|
|
|
2014-01-26 14:41:15 +00:00
|
|
|
if [ -d "deps" ]; then
|
|
|
|
# We have a collection of dependencies in our source package. We might as well use it instead
|
|
|
|
# of downloading it from PyPI.
|
|
|
|
PIPARGS="--no-index --find-links=deps"
|
|
|
|
fi
|
|
|
|
|
2013-08-04 19:57:39 +00:00
|
|
|
if [ ! -d "env" ]; then
|
|
|
|
echo "No virtualenv. Creating one"
|
2014-03-28 20:21:05 +00:00
|
|
|
# We need a "system-site-packages" env to have PyQt, but we also need to ensure a local pip
|
|
|
|
# install. To achieve our latter goal, we start with a normal venv, which we later upgrade to
|
|
|
|
# a system-site-packages once pip is installed.
|
2015-03-01 13:56:01 +00:00
|
|
|
if ! $PYTHON -m venv env ; then
|
|
|
|
# We're probably under braindead Ubuntu 14.04 which completely messed up ensurepip.
|
|
|
|
# Work around it :(
|
|
|
|
echo "Ubuntu 14.04's version of Python 3.4 is braindead stupid, but we work around it anyway..."
|
|
|
|
$PYTHON -m venv --without-pip env
|
|
|
|
fi
|
2013-08-04 19:57:39 +00:00
|
|
|
source env/bin/activate
|
2014-03-28 20:21:05 +00:00
|
|
|
if python -m ensurepip; then
|
|
|
|
echo "We're under Python 3.4+, no need to try to install pip!"
|
|
|
|
else
|
|
|
|
python get-pip.py $PIPARGS --force-reinstall
|
|
|
|
fi
|
|
|
|
deactivate
|
2014-03-30 14:26:09 +00:00
|
|
|
if [ "$(uname)" != "Darwin" ]; then
|
|
|
|
# We only need system site packages for PyQt, so under OS X, we don't enable it
|
2015-03-01 13:56:01 +00:00
|
|
|
if ! $PYTHON -m venv env --upgrade --system-site-packages ; then
|
|
|
|
# We're probably under v3.4.1 and experiencing http://bugs.python.org/issue21643
|
|
|
|
# Work around it.
|
|
|
|
echo "Oops, can't upgrade our venv. Trying to work around it."
|
|
|
|
rm env/lib64
|
|
|
|
$PYTHON -m venv env --upgrade --system-site-packages
|
|
|
|
fi
|
2014-03-30 14:26:09 +00:00
|
|
|
fi
|
2013-08-04 19:57:39 +00:00
|
|
|
fi
|
|
|
|
|
2014-03-28 20:21:05 +00:00
|
|
|
source env/bin/activate
|
2014-01-26 14:41:15 +00:00
|
|
|
|
2013-08-04 19:57:39 +00:00
|
|
|
echo "Installing pip requirements"
|
|
|
|
if [ "$(uname)" == "Darwin" ]; then
|
2014-01-26 14:41:15 +00:00
|
|
|
pip install $PIPARGS -r requirements-osx.txt
|
2013-08-04 19:57:39 +00:00
|
|
|
else
|
2015-03-01 13:56:01 +00:00
|
|
|
python -c "import PyQt5" >/dev/null 2>&1 || { echo >&2 "PyQt 5.1+ required. Install it and try again. Aborting"; exit 1; }
|
2014-01-26 14:41:15 +00:00
|
|
|
pip install $PIPARGS -r requirements.txt
|
2013-08-04 19:57:39 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Bootstrapping complete! You can now configure, build and run dupeGuru with:"
|
|
|
|
echo ". env/bin/activate && python configure.py && python build.py && python run.py"
|