You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Daniel Rall <dl...@finemaltcoding.com> on 2002/11/07 07:03:58 UTC
[PATCH] Use swig binary from --with-swig configure switch
I have two versions of SWIG installed on my RedHat 7.3 box. The one
installed via RPM which is in my PATH is too old. The following patch
teaches the top-level Makefile to use the swig binary in the directory
passed via the --with-swig configure option.
* Makefile.in
Added SWIG add variable using value from configure preprocessor.
Pass -s flag to setup.py to use the right swig binary.
* setup.py
(find_swig): Since the Makefile now always passes -s, assure that we
not only have a value for swig_location, but that we have a value
which actually points to a file.
Index: Makefile.in
===================================================================
--- Makefile.in (revision 3678)
+++ Makefile.in (working copy)
@@ -65,6 +65,7 @@
APACHE_TARGET = @APACHE_TARGET@
APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
+SWIG = @SWIG@
SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@
SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
@@ -266,6 +267,7 @@
-I$(abs_srcdir)/subversion/include $(SVN_APR_INCLUDES) \
-S$(SWIG_SRC_DIR) \
-L$(DESTDIR)$(prefix)/lib -L$(SVN_APR_PREFIX)/lib \
+ -s$(SWIG) \
build --build-base=$(SWIG_BUILD_DIR)/python/build)
install-swig-py-ext:
Index: subversion/bindings/swig/python/setup.py
===================================================================
--- subversion/bindings/swig/python/setup.py (revision 3678)
+++ subversion/bindings/swig/python/setup.py (working copy)
@@ -94,10 +94,10 @@
def find_swig<(self):
global swig_location
- if swig_location is None:
- return build_ext.build_ext.find_swig(self)
- else:
+ if swig_location and os.path.isfile(swig_location):
return swig_location
+ else:
+ return build_ext.build_ext.find_swig(self)
def swig_sources(self, sources):
swig = self.find_swig()
Incidently, even with the above patch I can't complete a build of the
"swig-py-ext" target:
building '_client' extension
swigging /home/dlr/src/svn/subversion/bindings/swig/svn_client.i to /home/dlr/src/svn/subversion/bindings/swig/python/build/svn_client.c
/usr/local/swig/bin/swig -c -python -noproxy -I/home/dlr/src/svn/subversion/bindings/swig -I/home/dlr/src/svn/subversion/include -I/home/dlr/src/apache.org/httpd-2.0/srclib/apr/include -I/home/dlr/src/apache.org/apr/include -I/usr/include/python2.2 -o /home/dlr/src/svn/subversion/bindings/swig/python/build/svn_client.c /home/dlr/src/svn/subversion/bindings/swig/svn_client.i
:1: Unable to find 'swig.swg'
:3: Unable to find 'python.swg'
/home/dlr/src/svn/subversion/bindings/swig/svn_client.i:20: Unable to find 'typemaps.i'
error: command '/usr/local/swig/bin/swig' failed with exit status 1
make: *** [swig-py-ext] Error 1
dlr@despot:svn$ find /usr/local/swig/ -type f -name swig.swg
/usr/local/swig/lib/swig1.3/swig.swg
I curious whether this has anything to do with my SWIG version.
Anyone got any ideas?
dlr@despot:svn$ /usr/local/swig/bin/swig -version
SWIG Version 1.3.15u-20021011-1838
Copyright (c) 1995-1998
University of Utah and the Regents of the University of California
Copyright (c) 1998-2001
University of Chicago
Compiled with CC
In any case, in my environment I'm missing a -I flag,
$(SWIG_DIR)/lib/swig1.3. When I check in the Java stuff, I'll also be
missing $(SWIG_DIR)/lib/swig1.3/java.
- Dan
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Use swig binary from --with-swig configure switch
(take 2)
Posted by Justin Erenkrantz <je...@apache.org>.
--On Thursday, November 7, 2002 8:34 PM -0800 Daniel Rall
<dl...@finemaltcoding.com> wrote:
> With Greg's suggestion, I don't need the patch to setup.py, so I'm
> leaving that out.
Committed in r3703. Thanks!
Alas, there was a problem in trying to commit this, but that's
another email coming soon. (Nothing to do with your patch.) --
justin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
[PATCH] Use swig binary from --with-swig configure switch (take 2)
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Greg Stein <gs...@lyra.org> writes:
> On Thu, Nov 07, 2002 at 12:10:02PM -0800, Daniel Rall wrote:
> >...
> > Unfortunately, when $(SWIG) isn't defined (I'm assuming this happens
> > when you don't pass --with-swig, I triggered it in testing by
> > explicitly commenting out the SWIG= bit in the patch above), your
> > getopt from setup.py seems to think that it should handle
> > --bulid-base, which it doesn't define. I'm guessing that --build-base
> > is handled by distutils' getopt processing.
>
> If SWIG isn't defined, then we shouldn't try to invoke it. Since somebody
> might want to do:
>
> $ make swig-py-ext SWIG=/usr/local/bin/swig
>
> We probably want a runtime test in the make rule. Something like:
>
> swig-py-ext:
> if test -n "$(SWIG)"; then \
> (cd $(SWIG_SRC_DIR)/python; \
> ...
> else \
> echo "SWIG variable is not defined; this rule is unavailable." \
> fi
You can find take 1 here:
http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgId=205572
With Greg's suggestion, I don't need the patch to setup.py, so I'm
leaving that out.
* Makefile.in
(SWIG): New make variable, derived from value passed via --with-swig
configure switch.
(swig-py-ext): Pass -s flag to setup.py to use the user-specified
swig binary (rather than whatever happens to be in their path),
failing with error message and status if SWIG is not set. Removed
parens creating extraneous sub-shell.
Index: Makefile.in
===================================================================
--- Makefile.in (revision 3691)
+++ Makefile.in (working copy)
@@ -65,6 +65,7 @@
APACHE_TARGET = @APACHE_TARGET@
APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
+SWIG = @SWIG@
SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@
SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
@@ -260,13 +261,20 @@
done
swig-py-ext:
- (cd $(SWIG_SRC_DIR)/python; \
- $(PYTHON) setup.py \
+ if test -n "$(SWIG)"; then \
+ cd $(SWIG_SRC_DIR)/python; \
+ $(PYTHON) setup.py \
-I$(SWIG_SRC_DIR) \
-I$(abs_srcdir)/subversion/include $(SVN_APR_INCLUDES) \
-S$(SWIG_SRC_DIR) \
-L$(DESTDIR)$(prefix)/lib -L$(SVN_APR_PREFIX)/lib \
- build --build-base=$(SWIG_BUILD_DIR)/python/build)
+ -s"$(SWIG)" \
+ build --build-base=$(SWIG_BUILD_DIR)/python/build; \
+ else \
+ echo 'SWIG variable is not defined; this rule is unavailable' >&2; \
+ echo 'Re-run configure --with-swig' >&2; \
+ exit 1; \
+ fi
install-swig-py-ext:
(cd $(SWIG_BUILD_DIR)/python; \
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Use swig binary from --with-swig configure switch
Posted by Greg Stein <gs...@lyra.org>.
On Thu, Nov 07, 2002 at 12:10:02PM -0800, Daniel Rall wrote:
>...
> Unfortunately, when $(SWIG) isn't defined (I'm assuming this happens
> when you don't pass --with-swig, I triggered it in testing by
> explicitly commenting out the SWIG= bit in the patch above), your
> getopt from setup.py seems to think that it should handle
> --bulid-base, which it doesn't define. I'm guessing that --build-base
> is handled by distutils' getopt processing.
If SWIG isn't defined, then we shouldn't try to invoke it. Since somebody
might want to do:
$ make swig-py-ext SWIG=/usr/local/bin/swig
We probably want a runtime test in the make rule. Something like:
swig-py-ext:
if test -n "$(SWIG)"; then \
(cd $(SWIG_SRC_DIR)/python; \
...
else \
echo "SWIG variable is not defined; this rule is unavailable." \
fi
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Use swig binary from --with-swig configure switch
Posted by Daniel Rall <dl...@finemaltcoding.com>.
cmpilato@collab.net writes:
> Daniel Rall <dl...@finemaltcoding.com> writes:
>
> > Hmmm. The --build-base flag is not listed in setup.py's getopts. I'm
> > think it is a distutils-specific option. I noticed that the usual
> > distutils commandline processing seems to be obscured by what's in our
> > setup.py:
>
> It's not a distutils problem. I got so fed up with distutils that I
> stole its cmd-line processing from it, and let setup.py use only the
> things we seemed to need at the time.
Well, I can still trigger the distutils getopt processing -- looks
like it was only partially stolen.
> > $ python2 ./subversion/bindings/swig/python/setup.py --help install
> > Usage: setup.py [OPTIONS] build
> > setup.py install [--prefix PREFIX]
> > setup.py install_lib [--install-dir DIR]
> >
> > Options:
> > -I dir search DIR for includes (multiple instances allowed)
> > -L dir search DIR for libraries (multiple instances allowed)
> > -S dir the DIR for the source of the subversion swig bindings
> > -s path use the swig binary found at PATH
>
> For example: the -s option seems to be what you need. :-)
The patch which started this thread used the -s flag. Here's the
relevant half of it again:
Index: Makefile.in
===================================================================
--- Makefile.in (revision 3678)
+++ Makefile.in (working copy)
@@ -65,6 +65,7 @@
APACHE_TARGET = @APACHE_TARGET@
APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
+SWIG = @SWIG@
SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@
SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
@@ -266,6 +267,7 @@
-I$(abs_srcdir)/subversion/include $(SVN_APR_INCLUDES) \
-S$(SWIG_SRC_DIR) \
-L$(DESTDIR)$(prefix)/lib -L$(SVN_APR_PREFIX)/lib \
+ -s$(SWIG) \
build --build-base=$(SWIG_BUILD_DIR)/python/build)
install-swig-py-ext:
Unfortunately, when $(SWIG) isn't defined (I'm assuming this happens
when you don't pass --with-swig, I triggered it in testing by
explicitly commenting out the SWIG= bit in the patch above), your
getopt from setup.py seems to think that it should handle
--bulid-base, which it doesn't define. I'm guessing that --build-base
is handled by distutils' getopt processing.
--
Daniel Rall <dl...@finemaltcoding.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Use swig binary from --with-swig configure switch
Posted by cm...@collab.net.
Daniel Rall <dl...@finemaltcoding.com> writes:
> Hmmm. The --build-base flag is not listed in setup.py's getopts. I'm
> think it is a distutils-specific option. I noticed that the usual
> distutils commandline processing seems to be obscured by what's in our
> setup.py:
It's not a distutils problem. I got so fed up with distutils that I
stole its cmd-line processing from it, and let setup.py use only the
things we seemed to need at the time.
> $ python2 ./subversion/bindings/swig/python/setup.py --help install
> Usage: setup.py [OPTIONS] build
> setup.py install [--prefix PREFIX]
> setup.py install_lib [--install-dir DIR]
>
> Options:
> -I dir search DIR for includes (multiple instances allowed)
> -L dir search DIR for libraries (multiple instances allowed)
> -S dir the DIR for the source of the subversion swig bindings
> -s path use the swig binary found at PATH
For example: the -s option seems to be what you need. :-)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Use swig binary from --with-swig configure switch
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Daniel Rall <dl...@finemaltcoding.com> writes:
> /usr/bin/python2 setup.py \
> -I/home/dlr/src/svn/subversion/bindings/swig \
> -I/home/dlr/src/svn/subversion/include -I/home/dlr/src/apache.org/httpd-2.0/srclib/apr/include -I/home/dlr/src/apache.org/apr/include \
> -S/home/dlr/src/svn/subversion/bindings/swig \
> -L/usr/local/subversion/lib -L/usr/local/apr/lib \
> -I'/usr/local/swig/lib/swig1.3' \
> -I'/usr/local/swig/lib/swig1.3/python' \
> -I'/usr/local/swig/lib/swig1.3/java' \
> -s"" \
> build --build-base=/home/dlr/src/svn/subversion/bindings/swig/python/build)
> Traceback (most recent call last):
> File "setup.py", line 58, in ?
> ["prefix=", "install-dir=", "help"])
> File "/usr/lib/python2.2/getopt.py", line 72, in getopt
> opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
> File "/usr/lib/python2.2/getopt.py", line 86, in do_longs
> has_arg, opt = long_has_args(opt, longopts)
> File "/usr/lib/python2.2/getopt.py", line 103, in long_has_args
> raise GetoptError('option --%s not recognized' % opt, opt)
> getopt.GetoptError: option --build-base not recognized
> make: *** [swig-py-ext] Error 1
Hmmm. The --build-base flag is not listed in setup.py's getopts. I'm
think it is a distutils-specific option. I noticed that the usual
distutils commandline processing seems to be obscured by what's in our
setup.py:
dlr@despot:svn$ python2 ./subversion/bindings/swig/python/setup.py --help install
Usage: setup.py [OPTIONS] build
setup.py install [--prefix PREFIX]
setup.py install_lib [--install-dir DIR]
Options:
-I dir search DIR for includes (multiple instances allowed)
-L dir search DIR for libraries (multiple instances allowed)
-S dir the DIR for the source of the subversion swig bindings
-s path use the swig binary found at PATH
dlr@despot:svn$ python2 ./subversion/bindings/swig/python/setup.py help
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help
error: invalid command 'help' (no module named 'distutils.command.help')
dlr@despot:svn$ python2 ./subversion/bindings/swig/python/setup.py --help-commands
Traceback (most recent call last):
File "./subversion/bindings/swig/python/setup.py", line 58, in ?
["prefix=", "install-dir=", "help"])
File "/usr/lib/python2.2/getopt.py", line 72, in getopt
opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
File "/usr/lib/python2.2/getopt.py", line 86, in do_longs
has_arg, opt = long_has_args(opt, longopts)
File "/usr/lib/python2.2/getopt.py", line 103, in long_has_args
raise GetoptError('option --%s not recognized' % opt, opt)
getopt.GetoptError: option --help-commands not recognized
--
Daniel Rall <dl...@finemaltcoding.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [PATCH] Use swig binary from --with-swig configure switch
Posted by Daniel Rall <dl...@finemaltcoding.com>.
Daniel Rall <dl...@finemaltcoding.com> writes:
> Index: Makefile.in
> ===================================================================
> --- Makefile.in (revision 3678)
> +++ Makefile.in (working copy)
> @@ -65,6 +65,7 @@
> APACHE_TARGET = @APACHE_TARGET@
> APACHE_LIBEXECDIR = $(DESTDIR)@APACHE_LIBEXECDIR@
>
> +SWIG = @SWIG@
> SWIG_PY_INCLUDES = @SWIG_PY_INCLUDES@
>
> SVN_APR_INCLUDES = @SVN_APR_INCLUDES@
> @@ -266,6 +267,7 @@
> -I$(abs_srcdir)/subversion/include $(SVN_APR_INCLUDES) \
> -S$(SWIG_SRC_DIR) \
> -L$(DESTDIR)$(prefix)/lib -L$(SVN_APR_PREFIX)/lib \
> + -s$(SWIG) \
This isn't quite right -- when I comment out the SWIG make variable,
Python's getopt module becomes irrate (perhaps because no option was
passed for -s, which requires a value). Quoting the value for -s (and
thus passing the empty string) doesn't help.
dlr@despot:svn$ make swig-py-ext
(cd /home/dlr/src/svn/subversion/bindings/swig/python; \
/usr/bin/python2 setup.py \
-I/home/dlr/src/svn/subversion/bindings/swig \
-I/home/dlr/src/svn/subversion/include -I/home/dlr/src/apache.org/httpd-2.0/srclib/apr/include -I/home/dlr/src/apache.org/apr/include \
-S/home/dlr/src/svn/subversion/bindings/swig \
-L/usr/local/subversion/lib -L/usr/local/apr/lib \
-I'/usr/local/swig/lib/swig1.3' \
-I'/usr/local/swig/lib/swig1.3/python' \
-I'/usr/local/swig/lib/swig1.3/java' \
-s"" \
build --build-base=/home/dlr/src/svn/subversion/bindings/swig/python/build)
Traceback (most recent call last):
File "setup.py", line 58, in ?
["prefix=", "install-dir=", "help"])
File "/usr/lib/python2.2/getopt.py", line 72, in getopt
opts, args = do_longs(opts, args[0][2:], longopts, args[1:])
File "/usr/lib/python2.2/getopt.py", line 86, in do_longs
has_arg, opt = long_has_args(opt, longopts)
File "/usr/lib/python2.2/getopt.py", line 103, in long_has_args
raise GetoptError('option --%s not recognized' % opt, opt)
getopt.GetoptError: option --build-base not recognized
make: *** [swig-py-ext] Error 1
> In any case, in my environment I'm missing a -I flag,
> $(SWIG_DIR)/lib/swig1.3. When I check in the Java stuff, I'll also be
> missing $(SWIG_DIR)/lib/swig1.3/java.
I also need $(SWIG_DIR)/lib/swig1.3/python. Worth noting that I made
up the SWIG_DIR token -- it's just an example.
--
Daniel Rall <dl...@finemaltcoding.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org