fix-python.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. # needed for strip
  3. source util/activate.sh
  4. HDD_PATH=base
  5. pushd $HDD_PATH/usr/python/lib || exit 1
  6. echo "Stripping shared library..."
  7. chmod +w libpython3.6m.so
  8. i686-pc-toaru-strip libpython3.6m.so
  9. chmod -w libpython3.6m.so
  10. echo "Killing __pycache__ directories..."
  11. find . -name __pycache__ -exec rm -r "{}" \;
  12. # Let's kill some other shit while we're in here
  13. pushd python3.6 || exit 1
  14. echo "Cleaning up unused modules..."
  15. rm -r test distutils tkinter multiprocessing ensurepip config-3.6m/libpython3.6m.a
  16. popd
  17. popd
  18. pushd $HDD_PATH/usr
  19. if [ ! -d bin ]; then
  20. mkdir bin
  21. fi
  22. pushd bin
  23. # Can never be too careful.
  24. ln -s ../python/bin/python3.6 python3.6
  25. ln -s ../python/bin/python3.6 python3
  26. ln -s ../python/bin/python3.6 python
  27. popd
  28. pushd lib
  29. ln -s ../python/lib/libpython3.6m.so
  30. popd
  31. popd
  32. echo "Installing readline hook..."
  33. cp util/readline._py $HDD_PATH/usr/python/lib/python3.6/
  34. echo "Installing demos..."
  35. mkdir -p base/usr/share/python-demos
  36. cp util/python-demos/*.py base/usr/share/python-demos/
  37. echo "Installing Help Browser files..."
  38. mkdir -p base/usr/share/help
  39. mkdir -p base/usr/share/help/licenses
  40. cp util/extra-help/*.trt base/usr/share/help/
  41. cp util/extra-help/licenses/*.trt base/usr/share/help/licenses/