Modify

Opened 16 years ago

Closed 16 years ago

#3758 closed defect (fixed)

Broken egg install, conflict with tracusermanagerplugin 0.3

Reported by: Michał Małecki Owned by: Jeff Hammel
Priority: highest Component: AutocompleteUsersPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.11

Description

After standard egg installation, JS and CSS files are not present. While building an egg with setup bdist_egg, html calatogue is not included within the egg - thus plugin does not work. The appropriate directory in .egg-cache dir in trac env does not get created.

After copying html directory manually to Lib/site-packages/trac/ in python installation, it appears to work, but just till the restart of the httpd server.

After restart it starts to conflict with requests to graphics and CSS from tracusermanagerplugin , every http request resulting in http 500 message with following error:

  Trac detected an internal error:
  KeyError: 'autocompleteusers\\htdocs'

and following traceback:

  1. File "C:\Python25\Lib\site-packages\trac\web\main.py", line 423, in _dispatch_request
    Code fragment:
     418. try:
     419. if not env and env_error:
     420. raise HTTPInternalError(env_error)
     421. try:
     422. dispatcher = RequestDispatcher(env)
     423. dispatcher.dispatch(req)
     424. except RequestDone:
     425. pass
     426. resp = req._response or []
     427.  
     428. except HTTPException, e:
    
    Local variables:
    • Name Value
    • after [u' except RequestDone:', u' pass', u' resp = ...
    • before [u' try:', u' if not env and env_error:', u' raise ...
    • dispatcher <trac.web.main.RequestDispatcher object at 0x02ACE650>
    • e KeyError('autocompleteusers
      htdocs',)
    • env <trac.env.Environment object at 0x0252B5B0>
    • env_error None
    • exc_info (<type 'exceptions.KeyError'>, KeyError('autocompleteusers
      htdocs',), ...
    • filename 'C:
      Python25
      Lib
      site-packages
      trac
      web
      main.py'
    • frames [{'function': '_dispatch_request', 'lines_before': [u' try:', u' ...
    • has_admin True
    • line u' dispatcher.dispatch(req)'
    • lineno 422
    • message u"KeyError: 'autocompleteusers

      htdocs'"
    • req <Request "GET u'/chrome/tracusermanager/img/no_picture.png'">
    • resp []
    • tb <traceback object at 0x02D698F0>
    • tb_hide None
    • traceback 'Traceback (most recent call last):\n File ...
  2. File "C:\Python25\Lib\site-packages\trac\web\main.py", line 197, in dispatch
    Code fragment:
     192. req.args.get('__FORM_TOKEN') != req.form_token:
     193. raise HTTPBadRequest('Missing or invalid form token. '
     194. 'Do you have cookies enabled?')
     195.  
     196. # Process the request and render the template
     197. resp = chosen_handler.process_request(req)
     198. if resp:
     199. if len(resp) == 2: # Clearsilver
     200. chrome.populate_hdf(req)
     201. template, content_type = \
     202. self._post_process_request(req, *resp)
    
    Local variables:
    • Name Value
    • chosen_handler <trac.web.chrome.Chrome object at 0x02ABF070>
    • chrome <trac.web.chrome.Chrome object at 0x02ABF070>
    • err (<type 'exceptions.KeyError'>, KeyError('autocompleteusers
      htdocs',), ...
    • handler <trac.web.chrome.Chrome object at 0x02ABF070>
    • req <Request "GET u'/chrome/tracusermanager/img/no_picture.png'">
    • self <trac.web.main.RequestDispatcher object at 0x02ACE650>
  3. File "C:\Python25\Lib\site-packages\trac\web\chrome.py", line 364, in process_request
    Code fragment:
     359. filename = req.args['filename']
     360.  
     361. dirs = []
     362. for provider in self.template_providers:
     363. for dir in [os.path.normpath(dir[1]) for dir
     364. in provider.get_htdocs_dirs() if dir[0] == prefix]:
     365. dirs.append(dir)
     366. path = os.path.normpath(os.path.join(dir, filename))
     367. assert os.path.commonprefix([dir, path]) == dir
     368. if os.path.isfile(path):
     369. req.send_file(path, get_mimetype(path))
    
    Local variables:
    • Name Value
    • _[1] []
    • dir ('customfieldadmin', ...
    • dirs []
    • filename u'img/no_picture.png'
    • prefix u'tracusermanager'
    • provider <autocompleteusers.autocompleteusers.AutocompleteUsers object at ...
    • req <Request "GET u'/chrome/tracusermanager/img/no_picture.png'">
    • self <trac.web.chrome.Chrome object at 0x02ABF070>
  4. File "build\bdist.win32\egg\autocompleteusers\autocompleteusers.py", line 88, in get_htdocs_dirs Local variables:
    • Name Value
    • self <autocompleteusers.autocompleteusers.AutocompleteUsers object at ...
  5. File "C:\Python25\Lib\site-packages\pkg_resources.py", line 841, in resource_filename
    Code fragment:
     836. )
     837.  
     838. def resource_filename(self, package_or_requirement, resource_name):
     839. """Return a true filesystem path for specified resource"""
     840. return get_provider(package_or_requirement).get_resource_filename(
     841. self, resource_name
     842. )
     843.  
     844. def resource_stream(self, package_or_requirement, resource_name):
     845. """Return a readable file-like object for specified resource"""
     846. return get_provider(package_or_requirement).get_resource_stream(
    
    Local variables:
    • Name Value
    • package_or_requirement 'autocompleteusers.autocompleteusers'
    • resource_name 'htdocs'
    • self <pkg_resources.ResourceManager instance at 0x024C1328>
  6. File "C:\Python25\Lib\site-packages\pkg_resources.py", line 1311, in get_resource_filename
    Code fragment:
    1306. zip_path = self._resource_to_zip(resource_name)
    1307. eagers = self._get_eager_resources()
    1308. if '/'.join(self._parts(zip_path)) in eagers:
    1309. for name in eagers:
    1310. self._extract_resource(manager, self._eager_to_zip(name))
    1311. return self._extract_resource(manager, zip_path)
    1312.  
    1313. def _extract_resource(self, manager, zip_path):
    1314.  
    1315. if zip_path in self._index():
    1316. for name in self._index()[zip_path]:
    
    Local variables:
    • Name Value
    • eagers []
    • manager <pkg_resources.ResourceManager instance at 0x024C1328>
    • resource_name 'htdocs'
    • self <pkg_resources.ZipProvider instance at 0x02E560A8>
    • zip_path 'autocompleteusers
      htdocs'
  7. File "C:\Python25\Lib\site-packages\pkg_resources.py", line 1322, in _extract_resource
    Code fragment:
    1317. last = self._extract_resource(
    1318. manager, os.path.join(zip_path, name)
    1319. )
    1320. return os.path.dirname(last) # return the extracted directory name
    1321.  
    1322. zip_stat = self.zipinfo[zip_path]
    1323. t,d,size = zip_stat[5], zip_stat[6], zip_stat[3]
    1324. date_time = (
    1325. (d>>9)+1980, (d>>5)&0xF, d&0x1F, # ymd
    1326. (t&0xFFFF)>>11, (t>>5)&0x3F, (t&0x1F) * 2, 0, 0, -1 # hms, etc.
    1327. )
    
    Local variables:
    • Name Value
    • manager <pkg_resources.ResourceManager instance at 0x024C1328>
    • self <pkg_resources.ZipProvider instance at 0x02E560A8>
    • zip_path 'autocompleteusers
      htdocs'

We suspect that the problem is in line no.4 in a traceback - the refference to a nonexistent dirctory from build directory of an egg distribution.

Attachments (0)

Change History (4)

comment:1 Changed 16 years ago by Jeff Hammel

Priority: normalhighest

comment:2 Changed 16 years ago by Jeff Hammel

r4390 should at least include the js and css (i hope)

comment:3 Changed 16 years ago by twang@…

This can be fixed with the following patch:

--- setup.py.orig       2008-10-23 15:00:54.000000000 -0500
+++ setup.py    2008-10-23 14:56:19.000000000 -0500
@@ -12,7 +12,7 @@ setup(name='AutocompleteUsers',
       license="",
       packages=find_packages(exclude=['ez_setup', 'examples', 'tests*']),      
       include_package_data=True,
-      package_data={'autocompleteusers': ['htdocs/*']},
+      package_data={'autocompleteusers': ['htdocs/css/*, htdocs/js/*']},
       zip_safe=False,
       entry_points = """
       [trac.plugins]

comment:4 Changed 16 years ago by Jeff Hammel

Resolution: fixed
Status: newclosed

(In [5047]) more explicit specification of package_data; bump version; add GPL license; hopefully fixes #3758

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jeff Hammel.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.