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 | # 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 | # This program is free software; you can redistribute it and/or modify |
| 13 | # it under the terms of the GNU General Public License version 2 as |
| 14 | # published by the Free Software Foundation. |
| 15 | # |
| 16 | # This program is distributed in the hope that it will be useful, |
| 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | # GNU General Public License for more details. |
| 20 | # |
| 21 | # You should have received a copy of the GNU General Public License along |
| 22 | # with this program; if not, write to the Free Software Foundation, Inc., |
| 23 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 24 | |
| 25 | import os |
| 26 | import sys |
| 27 | |
| 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 | |
| 35 | from bb import cookerdata |
| 36 | from bb.main import bitbake_main, BitBakeConfigParameters, BBMainException |
| 37 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame^] | 38 | if sys.getfilesystemencoding() != "utf-8": |
| 39 | sys.exit("Please use a locale setting which supports 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.") |
| 40 | |
| 41 | __version__ = "1.32.0" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 42 | |
| 43 | if __name__ == "__main__": |
| 44 | if __version__ != bb.__version__: |
| 45 | sys.exit("Bitbake core version and program version mismatch!") |
| 46 | try: |
| 47 | sys.exit(bitbake_main(BitBakeConfigParameters(sys.argv), |
| 48 | cookerdata.CookerConfiguration())) |
| 49 | except BBMainException as err: |
| 50 | sys.exit(err) |
| 51 | except bb.BBHandledException: |
| 52 | sys.exit(1) |
| 53 | except Exception: |
| 54 | import traceback |
| 55 | traceback.print_exc() |
| 56 | sys.exit(1) |