build.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/python
  2. # From Supertuxkart SVN revision $Revision$
  3. # Copyright (C) 2012 Jean-manuel clemencon (samuncle)
  4. # Class used to build the project
  5. ################################################################################
  6. from subprocess import check_output
  7. from utils import *
  8. class Build:
  9. """
  10. Interface for the builder
  11. """
  12. # if an error occured
  13. __noError = True
  14. #-------------------------------------------------------------------------------
  15. def __init__ (self, buildDir):
  16. """
  17. Constructor of the builder class
  18. """
  19. self.__buildDir = buildDir
  20. #-------------------------------------------------------------------------------
  21. def make(self, job):
  22. """
  23. the make command
  24. """
  25. changeDir = Cdir(self.__buildDir)
  26. # we try to build supertuxkart
  27. try:
  28. check_output(["make -j" + str(job)], shell=True)
  29. except:
  30. self.__noError = False
  31. del changeDir
  32. #-------------------------------------------------------------------------------
  33. def clean(self):
  34. """
  35. the clean command
  36. """
  37. changeDir = Cdir(self.__buildDir)
  38. check_output(["make clean"], shell=True)
  39. del changeDir
  40. #-------------------------------------------------------------------------------
  41. def noError(self):
  42. """
  43. return true if no error
  44. """
  45. return self.__noError