You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Noorul Islam K M <no...@collab.net> on 2010/11/01 08:11:55 UTC

[PATCH] make check-ctypes-python fails when executed from non src build direction

I get the following error when I try executing 

$ make check-ctypes-python

from build directory other then source directory.

-----------------------------------------------------------------------
Traceback (most recent call last):
  File "test/run_all.py", line 22, in <module>
    import setup_path
  File "/home/noorul/projects/subversion/subversion/bindings/ctypes-python/test/se
tup_path.py", line 31, in <module>                                               
    import csvn.core
  File "/home/noorul/projects/subversion/subversion/bindings/ctypes-python/csvn/co
re/__init__.py", line 20, in <module>                                            
    import functions
ImportError: No module named functions
make: *** [check-ctypes-python] Error 1
-----------------------------------------------------------------------

Attached is the patch to fix this.

Log
[[[

Fix minor bug.

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

]]]

Thanks and Regards
Noorul


Re: [PATCH] make check-ctypes-python fails when executed from non src build direction

Posted by Gavin Beau Baumanis <ga...@thespidernet.com>.
Thanks Julian,


Gavin "Beau" Baumanis



On 16/11/2010, at 9:41 PM, Julian Foad wrote:

> Gavin Beau Baumanis wrote:
>> Ping. This thread has received no further comments.
> 
> Thanks Gavin, but in fact I did commit Noorul's patch in r1030557:
> <http://svn.haxx.se/dev/archive-2010-11/0059.shtml>.  (The thread's
> subject line no longer contained '[PATCH]' by that point.)
> 
> I am not taking any further action with the duplication between setup.py
> and run_ctypesgen.sh.
> 
> - Julian
> 
> 
>> On 01/11/2010, at 9:24 PM, Julian Foad wrote:
>>> On Mon, 2010-11-01, Noorul Islam K M wrote:
>>>> * 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
> 
> 
> 

Re: [PATCH] make check-ctypes-python fails when executed from non src build direction

Posted by Julian Foad <ju...@wandisco.com>.
Gavin Beau Baumanis wrote:
> Ping. This thread has received no further comments.

Thanks Gavin, but in fact I did commit Noorul's patch in r1030557:
<http://svn.haxx.se/dev/archive-2010-11/0059.shtml>.  (The thread's
subject line no longer contained '[PATCH]' by that point.)

I am not taking any further action with the duplication between setup.py
and run_ctypesgen.sh.

- Julian


> On 01/11/2010, at 9:24 PM, Julian Foad wrote:
> > On Mon, 2010-11-01, Noorul Islam K M wrote:
> >> * 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



Re: [PATCH] make check-ctypes-python fails when executed from non src build direction

Posted by Gavin Beau Baumanis <ga...@thespidernet.com>.
Hi Everyone,

Ping. This thread has received no further comments.



Gavin "Beau" Baumanis
E: gavinb@thespidernet.com


On 01/11/2010, at 9:24 PM, Julian Foad wrote:

> 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
> 
> 

Re: make check-ctypes-python fails when executed from non src build direction

Posted by Julian Foad <ju...@wandisco.com>.
On Mon, 2010-11-01 at 13:29 -0400, Greg Stein wrote:
> On Mon, Nov 1, 2010 at 13:22, Jeremy Whitlock <jc...@gmail.com> wrote:
> >...
> >>> subversion/bindings/ctypes-python/README still refers to setup.py.
> >>
> >> I think this is for those who are not using --with-ctypesgen option
> >> while running configure script. Also this might work on Windows where
> >> configure coupled with "make ctypes-python" might not.
> >
> >
> > That is not true.  setup.py is used to compile and clean the ctype-based Python bindings.
> 
> Yeah, and I think its use should be removed. distutils is overly
> complicated for what *should* be a very simple build/clean process.
> 
> Placing the output into the source directory (vs build) was just a
> simple mistake. There isn't any particular reason for that, I believe.

I've committed Noorul's patch in r1030557 because it fixes the build
problem and I don't know how to make ctypes-python find the file if we
generate it in the build dir.  That can be a later enhancement.

- Julian


Re: make check-ctypes-python fails when executed from non src build direction

Posted by Greg Stein <gs...@gmail.com>.
On Mon, Nov 1, 2010 at 13:22, Jeremy Whitlock <jc...@gmail.com> wrote:
>...
>>> subversion/bindings/ctypes-python/README still refers to setup.py.
>>
>> I think this is for those who are not using --with-ctypesgen option
>> while running configure script. Also this might work on Windows where
>> configure coupled with "make ctypes-python" might not.
>
>
> That is not true.  setup.py is used to compile and clean the ctype-based Python bindings.

Yeah, and I think its use should be removed. distutils is overly
complicated for what *should* be a very simple build/clean process.

Placing the output into the source directory (vs build) was just a
simple mistake. There isn't any particular reason for that, I believe.

Cheers,
-g

Re: make check-ctypes-python fails when executed from non src build direction

Posted by Jeremy Whitlock <jc...@gmail.com>.
On Nov 1, 2010, at 11:02 AM, Noorul Islam K M wrote:

> Daniel Shahaf <d....@daniel.shahaf.name> writes:
> 
>> Noorul Islam K M wrote on Mon, Nov 01, 2010 at 22:09:23 +0530:
>> 
>>> Julian Foad <ju...@wandisco.com> writes:
>>>> 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.
>>> 
>>> I think setup.py is no longer used to generate bindings.
>>> 
>> 
>> subversion/bindings/ctypes-python/README still refers to setup.py.
> 
> I think this is for those who are not using --with-ctypesgen option
> while running configure script. Also this might work on Windows where
> configure coupled with "make ctypes-python" might not.


That is not true.  setup.py is used to compile and clean the ctype-based Python bindings.

Take care,

Jeremy Whitlock <jc...@gmail.com>
Twitter: jcscoobyrs
Website: http://www.thoughtspark.org



Re: make check-ctypes-python fails when executed from non src build direction

Posted by Noorul Islam K M <no...@collab.net>.
Daniel Shahaf <d....@daniel.shahaf.name> writes:

> Noorul Islam K M wrote on Mon, Nov 01, 2010 at 22:09:23 +0530:
>
>> Julian Foad <ju...@wandisco.com> writes:
>> > 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.
>> 
>> I think setup.py is no longer used to generate bindings.
>> 
>
> subversion/bindings/ctypes-python/README still refers to setup.py.

I think this is for those who are not using --with-ctypesgen option
while running configure script. Also this might work on Windows where
configure coupled with "make ctypes-python" might not.

Thanks and Regards
Noorul

Re: make check-ctypes-python fails when executed from non src build direction

Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Noorul Islam K M wrote on Mon, Nov 01, 2010 at 22:09:23 +0530:
> Julian Foad <ju...@wandisco.com> writes:
> > 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.
> 
> I think setup.py is no longer used to generate bindings.
> 

subversion/bindings/ctypes-python/README still refers to setup.py.

Re: make check-ctypes-python fails when executed from non src build direction

Posted by Noorul Islam K M <no...@collab.net>.
Julian Foad <ju...@wandisco.com> writes:

> 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.

I think setup.py is no longer used to generate bindings.

Thanks and Regards
Noorul

Re: [PATCH] make check-ctypes-python fails when executed from non src build direction

Posted by Julian Foad <ju...@wandisco.com>.
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