Todays work. replaced all the headachey python module install details with a shell script.
[root@kindle root]#
/mnt/us/soundkloud/prep.sh
EDIT: Updated version will try to check for non-standard installs...
(this is on a 5 with a non standard installed python but a missing pythonenv for example)
[root@kindle soundkloud]#
./prep.sh
Quote:
Internet Connection tests as okay... Continuing
Non-Standard Python install maybe?... Searching /mnt/us/* (gimme a sec...)
python located, run AND greater than version 2.7: 1
Sorry it didn't work out... For more info on WHICH PYTHON TO RUN see http://bit.ly/soundkloud
|
okay so let see what would happen if we "fixed it"
Spoiler:
(NOTE: the pythonenv files EXPECTS to be in a directory named python to minimise false postives, and in the /mnt/us/* hierarchy)
So where are we gonna do this test?
[root@kindle python]#
pwd
[root@kindle python]#
cat > ./pythonenv << EOF
Quote:
> export PYTHONPATH=/mnt/us/usr/lib/python2.7
> EOF
|
Now it works okay... Even with a non-standard location. ( fails on zero size files)
To hide library complaints one could....
[root@kindle soundkloud]#
./prep.sh 2> /dev/null
prep.sh
Spoiler:
PHP Code:
#!/bin/sh
#Check for python
skroot=/mnt/us/soundkloud/ # the default location...
REPORT="" # error holder
MYPY=/mnt/us/python/usr/bin/python2.7 # the default location...
MYENV=/mnt/us/python/pythonenv # the default location...
TESTURL=google.com # meh you never know... someone might not be able to reach that...
## For if we fail
report ()
{ # spit it out...
eips -c
echo $REPORT
# Drop and roll...
eips -g /mnt/us/soundkloud/prep.jpg
eips 0 1 "$REPORT"
sleep 2
eips " PRESS HOME KEY TO RETURN TO YOUR KINDLE "
echo "Sorry it didn't work out... For more info on WHICH PYTHON TO RUN see http://bit.ly/soundkloud"
exit 1
}
## internet test
if ! ping -c 1 $TESTURL > /dev/null
then
REPORT=" Please connect internet before proceeding "
eips -c
eips 0 1 "$REPORT"
sleep 2
eips " PRESS HOME KEY TO RETURN TO YOUR KINDLE "
exit 1
## we are good to go
else
echo "Internet Connection tests as okay... Continuing"
fi
## python location and version test
if [ ! -e $MYPY ]
then
echo "Non-Standard Python install maybe?... Searching /mnt/us/* (gimme a sec...)"
MYPY=$(find /mnt/us/ -name '*'"python2.7"'*' | grep "bin/python" )
## we failed
if [ -z $MYPY ]
then
REPORT=" PY NOT FOUND. see http://bit.ly/soundkloud "
report
fi
fi
# Make sure python is 2.7 or later
PYTHON_OK=`$MYPY -c 'import sys
print (sys.version_info >= (2, 7) and "1" or "0")'`
echo "python located, run AND greater than version 2.7: $PYTHON_OK"
if [ "$PYTHON_OK" = '0' ]; then
REPORT=" PY VERSION FAIL. see http://bit.ly/soundkloud "
report
fi
## check we have an env to source - Or find one
if [ ! -e $MYENV ]
then
MYENV=$(find /mnt/us/ -name '*'"pythonenv" | grep "python/pythonenv" )
fi
## we failed
if [ -z $MYENV ]
then
REPORT=" NO PY ENV?. see http://bit.ly/soundkloud "
report
fi
## not 0 sized right?
if [ ! -s $MYENV ]
then
REPORT=" ENV FILE 0 SIZE see http://bit.ly/soundkloud "
report
else
echo "using python environment file: $MYENV"
fi
## phew we made it...
cd $skroot
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
usleep 100
source $MYENV
## hey, if you have a non standard install you could mess with this.
## But the above logic should do the work now...
## Let's hope that you have your python IN your PATH!!
## meh no? add an extra splatter - just in case...
export PATH=`dirname $MYPY`:/mnt/us/python/usr/bin:/mnt/us/python/usr/local/bin:$PATH
sh ./setuptools-0.6c11-py2.7.egg
usleep 100
easy_install pip
usleep 100
pip install soundcloud
usleep 100
pip install -I requests==0.14.2
eips -c
eips -g /mnt/us/soundkloud/post.jpg
usleep 500
eips " PRESS HOME KEY TO RETURN TO YOUR KINDLE "
this makes a one shot installer a far closer reality.
Also fixed up the build scripts to be much shorter and simpler to read.
reworked the build so that the armv6l and the arm7l targets are chosen at run-time. Thus one release suits all..
more stuff i should note down but yeah progress.