installer 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #!/usr/bin/env python
  2. import subprocess, os, time, xvfbwrapper, itertools
  3. def run(*args, **kwargs):
  4. return subprocess.Popen(args, **kwargs)
  5. def ratpoison(*args):
  6. return subprocess.check_output(("ratpoison",) + tuple(itertools.chain.from_iterable(("-c", a) for a in args)))
  7. def snooze(how_long = 15):
  8. time.sleep(how_long)
  9. def main():
  10. with xvfbwrapper.Xvfb(fbdir = "/framebuf"):
  11. print("DISPLAY={}".format(os.getenv("DISPLAY")))
  12. print("Starting rodent-free window manager")
  13. rat = run("ratpoison")
  14. snooze()
  15. print("Starting XiLinx installer")
  16. xsetup = run("./xsetup", cwd = "/xilinx-unpack/Xilinx_ISE_DS_Lin_14.7_1015_1")
  17. snooze()
  18. print("First screen")
  19. ratpoison("ratwarp 650 610", "ratclick")
  20. snooze()
  21. print("Second screen")
  22. ratpoison("ratwarp 250 420", "ratclick",
  23. "ratwarp 250 444", "ratclick",
  24. "ratwarp 650 610", "ratclick")
  25. snooze()
  26. print("Third screen")
  27. ratpoison("ratwarp 600 560", "ratclick",
  28. "ratwarp 650 610", "ratclick")
  29. snooze()
  30. print("Fourth screen")
  31. ratpoison("ratwarp 300 100", "ratclick",
  32. "ratwarp 650 610", "ratclick")
  33. for ith in ("Fifth", "Sixth", "Seventh"):
  34. snooze()
  35. print(ith + " screen")
  36. ratpoison("ratclick")
  37. print("Waiting half an hour for XiLinx installer to run, ^C if you get bored")
  38. snooze(1800)
  39. # In theory we could use visgrep to check for the "finish" button.
  40. # In practice ... this is such a kludge, what's one more, let's just
  41. # try blindly clicking where the finish button should be and see
  42. # if that results in a usable image.
  43. print("Blindly clicking where finish button should be, then shutting down")
  44. ratpoison("ratwarp 720 610", "ratclick",
  45. "quit")
  46. print("xsetup exited with status {}".format(xsetup.wait()))
  47. print("ratpoison exited with status {}".format(rat.wait()))
  48. if __name__ == "__main__":
  49. main()