[d-feet: 1/7] build: Replace hard coded values for build time variables



commit 6d5fce6b2c2af7d6ff5c0115026846a9f013780e
Author: Iñigo Martínez <inigomartinez gmail com>
Date:   Tue Jan 22 08:25:03 2019 +0100

    build: Replace hard coded values for build time variables
    
    The test unit contains hard coded values for paths. However, these
    hard coded variables consider that the source code path and the
    build path are the same, something usual in autotools.
    
    These hard coded values has been replaced by build time variables
    that take the appropiate values considering different build paths.

 src/tests/Makefile.am | 4 +++-
 src/tests/tests.py.in | 4 ++--
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index d641dc7..5f61ae1 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -6,7 +6,9 @@ EXTRA_DIST = tests.py.in
 CLEANFILES = $(check_SCRIPTS)
 
 tests.py: tests.py.in
-       $(AM_V_GEN) sed -e 's|@PYTHON[@]|$(PYTHON)|g' $< > $@
+       $(AM_V_GEN) sed -e 's|@PYTHON[@]|$(PYTHON)|g' \
+                       -e 's|@DATA_DIR[@]|$(top_srcdir)/data|g' \
+                       -e 's|@SRC_DIR[@]|$(top_srcdir)|g' $< > $@
        chmod +x $@
 
 # Default pycodestyle --exclude + emacs backup files
diff --git a/src/tests/tests.py.in b/src/tests/tests.py.in
index 93cef12..35b1f55 100755
--- a/src/tests/tests.py.in
+++ b/src/tests/tests.py.in
@@ -3,7 +3,7 @@
 import sys
 import os
 import tempfile
-sys.path.insert(0, os.path.abspath(os.path.join(__file__, "../../")))
+sys.path.insert(0, os.path.abspath(os.path.join(__file__, "@SRC_DIR@")))
 
 from gi.repository import Gtk
 from gi.repository import Gio
@@ -35,7 +35,7 @@ XML = """
 </node>
 """
 
-DATA_DIR = os.path.abspath("../../data/")
+DATA_DIR = os.path.abspath("@DATA_DIR@")
 
 
 class IntrospectionHelperTest(unittest.TestCase):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]