Copy the tools directory from source to build directory
The python setup script looks for the needed mako templates in
source directory (srcdir). But if the sdbusplus repository is
built through bitbake, the mako templates that are auto-generated
are created in the build directory (builddir).
Copy all the needed files to the builddir, specify update=1
to preserve any built file from being overwritten.
This allows for support of out of tree builds.
Change-Id: Icb6090df5ea083b4b5f1bc1c5b320d40f57596e0
Signed-off-by: Adriana Kobylak <anoo@us.ibm.com>
diff --git a/tools/setup.py.in b/tools/setup.py.in
index 761043c..4bc00e4 100644
--- a/tools/setup.py.in
+++ b/tools/setup.py.in
@@ -1,9 +1,18 @@
from distutils.core import setup
+from distutils.command.build import build
+from distutils.dir_util import copy_tree
+
+
+class CustomBuild(build):
+ def run(self):
+ if ('@top_srcdir@' != '@top_builddir@'):
+ copy_tree('@top_srcdir@/tools/', '@top_builddir@/tools/', update=1)
setup(name='sdbusplus',
version='1.0',
- package_dir={'':'@top_srcdir@/tools'},
+ package_dir={'':'@top_builddir@/tools'},
packages=['sdbusplus'],
- scripts=['@top_srcdir@/tools/sdbus++'],
+ scripts=['@top_builddir@/tools/sdbus++'],
+ cmdclass={'build': CustomBuild},
package_data={'sdbusplus': ['templates/*.mako.*']},
)