On Mon, 2010-11-01, Noorul Islam K M wrote:
> I get the following error when I try executing 
> 
> $ make check-ctypes-python
> 
> from build directory other then source directory.
[...]
> ImportError: No module named functions
> make: *** [check-ctypes-python] Error 1

I also build in a separate directory, and have that same problem.

But ...

> * build/run_ctypesgen.sh: Use source directory as target instead of build
>   directory.

>  (cat $abs_srcdir/$cp_relpath/csvn/core/functions.py.in; \
>   sed -e '/^FILE =/d' $output | \
>   perl -pe 's{(\s+\w+)\.restype = POINTER\(svn_error_t\)}{\1.restype = 
> POINTER(svn_error_t)\n\1.errcheck = _svn_errcheck}' \
> - ) > $abs_builddir/$cp_relpath/csvn/core/functions.py
> + ) > $abs_srcdir/$cp_relpath/csvn/core/functions.py

I looked for other references to "functions.py", to check whether
anything else expects it to be in the build dir.  I found that
"subversion/bindings/ctypes-python/setup.py:build_functions_py()" also
builds "functions.py" from "functions.py.in".

Why the duplication, and should we un-duplicate it?  Here is the change
that introduced this:

[[[
r877501 | gstein | 2009-04-22 16:28:24 +0100 (Wed, 22 Apr 2009) | 12 lines

First step in integrating ctypesgen tighter into the build system. This
adds a little script to invoke ctypesgen rather than relying on setup.py
and distutils (don't get me started on that package).

* build/run_ctypesgen.sh:
  (): new script to invoke ctypesgen, given a bunch of configuration
    parameters as arguments. take particular care that we only write to
    the build tree, not the source tree.

* Makefile.in:
  (ctypes-python): use new helper script

Index: subversion/trunk/Makefile.in
===================================================================
--- subversion/trunk/Makefile.in        (revision 877500)
+++ subversion/trunk/Makefile.in        (revision 877501)
@@ -797,17 +797,13 @@ install-swig-rb-doc:
 
 # ctypes-python variables and make targets
 CTYPESGEN = @CTYPESGEN@
 CTYPES_PYTHON_SRC_DIR = $(abs_srcdir)/subversion/bindings/ctypes-python
 
 ctypes-python: local-all
-       cd $(CTYPES_PYTHON_SRC_DIR); \
-         $(LT_EXECUTE) $(PYTHON) setup.py build --subversion="$(prefix)" \
-         --apr="$(SVN_APR_PREFIX)" --apr-util="$(SVN_APRUTIL_PREFIX)" \
-         --ctypesgen="$(CTYPESGEN)" 
--svn-headers="$(abs_srcdir)/subversion/include" \
-         --cppflags="$(CPPFLAGS)" --ldflags="$(EXTRA_CTYPES_LDFLAGS)"
+       $(abs_srcdir)/build/run_ctypesgen.sh "$(LT_EXECUTE)" "$(CPPFLAGS)" 
"$(EXTRA_CTYPES_LDFLAGS)" "$(PYTHON)" "$(CTYPESGEN)" "$(abs_srcdir)" 
"$(abs_builddir)" "$(prefix)" "$(SVN_APR_PREFIX)" "$(SVN_APRUTIL_PREFIX)"
 
 install-ctypes-python: ctypes-python
        cd $(CTYPES_PYTHON_SRC_DIR); \
          $(PYTHON) setup.py install --prefix="$(DESTDIR)$(prefix)"
 
 check-ctypes-python: ctypes-python
]]]

It looks like build_functions_py() expects to create functions.py in the
*source* directory, and build/run_ctypesgen.sh intentionally creates it
in the *build* directory.

- Julian


Reply via email to