actions.py 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from pisi.actionsapi import pythonmodules
  7. from pisi.actionsapi import pisitools
  8. from pisi.actionsapi import shelltools
  9. from pisi.actionsapi import get
  10. WorkDir="docutils-%s" % get.srcVERSION()
  11. def setup():
  12. shelltools.cd("..")
  13. shelltools.makedirs("build_python")
  14. shelltools.copytree("./%s" % WorkDir, "build_python")
  15. shelltools.cd(WorkDir)
  16. shelltools.cd("..")
  17. shelltools.makedirs("build_python3")
  18. shelltools.copytree("./%s" % WorkDir, "build_python3")
  19. shelltools.cd(WorkDir)
  20. def build():
  21. pythonmodules.compile()
  22. shelltools.cd("../build_python/%s" % WorkDir)
  23. pythonmodules.compile()
  24. shelltools.system("pwd")
  25. shelltools.cd("../../build_python3/%s" % WorkDir)
  26. pythonmodules.compile(pyVer="3")
  27. def install():
  28. pythonmodules.install()
  29. #Remove .py extensions from scripts in /usr/bin
  30. for f in shelltools.ls("%s/usr/bin" % get.installDIR()):
  31. pisitools.domove("/usr/bin/%s" % f, "/usr/bin", f.replace(".py", ""))
  32. for bin in shelltools.ls("%s/usr/bin" % get.installDIR()):
  33. pisitools.rename("/usr/bin/%s" % bin, "%s_2" % bin)
  34. shelltools.cd("../build_python3/%s" % WorkDir)
  35. pythonmodules.install(pyVer="3")
  36. #Remove .py extensions from scripts in /usr/bin
  37. for f in shelltools.ls("%s/usr/bin" % get.installDIR()):
  38. pisitools.domove("/usr/bin/%s" % f, "/usr/bin", f.replace(".py", ""))
  39. else:
  40. pisitools.dosym("/usr/bin/rst2man", "/usr/bin/rst2man.py")
  41. # for bin in shelltools.ls("%s/usr/bin" % get.installDIR()):
  42. # pisitools.rename("/usr/bin/%s" % bin, "%s_3" % bin)
  43. # shelltools.cd("../../build_python/%s" % WorkDir)
  44. # pythonmodules.install()
  45. #Remove .py extensions from scripts in /usr/bin
  46. # for f in shelltools.ls("%s/usr/bin" % get.installDIR()):
  47. # pisitools.domove("/usr/bin/%s" % f, "/usr/bin", f.replace(".py", ""))