Using python scripts in subversion hooks on windows

夙愿已清 提交于 2019-12-11 02:26:53

问题


My main goal is to get this up and running.

My hook gets called when I do the commit with Tortoise SVN, but it always exits when I get to this line: Python "%~dp0trac-post-commit-hook.py" -p "%TRAC_ENV%" -r "%REV%" || EXIT 5

If I try and replace the call to the python script with any simple Python script it still doesn't work so I'm assuming it is a problem with the call to Python and not the script itself.

I have tried setting the PYTHON_PATH variable and also set %PATH% to include Python.

I have trac up and running so Python is working on the server itself.

Here is some background info:

  • Python is installed on Windows server and script is called from local machine so

    IF NOT EXIST %TRAC_ENV% EXIT 3

    and

    SET PYTHON_PATH=X:\Python26 IF NOT EXIST %PYTHON_PATH% EXIT 4

fail unless I point set them to the mapped network drive (That is point them at X and Y drives not C and E drives)

  • Python scripts can be called anywhere from the command line from the server regardless of the drive so the PATH variable should be set correctly

Appears to be an issue with calling python scripts externally, but not sure how I go about changing the permissions for this.

Thanks in advance.


回答1:


Take the following things into account:

  • network drive mappings and subst mappings are user specific. Make sure the drives exist for the user account under which the svn server is running.
  • subversion hook scripts are run without any environment variables being set for security reasons, not even %path%. Call the python executable with an absolute path, e.g. c:\python25\python.exe.


来源:https://stackoverflow.com/questions/1135499/using-python-scripts-in-subversion-hooks-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!