add initial install-deps script

This commit is contained in:
Josh Holtrop 2011-10-01 22:58:56 -04:00
parent 1c7c495914
commit 075538442f
2 changed files with 37 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
deps

36
install-deps Executable file
View File

@ -0,0 +1,36 @@
#!/usr/bin/env python
import os
import sys
from subprocess import Popen, PIPE
DEPS_DIR = 'deps'
NUMPY_VER = '1.6.1'
numpy_src = 'http://downloads.sourceforge.net/project/numpy/NumPy/%s/numpy-%s.tar.gz' % (NUMPY_VER, NUMPY_VER)
sources = [
numpy_src
]
def indirdo(dr, fn):
owd = os.getcwd()
os.chdir(dr)
fn()
os.chdir(owd)
if not os.path.exists(DEPS_DIR):
os.makedirs(DEPS_DIR)
os.chdir(DEPS_DIR)
for src_url in sources:
src_fname = src_url.split('/')[-1]
src_dname = src_fname.replace('.tar.gz', '')
if not os.path.exists(src_fname):
Popen(['wget', src_url]).wait()
if not os.path.exists(src_dname):
Popen(['tar', '-xvzf', src_fname]).wait()
if not os.path.exists('/usr/local/lib/python2.7/dist-packages/numpy'):
indirdo('numpy-%s' % NUMPY_VER, lambda:
Popen(['sudo', 'python', 'setup.py', 'install']).wait()
)