update install-deps to get numpy and FuncDesigner
This commit is contained in:
parent
f84c9d4234
commit
9be9335d8e
39
install-deps
39
install-deps
@ -2,15 +2,16 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
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
|
||||
]
|
||||
numpy_src = 'numpy-%s.tar.gz' % NUMPY_VER
|
||||
numpy_url = 'http://downloads.sourceforge.net/project/numpy/NumPy/%s/numpy-%s.tar.gz' % (NUMPY_VER, NUMPY_VER)
|
||||
funcdesigner_src = 'FuncDesigner.zip'
|
||||
funcdesigner_url = 'http://trac.openopt.org/openopt/changeset/latest/PythonPackages/FuncDesigner?old_path=%2F&format=zip'
|
||||
|
||||
def indirdo(dr, fn):
|
||||
owd = os.getcwd()
|
||||
@ -18,19 +19,31 @@ def indirdo(dr, fn):
|
||||
fn()
|
||||
os.chdir(owd)
|
||||
|
||||
def get_file(url, fname):
|
||||
Popen(['wget', '-O', fname, url]).wait()
|
||||
|
||||
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(numpy_src):
|
||||
get_file(numpy_url, numpy_src)
|
||||
|
||||
if not os.path.exists(funcdesigner_src):
|
||||
get_file(funcdesigner_url, funcdesigner_src)
|
||||
|
||||
if not os.path.exists(numpy_src.replace('.tar.gz', '')):
|
||||
Popen(['tar', '-xvzf', numpy_src]).wait()
|
||||
|
||||
if not os.path.exists('PythonPackages/FuncDesigner'):
|
||||
Popen(['unzip', funcdesigner_src]).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()
|
||||
)
|
||||
Popen(['sudo', 'python', 'setup.py', 'install']).wait())
|
||||
|
||||
try:
|
||||
exec 'import FuncDesigner'
|
||||
except:
|
||||
indirdo('PythonPackages/FuncDesigner', lambda:
|
||||
Popen(['sudo', 'python', 'setup.py', 'install']).wait())
|
||||
|
Loading…
x
Reference in New Issue
Block a user