actions.py 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 2
  5. # See the file http://www.gnu.org/copyleft/gpl.txt
  6. from pisi.actionsapi import get
  7. from pisi.actionsapi import autotools
  8. from pisi.actionsapi import pisitools
  9. from pisi.actionsapi import shelltools
  10. def setup():
  11. # fixes build. so build uses python3 instead of python2
  12. pisitools.dosed("runtime/pgAdmin4.pro", "python-config", "python3-config")
  13. # fixes import error while sphinx builds documentation
  14. pisitools.dosed("web/pgadmin/browser/__init__.py", "_commit, default_render_json", "_commit, _render_json")
  15. shelltools.system(""" export PYTHONVERSION="$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')" """)
  16. shelltools.system(""" sed -E "s|/usr/pgadmin4/web|/usr/lib/pgadmin4/web|g; \
  17. s|/usr/pgadmin4/lib/python[0-9\\.]+|/usr/lib/python${PYTHONVERSION}|g" \
  18. -i runtime/ConfigWindow.ui """)
  19. shelltools.system(""" sed "s|##PYTHONVERSION##|${PYTHONVERSION}|g" -i runtime/Server.cpp """)
  20. shelltools.system(" sed -E -i requirements.txt \
  21. -e '/blinker>?=/d' \
  22. -e '/extras>?=/d' \
  23. -e '/Flask>?=/d' \
  24. -e '/Flask-Login>?=/d' \
  25. -e '/Flask-Migrate>?=/d' \
  26. -e '/Flask-SQLAlchemy>?=/d' \
  27. -e '/Flask-WTF>?=/d' \
  28. -e '/pycrypto>?=/d' \
  29. -e '/passlib>?=/d' \
  30. -e '/pytz>?=/d' \
  31. -e '/simplejson>?=/d' \
  32. -e '/six>?=/d' \
  33. -e '/speaklater>?=/d' \
  34. -e '/sqlparse>?=/d' \
  35. -e '/WTForms>?=/d' \
  36. -e '/psutil>?=/d' \
  37. -e '/psycopg2>?=/d' \
  38. -e '/python-dateutil>?=/d' \
  39. -e '/SQLAlchemy>?=/d' \
  40. -e '/Flask-Gravatar>?=/d' \
  41. -e '/Flask-Mail>?=/d' \
  42. -e '/Flask-Principal>?=/d' \
  43. -e '/Flask-Paranoid>?=/d' \
  44. -e '/htmlmin>?=/d' \
  45. -e '/Flask-Security>?=/d' \
  46. -e '/Flask-HTMLmin>?=/d' \
  47. -e '/Flask-Compress>?=/d' \
  48. -e '/sshtunnel>?=/d' \
  49. -e '/Werkzeug>?=/d' ")
  50. shelltools.system("cat requirements.txt")
  51. shelltools.export("LANG", "en_US.UTF-8")
  52. shelltools.export(" LC_ALL", "en_US.UTF-8")
  53. pisitools.dosed("docs/en_US/Makefile.sphinx", "PYTHON = python", "PYTHON = python3")
  54. shelltools.cd("runtime")
  55. shelltools.system("convert +set date:create +set date:modify pgAdmin4.ico pgAdmin4.png")
  56. shelltools.system("qmake CONFIG+=release")
  57. def build():
  58. autotools.make("docs")
  59. shelltools.cd("runtime")
  60. autotools.make()
  61. def install():
  62. pisitools.insinto("/usr/lib/pgadmin4/runtime", "runtime/pgAdmin4")
  63. pisitools.insinto("/usr/lib/pgadmin4/web", "web/*")
  64. pisitools.insinto("/usr/lib/pgadmin4/docs", "docs*")
  65. pisitools.insinto("/usr/share/icons/hicolor/256x256/apps", "runtime/pgAdmin4-0.png", "pgAdmin4.png")
  66. pisitools.insinto("/usr/share/icons/hicolor/48x48/apps", "runtime/pgAdmin4-1.png", "pgAdmin4.png")
  67. pisitools.insinto("/usr/share/icons/hicolor/32x32/apps", "runtime/pgAdmin4-2.png", "pgAdmin4.png")
  68. pisitools.insinto("/usr/share/icons/hicolor/16x16/apps", "runtime/pgAdmin4-3.png", "pgAdmin4.png")
  69. # add documentation
  70. pisitools.dohtml("docs/en_US/_build/*")
  71. if get.buildTYPE() != "_emul32":
  72. pisitools.dodoc("LICENSE", "README")