sbs.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env python
  2. #
  3. # Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
  4. # All rights reserved.
  5. # This component and the accompanying materials are made available
  6. # under the terms of the License "Eclipse Public License v1.0"
  7. # which accompanies this distribution, and is available
  8. # at the URL "http://www.eclipse.org/legal/epl-v10.html".
  9. #
  10. # Initial Contributors:
  11. # Nokia Corporation - initial contribution.
  12. #
  13. # Contributors:
  14. #
  15. # Description:
  16. # lightweight script to start raptor
  17. #
  18. import sys
  19. import os
  20. import sbs_env
  21. import raptor.build
  22. profile_basename = None
  23. if 'SBS_PROFILE_BASENAME' in os.environ:
  24. profile_basename = os.environ['SBS_PROFILE_BASENAME']
  25. import cProfile
  26. #
  27. # Main takes the command-line (ignoring argv[0] which is the name of
  28. # this script) and returns the exit code.
  29. #
  30. if __name__ == "__main__":
  31. try:
  32. if profile_basename is not None:
  33. sys.exit(cProfile.run('raptor.build.Main(sys.argv[1:])',profile_basename))
  34. else:
  35. sys.exit(raptor.build.Main(sys.argv[1:]))
  36. except KeyboardInterrupt:
  37. sys.stderr.write("ERROR: sbs: Terminated by control-c or break\n")
  38. sys.exit(255)
  39. except ValueError as exc:
  40. sys.stderr.write("ERROR: sbs: {0}".format(str(exc)))
  41. sys.exit(255)