Modify

Opened 8 years ago

Last modified 5 weeks 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 rjollos)

What version are you using?

Checkout revision 5144 for Trac 0.11.

What were you doing when the problem occured?

  1. edit svnpolicy.conf
  2. python setup.py bdist_egg
  3. cp dist/TracSVNPoliciesPlugin-0.2-py2.5.egg /path/to/tracroot/plugins
  4. edit /path/to/tracroot/conf/trac.ini
  5. enable "Require log messages for commits" on the Administration UI
  6. 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

     
    1515      'get_site_packages']
    1616
    1717def get_site_packages():
    18     return path.sep.join(__file__.split(path.sep)[:-3])
     18    return path.sep.join(__file__.split(path.sep)[:-2])
    1919
    2020def validate_email(email):
    2121    """

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 7 years ago by doki_pen

  • Owner changed from andrei2102 to doki_pen

comment:2 Changed 7 years ago by tekknokrat

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?

comment:3 Changed 21 months ago by rjollos

  • Owner doki_pen deleted

comment:4 Changed 5 weeks ago by rjollos

  • Description modified (diff)

comment:5 Changed 5 weeks ago by rjollos

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 Environment plugins directory rather than the site-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.

Last edited 5 weeks ago by rjollos (previous) (diff)

Add Comment

Modify Ticket

Action
as new The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.