bitbake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env python3
  2. # ex:ts=4:sw=4:sts=4:et
  3. # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
  4. #
  5. # Copyright (C) 2003, 2004 Chris Larson
  6. # Copyright (C) 2003, 2004 Phil Blundell
  7. # Copyright (C) 2003 - 2005 Michael 'Mickey' Lauer
  8. # Copyright (C) 2005 Holger Hans Peter Freyther
  9. # Copyright (C) 2005 ROAD GmbH
  10. # Copyright (C) 2006 Richard Purdie
  11. #
  12. # SPDX-License-Identifier: GPL-2.0-only
  13. #
  14. # This program is free software; you can redistribute it and/or modify
  15. # it under the terms of the GNU General Public License version 2 as
  16. # published by the Free Software Foundation.
  17. #
  18. # This program is distributed in the hope that it will be useful,
  19. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. # GNU General Public License for more details.
  22. #
  23. # You should have received a copy of the GNU General Public License along
  24. # with this program; if not, write to the Free Software Foundation, Inc.,
  25. # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  26. import os
  27. import sys
  28. sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),
  29. 'lib'))
  30. try:
  31. import bb
  32. except RuntimeError as exc:
  33. sys.exit(str(exc))
  34. from bb import cookerdata
  35. from bb.main import bitbake_main, BitBakeConfigParameters, BBMainException
  36. if sys.getfilesystemencoding() != "utf-8":
  37. sys.exit("Please use a locale setting which supports UTF-8 (such as LANG=en_US.UTF-8).\nPython can't change the filesystem locale after loading so we need a UTF-8 when Python starts or things won't work.")
  38. __version__ = "1.43.0"
  39. if __name__ == "__main__":
  40. if __version__ != bb.__version__:
  41. sys.exit("Bitbake core version and program version mismatch!")
  42. try:
  43. sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv),
  44. cookerdata.CookerConfiguration()))
  45. except BBMainException as err:
  46. sys.exit(err)
  47. except bb.BBHandledException:
  48. sys.exit(1)
  49. except Exception:
  50. import traceback
  51. traceback.print_exc()
  52. sys.exit(1)