37 lines
906 B
Python
Executable File
37 lines
906 B
Python
Executable File
#!/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()
|
|
)
|