Changeset 16853 in niluje


Ignore:
Timestamp:
Feb 10, 2020, 6:28:31 PM (2 weeks ago)
Author:
NiLuJe
Message:

KoboStuff:

  • Hndle Py2 & Py3 separately when checking if we need to compile…
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Configs/trunk/Kindle/Kobo_Hacks/KoboStuff/src/usr/local/stuff/bin/python-setup.sh

    r16852 r16853  
    7979
    8080# Check if we actually need to do anything (i.e., when source is newer than bytecode)
     81COMPILE_PY2="true"
    8182my_python_iolib="${PY2HOME}/lib/python${PY2VER}/io"
    8283if [ -e "${my_python_iolib}.pyc" ] ; then
     
    8485                do_msg "[Py2] Bytecode is already up to date! :)"
    8586
    86                 return 0
     87                COMPILE_PY2="false"
    8788        fi
    8889fi
    8990
    9091# Otherwise, here we go...
    91 # Python 2
    92 do_msg "[Py2] Compiling bytecode (std)"
    93 do_progress
    94 ${PY2HOME}/bin/python${PY2VER} -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY2HOME}/lib/python${PY2VER}
    95 do_msg "[Py2] Compiling bytecode (std:opt)"
    96 do_progress
    97 ${PY2HOME}/bin/python${PY2VER} -OO -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY2HOME}/lib/python${PY2VER}
    98 do_msg "[Py2] Compiling bytecode (ext)"
    99 do_progress
    100 ${PY2HOME}/bin/python${PY2VER} -m compileall -f -x badsyntax ${PY2HOME}/lib/python${PY2VER}/site-packages
    101 do_msg "[Py2] Compiling bytecode (ext:opt)"
    102 do_progress
    103 ${PY2HOME}/bin/python${PY2VER} -OO -m compileall -f -x badsyntax ${PY2HOME}/lib/python${PY2VER}/site-packages
     92if [ "${COMPILE_PY2}" = "true" ] ; then
     93        # Python 2
     94        do_msg "[Py2] Compiling bytecode (std)"
     95        do_progress
     96        ${PY2HOME}/bin/python${PY2VER} -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY2HOME}/lib/python${PY2VER}
     97        do_msg "[Py2] Compiling bytecode (std:opt)"
     98        do_progress
     99        ${PY2HOME}/bin/python${PY2VER} -OO -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY2HOME}/lib/python${PY2VER}
     100        do_msg "[Py2] Compiling bytecode (ext)"
     101        do_progress
     102        ${PY2HOME}/bin/python${PY2VER} -m compileall -f -x badsyntax ${PY2HOME}/lib/python${PY2VER}/site-packages
     103        do_msg "[Py2] Compiling bytecode (ext:opt)"
     104        do_progress
     105        ${PY2HOME}/bin/python${PY2VER} -OO -m compileall -f -x badsyntax ${PY2HOME}/lib/python${PY2VER}/site-packages
     106fi
    104107
    105108# Python 3
    106 do_msg "[Py3] Compiling bytecode (std)"
    107 do_progress
    108 ${PY3HOME}/bin/python${PY3VER} -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY3HOME}/lib/python${PY3VER}
    109 do_msg "[Py3] Compiling bytecode (std:opt1)"
    110 do_progress
    111 ${PY3HOME}/bin/python${PY3VER} -O -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY3HOME}/lib/python${PY3VER}
    112 do_msg "[Py3] Compiling bytecode (std:opt2)"
    113 do_progress
    114 ${PY3HOME}/bin/python${PY3VER} -OO -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY3HOME}/lib/python${PY3VER}
    115 do_msg "[Py3] Compiling bytecode (ext)"
    116 do_progress
    117 ${PY3HOME}/bin/python${PY3VER} -m compileall -f -x badsyntax ${PY3HOME}/lib/python${PY3VER}/site-packages
    118 do_msg "[Py3] Compiling bytecode (ext:opt1)"
    119 do_progress
    120 ${PY3HOME}/bin/python${PY3VER} -O -m compileall -f -x badsyntax ${PY3HOME}/lib/python${PY3VER}/site-packages
    121 do_msg "[Py3] Compiling bytecode (ext:opt2)"
    122 do_progress
    123 ${PY3HOME}/bin/python${PY3VER} -OO -m compileall -f -x badsyntax ${PY3HOME}/lib/python${PY3VER}/site-packages
     109
     110# Check if we actually need to do anything (i.e., when source is newer than bytecode)
     111COMPILE_PY3="true"
     112my_python_iolib="${PY3HOME}/lib/python${PY3VER}/io"
     113if [ -e "${my_python_iolib}.pyc" ] ; then
     114        if [ "${my_python_iolib}.pyc" -nt "${my_python_iolib}.py" ] ; then
     115                do_msg "[Py3] Bytecode is already up to date! :)"
     116
     117                COMPILE_PY3="false"
     118        fi
     119fi
     120
     121if [ "${COMPILE_PY3}" = "true" ] ; then
     122        do_msg "[Py3] Compiling bytecode (std)"
     123        do_progress
     124        ${PY3HOME}/bin/python${PY3VER} -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY3HOME}/lib/python${PY3VER}
     125        do_msg "[Py3] Compiling bytecode (std:opt1)"
     126        do_progress
     127        ${PY3HOME}/bin/python${PY3VER} -O -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY3HOME}/lib/python${PY3VER}
     128        do_msg "[Py3] Compiling bytecode (std:opt2)"
     129        do_progress
     130        ${PY3HOME}/bin/python${PY3VER} -OO -m compileall -f -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data|test|tests' ${PY3HOME}/lib/python${PY3VER}
     131        do_msg "[Py3] Compiling bytecode (ext)"
     132        do_progress
     133        ${PY3HOME}/bin/python${PY3VER} -m compileall -f -x badsyntax ${PY3HOME}/lib/python${PY3VER}/site-packages
     134        do_msg "[Py3] Compiling bytecode (ext:opt1)"
     135        do_progress
     136        ${PY3HOME}/bin/python${PY3VER} -O -m compileall -f -x badsyntax ${PY3HOME}/lib/python${PY3VER}/site-packages
     137        do_msg "[Py3] Compiling bytecode (ext:opt2)"
     138        do_progress
     139        ${PY3HOME}/bin/python${PY3VER} -OO -m compileall -f -x badsyntax ${PY3HOME}/lib/python${PY3VER}/site-packages
     140fi
    124141
    125142# Flush to disk
Note: See TracChangeset for help on using the changeset viewer.