Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 2 | # |
| 3 | # Copyright (C) 2003, 2004 Chris Larson |
| 4 | # Copyright (C) 2003, 2004 Phil Blundell |
| 5 | # Copyright (C) 2003 - 2005 Michael 'Mickey' Lauer |
| 6 | # Copyright (C) 2005 Holger Hans Peter Freyther |
| 7 | # Copyright (C) 2005 ROAD GmbH |
| 8 | # Copyright (C) 2006 Richard Purdie |
| 9 | # |
Brad Bishop | c342db3 | 2019-05-15 21:57:59 -0400 | [diff] [blame] | 10 | # SPDX-License-Identifier: GPL-2.0-only |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 11 | # |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 12 | |
| 13 | import os |
| 14 | import sys |
| 15 | |
| 16 | sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), |
| 17 | 'lib')) |
| 18 | try: |
| 19 | import bb |
| 20 | except RuntimeError as exc: |
| 21 | sys.exit(str(exc)) |
| 22 | |
| 23 | from bb import cookerdata |
| 24 | from bb.main import bitbake_main, BitBakeConfigParameters, BBMainException |
| 25 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 26 | if sys.getfilesystemencoding() != "utf-8": |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 27 | 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.") |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 28 | |
Andrew Geissler | d25ed32 | 2020-06-27 00:28:28 -0500 | [diff] [blame] | 29 | __version__ = "1.47.0" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | |
| 31 | if __name__ == "__main__": |
| 32 | if __version__ != bb.__version__: |
| 33 | sys.exit("Bitbake core version and program version mismatch!") |
| 34 | try: |
| 35 | sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv), |
| 36 | cookerdata.CookerConfiguration())) |
| 37 | except BBMainException as err: |
| 38 | sys.exit(err) |
| 39 | except bb.BBHandledException: |
| 40 | sys.exit(1) |
| 41 | except Exception: |
| 42 | import traceback |
| 43 | traceback.print_exc() |
| 44 | sys.exit(1) |