Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
sudo('apt-get -y install python-pip')
sudo('pip install virtualenv')
sudo('pip install virtualenvwrapper')
with settings(warn_only=True):
run('mkdir ' + VIRTUALENVDIR)
# create the Python virtual environment
with prefix(VIRTUALENVWRAPPER_ACTIVATE):
run('mkvirtualenv --no-site-packages ' + VIRTUALENVNAME)
# install symbolic link in the virtual environment to GDAL
with settings(warn_only=True):
run('ln -s ' + GDAL_DIR + '/bin/gdal-config ' + \
'~/.virtualenvs/' + VIRTUALENVNAME + '/bin/gdal-config')
with virtualenv():
run('pip install yolk')
run('pip install Django==1.3')
run('pip install django-piston')
run('pip install -e hg+https://bitbucket.org/tylere/django-piston#egg=piston')
run('pip install numpy==1.5.1')
run('pip install Shapely')
run('pip install geojson')
run('pip install geoalchemy')
with prefix('export HDF5_DIR=' + HDF5_DIR):
with prefix('export NETCDF4_DIR=' + NETCDF4_DIR):
run('pip install netCDF4==0.9.4')
# install the GDAL Python bindings
run('pip install --no-install GDAL')
# build package extensions
with cd('$HOME/.virtualenvs/' + VIRTUALENVNAME + '/build/GDAL'):
run('python setup.py build_ext' + \
def install_pykml():
'''Install pyKML and dependencies'''
from virtualenv import virtualenv
sudo('apt-get -y install libxml2')
sudo('apt-get -y install libxslt1.1 libxslt-dev')
with virtualenv():
run('pip install pykml')
def register_archive_usgs_cida_maurer():
'''Register the USGS CIDA Maurer et al. downscaled archive'''
with cd('$HOME/.virtualenvs/openclimategis/src/' + \
'openclimategis/src/openclimategis'):
with virtualenv():
run('./manage.py register_archive' + \
' http://cida.usgs.gov/qa/thredds/dodsC/maurer/monthly')
def install_openclimategis_django():
'''Install OpenClimateGIS GeoDjango project'''
with virtualenv():
run('pip install -e git+http://github.com/tylere/OpenClimateGIS#egg=openclimategis')
def syncdb():
'''Synchronizes the Django database tables'''
with cd('$HOME/.virtualenvs/openclimategis/src/openclimategis/src/openclimategis'):
with virtualenv():
# suppress input prompting for a superuser
run('./manage.py syncdb --noinput')
def create_superuser():
'''Creates a Django superuser that can log into the Django admin'''
with cd('$HOME/.virtualenvs/openclimategis/src/openclimategis/src/openclimategis'):
with virtualenv():
run('./manage.py createsuperuser')
def install_psycopg2():
'''Install the Python PostgreSQL database adapter'''
with virtualenv():
run('pip install psycopg2==2.4')
def update_openclimategis_django():
'''Update the OpenClimateGIS GeoDjango project'''
with virtualenv():
with cd(VIRTUALENVDIR + VIRTUALENVNAME + '/src/openclimategis'):
run('git pull')