Simon Glass | 76bce10 | 2016-07-04 11:58:11 -0600 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | """ |
| 4 | setup.py file for SWIG libfdt |
| 5 | """ |
| 6 | |
| 7 | from distutils.core import setup, Extension |
| 8 | import os |
| 9 | import sys |
| 10 | |
| 11 | # Don't cross-compile - always use the host compiler. |
| 12 | del os.environ['CROSS_COMPILE'] |
| 13 | del os.environ['CC'] |
| 14 | |
| 15 | progname = sys.argv[0] |
| 16 | cflags = sys.argv[1] |
| 17 | files = sys.argv[2:] |
| 18 | |
| 19 | if cflags: |
| 20 | cflags = [flag for flag in cflags.split(' ') if flag] |
| 21 | else: |
| 22 | cflags = None |
| 23 | |
| 24 | libfdt_module = Extension( |
| 25 | '_libfdt', |
| 26 | sources = files, |
| 27 | extra_compile_args = cflags |
| 28 | ) |
| 29 | |
| 30 | sys.argv = [progname, '--quiet', 'build_ext', '--inplace'] |
| 31 | |
| 32 | setup (name = 'libfdt', |
| 33 | version = '0.1', |
| 34 | author = "SWIG Docs", |
| 35 | description = """Simple swig libfdt from docs""", |
| 36 | ext_modules = [libfdt_module], |
| 37 | py_modules = ["libfdt"], |
| 38 | ) |