Skip to content

Commit

Permalink
one setup file for all packages ... -Minesh
Browse files Browse the repository at this point in the history
  • Loading branch information
pycon authored and pycon committed Feb 2, 2013
1 parent 3fe43df commit fddeb54
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 17 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#other projects
usr

.ropeproject

*.py[cod]
Expand Down
8 changes: 4 additions & 4 deletions run_this_to_confirm_you_have_the_correct_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# either missing libraries or your libraries are of the wrong version

EXPECTED_PP_VERSION = "1.6.3"
EXPECTED_MATPLOTLIB_VERSION = "1.1.1rc"
EXPECTED_NUMPY_VERSION = "1.6.1"
EXPECTED_MATPLOTLIB_VERSION = ("1.1.1", "1.1.1rc")
EXPECTED_NUMPY_VERSION = ("1.6.1", "1.6.2")

libraries_missing_or_wrong_version = False

Expand Down Expand Up @@ -40,7 +40,7 @@
try:
import numpy
numpy_version = numpy.__version__
if numpy_version != EXPECTED_NUMPY_VERSION:
if numpy_version not in EXPECTED_NUMPY_VERSION:
print "You don't have the expected version of numpy"
print "We're expecting you to have {} and you have {}".format(EXPECTED_NUMPY_VERSION, numpy_version)
print "If your version is newer or similar then you're probably ok, if it is much older then you should upgrade via: http://scipy.org/Download"
Expand All @@ -52,7 +52,7 @@
try:
import matplotlib
matplotlib_version = matplotlib.__version__
if matplotlib_version != EXPECTED_MATPLOTLIB_VERSION:
if matplotlib_version not in EXPECTED_MATPLOTLIB_VERSION:
print "You have a different version {} of matplotlib than the {} that we expect".format(matplotlib_version, EXPECTED_MATPLOTLIB_VERSION)
print "If your version is similar or newer (or at least better than 1.0.0) then you are probably ok"
print "You can upgrade or check the latest version here: http://matplotlib.org/downloads.html"
Expand Down
62 changes: 49 additions & 13 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/sh

tab=" ";

sudo -n pwd > /dev/null 2>&1;
if [ $? != 0 ]; then
echo "#";
Expand All @@ -13,24 +15,26 @@ fi;

echo "# Info: Installing required packages ...";
(
tab=" ";
for pkg in git \
openssh-server \
expect \
\
libblas-dev \
liblapack-dev \
gfortran \
\
python-dev \
python-pip \
python-dateutil \
python-numpy \
cython \
python-scipy \
python-sklearn \
\
erlang-base \
erlang \
; do
echo "#${tab}${pkg} " ;
sudo rm -rf /dev/shm/[Pp]illow* \
\
&& \
\
sudo apt-get install \
-y ${pkg} \
>/dev/null 2>&1;
Expand All @@ -40,15 +44,47 @@ echo "# Info: Installing required packages ...";
fi;
done;

echo "#${tab}pillow" ;
sudo pip install \
-d /dev/shm \
pillow \
> /dev/null 2>&1;
for pkg in pillow \
pp \
; do
(cd /dev/shm ; ls -1 | grep -i ${pkg} | xargs -n 1 sudo rm -rf) > /dev/null 2>&1;
echo "#${tab}${pkg}" ;
sudo pip install \
-b /dev/shm \
${pkg} \
> /dev/null 2>&1;
stat=$?;

(cd /dev/shm ; ls -1 | grep -i ${pkg} | xargs -n 1 sudo rm -rf) > /dev/null 2>&1;
if [ ${stat} != 0 ]; then
exit 1;
fi;
done;

exit 0;
);

if [ $? != 0 ]; then
echo "#";
echo "# Error: Could not install packages. Am quitting.";
echo "#";
exit 1;
fi;

if [ $? != 0 ]; then
exit 1;
fi;
echo "# Info: DISCO package";
(
mkdir -p ./usr && \
cd ./usr && \
sudo rm -rf ./DISCO_HOME && \
echo "#${tab}Downloading ..." && \
git clone git://github.com/discoproject/disco.git DISCO_HOME >/dev/null 2>&1 && \
cd DISCO_HOME && \
git checkout f193331965e8aac459ff9a4115cef522e357098b >/dev/null 2>&1 && \
echo "#${tab}Compling ..." && \
make >/dev/null 2>&1 && \
cd lib && \
echo "#${tab}Installing ..." && \
sudo python ./setup.py install >/dev/null 2>&1 ;
);

if [ $? != 0 ]; then
Expand Down
64 changes: 64 additions & 0 deletions setup.tcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/sh

(
/usr/bin/expect --<<EOF
spawn ssh localhost pwd;
expect {
"Are you sure you want to continue connecting (yes/no)? " {
puts "About to generate key ...";
}
"localhost's password: " {
puts "About to generate key ...";
}
eof {
exit 0;
}
}
spawn ssh-keygen -t rsa;
expect {
"Enter file in which to save the key (/home/*/.ssh/id_rsa): " {
send "\n" ;
exp_continue;
}
"Enter passphrase (empty for no passphrase): " {
send "\n" ;
exp_continue;
}
"Enter same passphrase again: " {
send "\n" ;
exp_continue;
}
"Overwrite (y/n)? " {
send "y\n" ;
exp_continue;
}
eof {
system ssh-add;
system cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys;
}
}
system ls -la ~/.ssh;
spawn ssh localhost pwd;
expect {
"Are you sure you want to continue connecting (yes/no)? " {
send "yes\n" ;
exp_continue;
}
eof {
exit 0;
}
}
exit 1;
EOF
) > /dev/null 2>&1;

if [ $? != 0 ]; then
echo "#";
echo "# Error: Seems like ssh requires password. Am quitting ...";
echo "#";
exit 1;
fi;

exit 0;

0 comments on commit fddeb54

Please sign in to comment.