u-boot/lib/libfdt/setup.py
Stefan Agner 9963890b8b libfdt: fix build with Python 3
For some reason Python 3 seems to think it does not need to build
the library. Using the --force parameter makes sure that the library
gets built always. This is especially important since we move the
library in the next step of the Makefile, hence forcing a rebuild
every time the higher level Makefile triggers a rebuild is required
to make sure the library is always there.

Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Simon Glass <sjg@chromium.org>
2017-04-10 13:25:19 -06:00

38 lines
784 B
Python

#!/usr/bin/env python
"""
setup.py file for SWIG libfdt
"""
from distutils.core import setup, Extension
import os
import sys
# Don't cross-compile - always use the host compiler.
del os.environ['CROSS_COMPILE']
del os.environ['CC']
progname = sys.argv[0]
cflags = sys.argv[1]
files = sys.argv[2:]
if cflags:
cflags = [flag for flag in cflags.split(' ') if flag]
else:
cflags = None
libfdt_module = Extension(
'_libfdt',
sources = files,
extra_compile_args = cflags
)
sys.argv = [progname, '--quiet', 'build_ext', '--inplace', '--force']
setup (name = 'libfdt',
version = '0.1',
author = "SWIG Docs",
description = """Simple swig libfdt from docs""",
ext_modules = [libfdt_module],
py_modules = ["libfdt"],
)