mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
setup: Move setting of srcdir down to the bottom
Put this variable assignment next to the others. Pass it to get_top_builddir() instead of relying on the global variable. Signed-off-by: Simon Glass <sjg@chromium.org> Message-ID: <20240811150248.7537-5-sjg@chromium.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
e277553b98
commit
3d5e376925
1 changed files with 6 additions and 5 deletions
11
setup.py
11
setup.py
|
@ -14,8 +14,6 @@ from setuptools import setup, Extension
|
||||||
from setuptools.command.build_py import build_py as _build_py
|
from setuptools.command.build_py import build_py as _build_py
|
||||||
|
|
||||||
|
|
||||||
srcdir = os.path.dirname(__file__)
|
|
||||||
|
|
||||||
def scan_for_info(srcdir):
|
def scan_for_info(srcdir):
|
||||||
"""Scan for the version and long_description fields
|
"""Scan for the version and long_description fields
|
||||||
|
|
||||||
|
@ -35,9 +33,12 @@ def scan_for_info(srcdir):
|
||||||
return version, long_description
|
return version, long_description
|
||||||
|
|
||||||
|
|
||||||
def get_top_builddir():
|
def get_top_builddir(srcdir):
|
||||||
"""Figure out the top-level directory containing the source code
|
"""Figure out the top-level directory containing the source code
|
||||||
|
|
||||||
|
Args:
|
||||||
|
srcdir (str): Source-directory path
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: Directory to build in
|
str: Directory to build in
|
||||||
"""
|
"""
|
||||||
|
@ -55,8 +56,8 @@ class BuildPy(_build_py):
|
||||||
return super().run()
|
return super().run()
|
||||||
|
|
||||||
|
|
||||||
|
srcdir = os.path.dirname(__file__)
|
||||||
version, long_description = scan_for_info(srcdir)
|
version, long_description = scan_for_info(srcdir)
|
||||||
top_builddir = get_top_builddir()
|
|
||||||
|
|
||||||
libfdt_module = Extension(
|
libfdt_module = Extension(
|
||||||
'_libfdt',
|
'_libfdt',
|
||||||
|
@ -64,7 +65,7 @@ libfdt_module = Extension(
|
||||||
define_macros=[('PY_SSIZE_T_CLEAN', None)],
|
define_macros=[('PY_SSIZE_T_CLEAN', None)],
|
||||||
include_dirs=[os.path.join(srcdir, 'libfdt')],
|
include_dirs=[os.path.join(srcdir, 'libfdt')],
|
||||||
libraries=['fdt'],
|
libraries=['fdt'],
|
||||||
library_dirs=[os.path.join(top_builddir, 'libfdt')],
|
library_dirs=[os.path.join(get_top_builddir(srcdir), 'libfdt')],
|
||||||
swig_opts=['-I' + os.path.join(srcdir, 'libfdt')],
|
swig_opts=['-I' + os.path.join(srcdir, 'libfdt')],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue