Update pywwwgetold.py
[PyWWW-Get.git] / setup
blob2cbf48b5b79741faa69798d496e91e8e5b607391
1 #!/usr/bin/env bash
3 if [ ! -n "${RMFILE}" ]; then
4 RMFILE="$(command -v rm) -rf"
5 fi
7 if [ ! -n "${PYTHON}" ]; then
8 PYTHON="$(command -v python)"
9 fi
11 if [ ! -n "${MKDIR}" ]; then
12 MKDIR="$(command -v mkdir) -v"
15 if [ ! -n "${INSTALL}" ]; then
16 INSTALL="$(command -v install) -v -c"
19 if [ ! -n "${PREFIX}" ]; then
20 PREFIX=$(${PYTHON} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib());")
23 printandrun() {
24 echo ${1}
25 eval ${1}
28 testandcreatedir() {
29 printandrun "test -z \"${1}\" || ${MKDIR} -p \"${1}\""
32 installpyfiles() {
33 printandrun "${INSTALL} \"${1}\" \"${2}\""
36 buildwithpy() {
37 printandrun "${PYTHON} -m compileall \"${PREFIX}/${1}\""
38 printandrun "${PYTHON} -O -m compileall \"${PREFIX}/${1}\""
41 OLDCWD="$(pwd)"
42 echo "Installing Python Moudle upcean";
43 echo "Checking for Python Moudle PIL"
44 ${PYTHON} -c "import PIL"
45 if [ "$?" -ne "0" ]; then
46 echo "Sorry could not find Python Moudle PIL";
47 exit 0;
49 echo "Checking for Python Moudle ReadLine"
50 ${PYTHON} -c "import readline"
51 if [ "$?" -ne "0" ]; then
52 echo "Sorry could not find Python Moudle ReadLine";
53 exit 0;
55 testandcreatedir "${PREFIX}/upcean"
56 for f in ./upcean/*; do
57 installpyfiles "${f}" "${PREFIX}/upcean/$(basename ${f})"
58 done
59 printandrun "cd \"${PREFIX}\""
60 buildwithpy "upcean"
61 printandrun "cd \"${OLDCWD}\""
62 echo "Finished installing Python Moudle upcean";