summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2010-09-17 21:10:33 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2010-09-17 21:10:33 +0000
commit63e23401df3cfe1ae77ca2dbe178ff3f0d9ed044 (patch)
tree59812630c4ab6dbacade126f9bf16f1a32ec46fa
parentb3adab4bff45a558669cbf903c6e7d85314ad775 (diff)
Python-EFL should be 200% foo-proof and aler the foo.
Now I want to see if raster manages to break it! Damn! :-D SVN revision: 52386
-rw-r--r--configure.ac17
-rw-r--r--m4/filter-var.m410
-rw-r--r--m4/python-efl.m446
-rw-r--r--m4/pythonpath.m481
-rw-r--r--python-edje.pc.in2
5 files changed, 151 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 48564a7..7f035ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -96,6 +96,12 @@ if test "x$CYTHON_FOUND" != "xyes"; then
96fi 96fi
97AM_CONDITIONAL(HAVE_CYTHON, [test "x$CYTHON_FOUND" = "xyes"]) 97AM_CONDITIONAL(HAVE_CYTHON, [test "x$CYTHON_FOUND" = "xyes"])
98 98
99FILTER_VAR_REGEXP([CFLAGS], [-fvisibility=hidden])
100FILTER_VAR_REGEXP([LDFLAGS], [-fvisibility=hidden])
101
102AM_CHECK_PYTHONPATH
103PY_EFL_PYTHONPATH([PYTHON_EVAS], [python-evas >= ${python_evas_version}])
104
99AC_PATH_PROG([EPYDOC], [epydoc], [no]) 105AC_PATH_PROG([EPYDOC], [epydoc], [no])
100AC_SUBST(EPYDOC) 106AC_SUBST(EPYDOC)
101AM_CONDITIONAL(HAVE_EPYDOC, [test "x$EPYDOC" != "xno"]) 107AM_CONDITIONAL(HAVE_EPYDOC, [test "x$EPYDOC" != "xno"])
@@ -144,10 +150,11 @@ echo "Installation...........: make install (as root if needed, with 'su' or 'su
144echo " prefix...............: $prefix" 150echo " prefix...............: $prefix"
145echo 151echo
146echo 152echo
147echo "To use the local version (as opposed to the installed version) use:"
148echo
149echo " export PYTHONPATH=\"$PWD:$PWD/.libs:\$PYTHONPATH\""
150echo " python -c 'import edje; print edje' # test load"
151echo
152 153
154if test "x$PYTHONPATH_CORRECT" != "xyes"; then
155 AC_MSG_WARN([your \$PYTHONPATH does not contains the required directories to support your desired installation. Please check warnings above.])
156fi
153 157
158if test "x${PYTHON_EVAS_PYTHONPATH_CORRECT}" != "xyes"; then
159 AC_MSG_WARN([your \$PYTHONPATH does not includes python-evas, required by edje module and this may cause runtime problems. Please check warnings above.])
160fi
diff --git a/m4/filter-var.m4 b/m4/filter-var.m4
new file mode 100644
index 0000000..9c970e4
--- /dev/null
+++ b/m4/filter-var.m4
@@ -0,0 +1,10 @@
1dnl FILTER_VAR_REGEXP(VARIABLE, REGEXP-TO-DELETE [, ACTION-IF-REMOVED])
2dnl Applies "sed" regular expression to remove REGEXP-TO-DELETE from $VARIABLE
3AC_DEFUN([FILTER_VAR_REGEXP],
4[
5_tmp_[]$1=`echo "$[]$1" | sed -e 's/$2//g'`
6if test "x$_tmp_[]$1" != "x$[]$1"; then
7 ifelse([$3], [], [AC_MSG_WARN([Removed $2 from \$[]$1])], [$3])
8 $1="$_tmp_[]$1"
9fi
10])
diff --git a/m4/python-efl.m4 b/m4/python-efl.m4
new file mode 100644
index 0000000..c4eeeab
--- /dev/null
+++ b/m4/python-efl.m4
@@ -0,0 +1,46 @@
1dnl PY_EFL_PYTHONPATH(VARIABLE, MODULE, [ACTION-YES [, ACTION-NO]])
2dnl checks if pkg-config MODULE specification provides $pythondir and
3dnl $pyexecdir that are present in $PYTHONPATH.
4dnl
5dnl defines ${MODULE}_PYTHONPATH_CORRECT=yes/no
6AC_DEFUN([PY_EFL_PYTHONPATH],
7[
8
9$1[]_PYTHONPATH_CORRECT=no
10
11PKG_CHECK_EXISTS([$2],
12 [$1[]_PYTHONPATH_CORRECT=yes], [$1[]_PYTHONPATH_CORRECT=no])
13
14if test "x$[]$1[]_PYTHONPATH_CORRECT" != "xyes"; then
15 ifelse([$4], [],
16 [AC_MSG_WARN([$2 is not installed. This may result in runtime problems with python that uses this module.])],
17 [$4])
18else
19 _pythondir=`pkg-config --variable=pythondir "$2"`
20 _pyexecdir=`pkg-config --variable=pyexecdir "$2"`
21 _missing_paths=""
22 AM_CHECK_PYTHONPATH_CONTAINS([$_pythondir], [:],
23 [$1[]_PYTHONPATH_CORRECT=no
24 _missing_paths="$_missing_paths $_pythondir"
25 ])
26
27 if test "$_pythondir" != "$_pyexecdir"; then
28 AM_CHECK_PYTHONPATH_CONTAINS([$_pyexecdir], [:],
29 [$1[]_PYTHONPATH_CORRECT=no
30 _missing_paths="$_missing_paths $_pythondir"
31 ])
32 fi
33
34 if test "$[]$1[]_PYTHONPATH_CORRECT" = "yes"; then
35 ifelse([$3], [], [:], [$3])
36 else
37 ifelse([$4], [],
38 [AC_MSG_WARN([\$PYTHONPATH does not include${_missing_paths} where $2 is installed. This may result in runtime problems with python that uses this module.])],
39 [$4])
40 fi
41fi
42
43unset _missing_paths
44unset _pythondir
45unset _pyexecdir
46])
diff --git a/m4/pythonpath.m4 b/m4/pythonpath.m4
new file mode 100644
index 0000000..7dc5a1a
--- /dev/null
+++ b/m4/pythonpath.m4
@@ -0,0 +1,81 @@
1dnl _CHECK_PYTHONPATH(PATH, ACTION-YES, ACTION-NO)
2AC_DEFUN([_CHECK_PYTHONPATH],
3[
4m4_define([pyprog], [import sys; sys.exit(not ('$1' in sys.path))])
5
6changequote(, )
7_cachevar=`echo "$1" | sed -e "s/[^a-zA-Z0-9_]/_0123_/g" `
8changequote([, ])
9_cachevar="py_cv_path_${_cachevar}"
10
11AC_CACHE_CHECK([for $1 in \$PYTHONPATH], [$_cachevar],
12 [
13 _res=no
14 if AC_RUN_LOG([$PYTHON -c "pyprog"]); then
15 _res=yes
16 fi
17 eval "${_cachevar}=$_res"
18 unset _res
19 ])
20eval "_res=\${${_cachevar}}"
21if test "$_res" = "yes"; then
22 $2
23else
24 $3
25fi
26])
27
28dnl a macro to check if install location is in $PYTHONPATH or builtin locations
29dnl AM_CHECK_PYTHONPATH([ACTION-YES [, ACTION-NO]])
30dnl defines PYTHONPATH_CORRECT=yes/no
31AC_DEFUN([AM_CHECK_PYTHONPATH],
32[AC_REQUIRE([AM_PATH_PYTHON])
33
34_orig_exec_prefix="$exec_prefix"
35if test -z "$exec_prefix" -o "$exec_prefix" = "NONE"; then
36 exec_prefix="$prefix"
37fi
38_pythondir=`eval "echo $pythondir"`
39_pyexecdir=`eval "echo $pyexecdir"`
40exec_prefix="${_orig_exec_prefix}"
41unset _orig_exec_prefix
42
43PYTHONPATH_CORRECT=yes
44
45_CHECK_PYTHONPATH([$_pythondir],
46 [ifelse([$1], [], [:], [$1])],
47 [PYTHONPATH_CORRECT=no
48 ifelse([$2], [],
49 [AC_MSG_WARN([\$PYTHONPATH does not include $_pythondir, this may result in runtime problems with python that uses this module.])],
50 [$2])])
51
52if test "$_pythondir" != "$_pyexecdir"; then
53_CHECK_PYTHONPATH([$_pyexecdir],
54 [ifelse([$1], [], [:], [$1])],
55 [PYTHONPATH_CORRECT=no
56 ifelse([$2], [],
57 [AC_MSG_WARN([\$PYTHONPATH does not include $_pyexecdir, this may result in runtime problems with python that uses this module.])],
58 [$2])])
59fi
60
61unset _pythondir
62unset _pyexecdir
63])
64
65dnl a macro to check if given directory is in $PYTHONPATH or builtin locations
66dnl AM_CHECK_PYTHONPATH_CONTAINS(DIRECTORY [, ACTION-YES [, ACTION-NO]])
67dnl defines PYTHONPATH_CORRECT=yes/no
68AC_DEFUN([AM_CHECK_PYTHONPATH_CONTAINS],
69[AC_REQUIRE([AM_PATH_PYTHON])
70
71_dir="$1"
72_dir=`expr "X$_dir" : 'X\(.*[^/]\)' \| "X$_dir" : 'X\(.*\)'`
73
74_CHECK_PYTHONPATH([$_dir],
75 [ifelse([$2], [], [:], [$2])],
76 [ifelse([$3], [],
77 [AC_MSG_WARN([\$PYTHONPATH does not include $_dir, this may result in runtime problems with python that uses this module.])],
78 [$3])])
79
80unset _dir
81])
diff --git a/python-edje.pc.in b/python-edje.pc.in
index e80aa32..eeb9330 100644
--- a/python-edje.pc.in
+++ b/python-edje.pc.in
@@ -3,6 +3,8 @@ exec_prefix=@exec_prefix@
3libdir=@libdir@ 3libdir=@libdir@
4datarootdir=@datarootdir@ 4datarootdir=@datarootdir@
5datadir=@datarootdir@/@PACKAGE@ 5datadir=@datarootdir@/@PACKAGE@
6pythondir=@pythondir@
7pyexecdir=@pyexecdir@
6 8
7Name: @PACKAGE@ 9Name: @PACKAGE@
8Description: Python bindings for Edje 10Description: Python bindings for Edje