Opened 16 years ago
Last modified 8 years ago
#4486 new defect
Possible bug related to "packages.pth"
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | TracSvnPoliciesPlugin |
Severity: | major | Keywords: | |
Cc: | Trac Release: | 0.11 |
Description (last modified by )
What version are you using?
Checkout revision 5144 for Trac 0.11.
What were you doing when the problem occured?
- edit
svnpolicy.conf
python setup.py bdist_egg
cp dist/TracSVNPoliciesPlugin-0.2-py2.5.egg /path/to/tracroot/plugins
- edit
/path/to/tracroot/conf/trac.ini
- enable "Require log messages for commits" on the Administration UI
- try to commit something without a log message
What happened? What did you expect to happen instead?
Traceback (most recent call last): File "./hooks/pre-commit", line 3, in <module> from loader import * File "./.egg-cache/TracSVNPoliciesPlugin-0.2-py2.5.egg-tmp/svnpolicies/hooks/loader.py", line 39, in <module> from svnpolicies import api ImportError: No module named svnpolicies
instead of
the log message isn't conform to the project policy!
Any additional info?
Patch the following file like this:
-
svnpolicies/api.py
15 15 'get_site_packages'] 16 16 17 17 def get_site_packages(): 18 return path.sep.join(__file__.split(path.sep)[:- 3])18 return path.sep.join(__file__.split(path.sep)[:-2]) 19 19 20 20 def validate_email(email): 21 21 """
or change
/path/to/tracroot/plugins
manually to something like this
/path/to/tracroot/plugins/TracSVNPoliciesPlugin-0.2-py2.5.egg
Attachments (0)
Change History (5)
comment:1 Changed 15 years ago by
Owner: | changed from Culapov Andrei to Robert Corsaro |
---|
comment:2 Changed 15 years ago by
comment:3 Changed 10 years ago by
Owner: | Robert Corsaro deleted |
---|
comment:4 Changed 8 years ago by
Description: | modified (diff) |
---|
comment:5 Changed 8 years ago by
I see a few problems with the plugin design:
svnpolicy.conf
is compiled in the egg, so the egg must be recreated when the config is changed.- The location of
site-packages
is retrieved through the location of the egg. This causes problems with developing in "edit mode", and I assume would also cause problems if the egg is placed in the Environmentplugins
directory rather than thesite-packages
directory. - The plugin writes to
packages.pth
in the egg in response to a POST request. I don't think we can assume that the web server will have write access to the egg.
We do need a way to pass environment variables to the hook scripts, which has always been a problem with Subversion since the hooks run in an empty environment. Subversion 1.8 has a configuration for hook script environment variables. I think we could eliminate svnpolicy.conf
and hooks/packages.pth
, and instruct the user how to configure the hooks environment in Subversion 1.8 and later. Subversion 1.8 seems like a reasonable requirement since it was released in June 2013.
Just tried to adapt the above patch but it failed. Message on commits remains the same. Config is the same, as above. What else to try?