[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Problem with python + hook

From: Ryan Schmidt <subversion-2008c_at_ryandesign.com>
Date: Sun, 24 Aug 2008 22:46:47 -0500

On Aug 24, 2008, at 22:30, John Niven wrote:

>> At the top of "post-commit" file, I put:
>>
>> #!/usr/bin/python
>>
>> I also tried:
>>
>> #!/usr/bin/env python
>
> I suspect it would need to be...
> #!/usr/bin/env /usr/bin/python

Asking the env program where python is won't work since as I said the
environment will be empty. Just specify the absolute path to the
binary that should execute the script:

#!/usr/bin/python

> As far as I can remember the "#!/usr/bin/env ..." idiom is necessary
> with Python, and since your hook scripts run with no environment
> you'll
> need to specify where python is.

Oh it is? Well I don't know Python. I'm sure the env idiom is useful
when a path to python is in the environment, but even the Subversion
source comes with a Python script that does not use this strategy:

http://svn.collab.net/repos/svn/tags/1.5.1/tools/dist/write-
announcement.py

So I doubt it's absolutely required.

>> None of these have had any effect.

Did you also change to calling the absolute path of svn? See below.

>>>>>> call( "svn", "update", "--non-interactive", "/srv/http/website" )
>>>
>>>
>>> You need to specify the absolute path to the svn binary
>> (and any other
>>> binaries you want to use) since hooks run with an empty environment
>>> for security reasons.

Call svn with its absolute path as well, presumably:

call( "/usr/local/bin/svn", "update", "--non-interactive", "/srv/http/
website" )

Or wherever Subversion actually is on your system.

Capture all error and regular output from this process and write it
to a logfile of your own, with whatever syntax one uses for that in
Python.

If that doesn't help, try a simple post-commit hook which just writes
a line to a file. Does it work?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: users-help_at_subversion.tigris.org
Received on 2008-08-25 05:47:09 CEST

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.