Modify

Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#2851 closed enhancement (worksforme)

Installed 0.11, Cannot get the themeengine to show any themes or even the default installed themes that come with ThemeEngine

Reported by: chanson78 Owned by: coderanger
Priority: highest Component: ThemeEnginePlugin
Severity: critical Keywords:
Cc: Trac Release: 0.11

Description

Here are the steps I went through to install on my system.

[root@localhost tracplugins]# svn co http://trac-hacks.org/svn/themeengineplugin 
A    themeengineplugin/0.11
A    themeengineplugin/0.11/setup.py
A    themeengineplugin/0.11/themeengine
A    themeengineplugin/0.11/themeengine/admin.py
A    themeengineplugin/0.11/themeengine/api.py
A    themeengineplugin/0.11/themeengine/web_ui.py
A    themeengineplugin/0.11/themeengine/htdocs
A    themeengineplugin/0.11/themeengine/htdocs/jquery.jcarousel.js
A    themeengineplugin/0.11/themeengine/htdocs/default_screenshot.png
A    themeengineplugin/0.11/themeengine/htdocs/skins
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7/loading.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7/loading-small.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7/prev-horizontal.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7/loading_small.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7/next-horizontal.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7/credits.txt
A    themeengineplugin/0.11/themeengine/htdocs/skins/ie7/skin.css
A    themeengineplugin/0.11/themeengine/htdocs/skins/sweetie
A    themeengineplugin/0.11/themeengine/htdocs/skins/sweetie/prev-horizontal.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/sweetie/prev-vertical.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/sweetie/next-horizontal.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/sweetie/next-vertical.gif
A    themeengineplugin/0.11/themeengine/htdocs/skins/sweetie/credits.txt
A    themeengineplugin/0.11/themeengine/htdocs/skins/tango
A    themeengineplugin/0.11/themeengine/htdocs/skins/tango/prev-horizontal.png
A    themeengineplugin/0.11/themeengine/htdocs/skins/tango/prev-vertical.png
A    themeengineplugin/0.11/themeengine/htdocs/skins/tango/next-horizontal.png
A    themeengineplugin/0.11/themeengine/htdocs/skins/tango/next-vertical.png
A    themeengineplugin/0.11/themeengine/htdocs/skins/tango/credits.txt
A    themeengineplugin/0.11/themeengine/htdocs/skins/tango/skin.css
A    themeengineplugin/0.11/themeengine/htdocs/img
A    themeengineplugin/0.11/themeengine/htdocs/img/prev.gif
A    themeengineplugin/0.11/themeengine/htdocs/img/next.gif
A    themeengineplugin/0.11/themeengine/htdocs/img/credits.txt
A    themeengineplugin/0.11/themeengine/htdocs/jquery.jcarousel.css
A    themeengineplugin/0.11/themeengine/htdocs/no_screenshot.png
A    themeengineplugin/0.11/themeengine/htdocs/jquery.jcarousel.pack.js
A    themeengineplugin/0.11/themeengine/__init__.py
A    themeengineplugin/0.11/themeengine/templates
A    themeengineplugin/0.11/themeengine/templates/admin_theme.html
A    themeengineplugin/0.10
A    themeengineplugin/0.10/setup.py
A    themeengineplugin/0.10/themeengine
A    themeengineplugin/0.10/themeengine/admin.py
A    themeengineplugin/0.10/themeengine/api.py
A    themeengineplugin/0.10/themeengine/htdocs
A    themeengineplugin/0.10/themeengine/htdocs/jcarousel.js
A    themeengineplugin/0.10/themeengine/htdocs/default.png
A    themeengineplugin/0.10/themeengine/htdocs/jquery.js
A    themeengineplugin/0.10/themeengine/htdocs/img
A    themeengineplugin/0.10/themeengine/htdocs/img/prev.gif
A    themeengineplugin/0.10/themeengine/htdocs/img/next.gif
A    themeengineplugin/0.10/themeengine/htdocs/img/credits.txt
A    themeengineplugin/0.10/themeengine/__init__.py
A    themeengineplugin/0.10/themeengine/filter.py
A    themeengineplugin/0.10/themeengine/templates
A    themeengineplugin/0.10/themeengine/templates/admin_themeengine.cs
A    themeengineplugin/0.10/themeengine/templates/header
A    themeengineplugin/0.10/themeengine/templates/header/header.cs
A    themeengineplugin/0.10/themeengine/templates/footer
A    themeengineplugin/0.10/themeengine/templates/footer/footer.cs
Checked out revision 3455.
[root@localhost tracplugins]# ls
PatternSkin  peerreviewplugin  themeengineplugin
[root@localhost tracplugins]# cd themeengineplugin
[root@localhost themeengineplugin]# ls
0.10  0.11
[root@localhost themeengineplugin]# cd 0.11
[root@localhost 0.11]# ls
setup.py  themeengine
[root@localhost 0.11]# python setup.py bdist_egg
running bdist_egg
running egg_info
creating TracThemeEngine.egg-info
writing requirements to TracThemeEngine.egg-info/requires.txt
writing TracThemeEngine.egg-info/PKG-INFO
writing top-level names to TracThemeEngine.egg-info/top_level.txt
writing dependency_links to TracThemeEngine.egg-info/dependency_links.txt
writing entry points to TracThemeEngine.egg-info/entry_points.txt
writing manifest file 'TracThemeEngine.egg-info/SOURCES.txt'
writing manifest file 'TracThemeEngine.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-i686/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/themeengine
copying themeengine/__init__.py -> build/lib/themeengine
copying themeengine/web_ui.py -> build/lib/themeengine
copying themeengine/api.py -> build/lib/themeengine
copying themeengine/admin.py -> build/lib/themeengine
creating build/lib/themeengine/templates
copying themeengine/templates/admin_theme.html -> build/lib/themeengine/templates
creating build/lib/themeengine/htdocs
copying themeengine/htdocs/jquery.jcarousel.js -> build/lib/themeengine/htdocs
copying themeengine/htdocs/jquery.jcarousel.pack.js -> build/lib/themeengine/htdocs
copying themeengine/htdocs/jquery.jcarousel.css -> build/lib/themeengine/htdocs
creating build/bdist.linux-i686
creating build/bdist.linux-i686/egg
creating build/bdist.linux-i686/egg/themeengine
creating build/bdist.linux-i686/egg/themeengine/htdocs
copying build/lib/themeengine/htdocs/jquery.jcarousel.js -> build/bdist.linux-i686/egg/themeengine/htdocs
copying build/lib/themeengine/htdocs/jquery.jcarousel.pack.js -> build/bdist.linux-i686/egg/themeengine/htdocs
copying build/lib/themeengine/htdocs/jquery.jcarousel.css -> build/bdist.linux-i686/egg/themeengine/htdocs
copying build/lib/themeengine/__init__.py -> build/bdist.linux-i686/egg/themeengine
copying build/lib/themeengine/web_ui.py -> build/bdist.linux-i686/egg/themeengine
copying build/lib/themeengine/api.py -> build/bdist.linux-i686/egg/themeengine
creating build/bdist.linux-i686/egg/themeengine/templates
copying build/lib/themeengine/templates/admin_theme.html -> build/bdist.linux-i686/egg/themeengine/templates
copying build/lib/themeengine/admin.py -> build/bdist.linux-i686/egg/themeengine
byte-compiling build/bdist.linux-i686/egg/themeengine/__init__.py to __init__.pyc
byte-compiling build/bdist.linux-i686/egg/themeengine/web_ui.py to web_ui.pyc
byte-compiling build/bdist.linux-i686/egg/themeengine/api.py to api.pyc
byte-compiling build/bdist.linux-i686/egg/themeengine/admin.py to admin.pyc
creating build/bdist.linux-i686/egg/EGG-INFO
copying TracThemeEngine.egg-info/PKG-INFO -> build/bdist.linux-i686/egg/EGG-INFO
copying TracThemeEngine.egg-info/SOURCES.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TracThemeEngine.egg-info/dependency_links.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TracThemeEngine.egg-info/entry_points.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TracThemeEngine.egg-info/requires.txt -> build/bdist.linux-i686/egg/EGG-INFO
copying TracThemeEngine.egg-info/top_level.txt -> build/bdist.linux-i686/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating dist
creating 'dist/TracThemeEngine-2.0-py2.4.egg' and adding 'build/bdist.linux-i686/egg' to it
removing 'build/bdist.linux-i686/egg' (and everything under it)
[root@localhost 0.11]# ls
build  dist  setup.py  themeengine  TracThemeEngine.egg-info
[root@localhost 0.11]# easy_install -Z dist/*.egg
Processing TracThemeEngine-2.0-py2.4.egg
creating /usr/lib/python2.4/site-packages/TracThemeEngine-2.0-py2.4.egg
Extracting TracThemeEngine-2.0-py2.4.egg to /usr/lib/python2.4/site-packages
Adding TracThemeEngine 2.0 to easy-install.pth file

Installed /usr/lib/python2.4/site-packages/TracThemeEngine-2.0-py2.4.egg
Processing dependencies for TracThemeEngine==2.0
Finished processing dependencies for TracThemeEngine==2.0

I restart apache (using mod_python) and the plugin is installed. However when I go to the actual theme selection page I get no images shown and no themes listed.

I have turned on logging and here is the output from the log when accessing the theme page.

2008-04-03 15:49:13,507 Trac[main] ERROR: [Errno 2] No such file or directory: '/usr/lib/python2.4/site-packages/TracThemeEngine-2.0-py2.4.egg/themeengine/htdocs/default_screenshot.png'
Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 419, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/lib/python2.4/site-packages/Trac-0.11b2-py2.4.egg/trac/web/main.py", line 196, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/lib/python2.4/site-packages/TracThemeEngine-2.0-py2.4.egg/themeengine/admin.py", line 74, in process_request
    return self._send_screenshot(req, data, path_info[11:])
  File "/usr/lib/python2.4/site-packages/TracThemeEngine-2.0-py2.4.egg/themeengine/admin.py", line 84, in _send_screenshot
    img = resource_string(theme['module'], theme['screenshot'])
  File "/usr/lib/python2.4/site-packages/setuptools-0.6c8-py2.4.egg/pkg_resources.py", line 852, in resource_string
    return get_provider(package_or_requirement).get_resource_string(
  File "/usr/lib/python2.4/site-packages/setuptools-0.6c8-py2.4.egg/pkg_resources.py", line 1126, in get_resource_string
    return self._get(self._fn(self.module_path, resource_name))
  File "/usr/lib/python2.4/site-packages/setuptools-0.6c8-py2.4.egg/pkg_resources.py", line 1247, in _get
    stream = open(path, 'rb')
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.4/site-packages/TracThemeEngine-2.0-py2.4.egg/themeengine/htdocs/default_screenshot.png'
2008-04-03 15:49:13,721 Trac[chrome] DEBUG: Prepare chrome data for request
2008-04-03 15:49:13,738 Trac[session] DEBUG: Retrieving session for ID u'hansona'
2008-04-03 15:49:14,592 Trac[main] DEBUG: 615 unreachable objects found.
2008-04-03 15:49:16,088 Trac[main] DEBUG: 0 unreachable objects found.

So I go and look at the directory where the egg was extracted.

[root@localhost TracThemeEngine-2.0-py2.4.egg]# ls *
EGG-INFO:
dependency_links.txt  PKG-INFO      SOURCES.txt    zip-safe
entry_points.txt      requires.txt  top_level.txt

themeengine:
admin.py   api.py   htdocs       __init__.pyc  web_ui.py
admin.pyc  api.pyc  __init__.py  templates     web_ui.pyc
[root@localhost TracThemeEngine-2.0-py2.4.egg]# cd themeengine
[root@localhost themeengine]# ls *
admin.py   api.py   __init__.py   web_ui.py
admin.pyc  api.pyc  __init__.pyc  web_ui.pyc

htdocs:
jquery.jcarousel.css  jquery.jcarousel.js  jquery.jcarousel.pack.js

templates:
admin_theme.html

I don't know a whole lot about python, so maybe the default_screenshot.png is coming from somewhere else however its obviously not being distributed when the egg is extracted. Is this a permissions issue? I know that the egg is in the site-packages directory as root:root however everythign else related to the plugin seems to be recognized by trac, not to mention the fact that when I perform a listing on the directory the image that triggers the error is not there.

Attachments (1)

themeengine.patch (400 bytes) - added by nigelsim 6 years ago.
Patch to setup.py to enable non-zipsafe behaviour

Download all attachments as: .zip

Change History (15)

comment:1 Changed 7 years ago by chanson78

  • Summary changed from Installed 0.11, Cannot get the theme to show any themes or even the default installed themes that come with ThemeEngine to Installed 0.11, Cannot get the themeengine to show any themes or even the default installed themes that come with ThemeEngine

Updated Title to be more correct.

comment:2 Changed 7 years ago by Daher dee A_T digitalthinker D_O_T org

same problem for me, using apache2 and mod_python..

comment:3 Changed 7 years ago by coderanger

Yep, known issue. Actually more that I just haven't finished the new version of the theme selection UI. Just setting the theme in trac.ini works though.

comment:4 Changed 7 years ago by anonymous

nope still doesn't work for me..

[components]
consultanttheme.* = enabled
consultanttheme.theme.* = enabled
doxygentrac.doxygentrac.* = enabled
mentalaxistheme.* = enabled
themeengine.admin.themeadminmodule = enabled
themeengine.api.themeenginesystem = enabled
themeengine.web_ui.themeenginemodule = enabled
trac.ticket.report.reportmodule = disabled
[theme]
theme = Consultant

comment:5 Changed 7 years ago by Daher

I just noticed that if i put in a wrong theme name in trac.ini this error shows up:

Traceback (most recent call last):
  File "C:\Python25\Lib\site-packages\trac\web\api.py", line 339, in send_error
    'text/html')
  File "C:\Python25\Lib\site-packages\trac\web\chrome.py", line 672, in render_template
    template = self.load_template(filename, method=method)
  File "C:\Python25\Lib\site-packages\trac\web\chrome.py", line 648, in load_template
    self.templates = TemplateLoader(self.get_all_templates_dirs(),
  File "C:\Python25\Lib\site-packages\trac\web\chrome.py", line 402, in get_all_templates_dirs
    dirs += provider.get_templates_dirs()
  File "build\bdist.win32\egg\themeengine\web_ui.py", line 29, in get_templates_dirs
    theme = self.system.theme
  File "build\bdist.win32\egg\themeengine\api.py", line 44, in theme
    raise TracError('Unknown theme %s'%self.theme_name)
TracError: Unknown theme invalid_theme_name_test

which means its actually doing something but not executing the theme code?

comment:6 Changed 7 years ago by coderanger

The only themes that have been ported to 0.11 are gamedev, pydotorg, and crystalx. Old themes are not compatible.

comment:7 follow-up: Changed 6 years ago by anonymous

"The only themes that have been ported to 0.11 are gamedev, pydotorg, and crystalx. Old themes are not compatible."

No, these themes are not working with the latest build of the themeengine and trac at all.

"Just setting the theme in trac.ini works though."

Ditto: if you can guess the name/case, there is no error and no theme. If you get the case or name wrong, the abovementioned crash happens.

comment:8 in reply to: ↑ 7 Changed 6 years ago by coderanger

Replying to anonymous:

"The only themes that have been ported to 0.11 are gamedev, pydotorg, and crystalx. Old themes are not compatible."

No, these themes are not working with the latest build of the themeengine and trac at all.

Please open a new ticket if you are having issues. The pydotorg theme has been running on dev.laptop.org for a long while now, and is still working fine at last I checked.

comment:9 follow-up: Changed 6 years ago by nigelsim

This issue, at least for me, was that the setup.py didn't specify the non-code file to be included in the egg, and secondly, that because of this the egg is not zip safe. Patch attached.

Changed 6 years ago by nigelsim

Patch to setup.py to enable non-zipsafe behaviour

comment:10 in reply to: ↑ 9 Changed 6 years ago by coderanger

  • Resolution set to worksforme
  • Status changed from new to closed

Replying to nigelsim:

This issue, at least for me, was that the setup.py didn't specify the non-code file to be included in the egg, and secondly, that because of this the egg is not zip safe. Patch attached.

Uhh, a) it will include data by default, b) the egg is zip safe. Setuptools will extract it to the cache folder if/when any static resources need to be accessed.

As I cannot reproduce this bug, I am closing this ticket.

comment:11 follow-up: Changed 6 years ago by pje@…

Setuptools does NOT include data files in eggs by default; you need include_package_data=True for that. Note that if you are using "setup.py develop" to do your tests, it would seem to work, but any egg-based installs would fail.

As for zip safety, that requires that data files only be accessed via pkg_resources resource_*() API calls; if you're not doing that, then again this would appear to work in "develop" mode but fail in an egg-based install.

comment:12 in reply to: ↑ 11 Changed 6 years ago by coderanger

Replying to pje@telecommunity.com:

Setuptools does NOT include data files in eggs by default; you need include_package_data=True for that. Note that if you are using "setup.py develop" to do your tests, it would seem to work, but any egg-based installs would fail.

You can clearly see the existing static content being included in the build trace above. As I said the admin UI isn't finished so it is likely referencing a file that doesn't exist at the moment.

As for zip safety, that requires that data files only be accessed via pkg_resources resource_*() API calls; if you're not doing that, then again this would appear to work in "develop" mode but fail in an egg-based install.

Trac does indeed use the correct APIs, or no plugins would work ever.

comment:13 Changed 6 years ago by pje@…

I see... you meant "files listed in data_files", not "data files that just happen to live in your source tree" (which setuptools does not include in eggs by default).

comment:14 Changed 5 years ago by anonymous

  • Priority changed from high to highest
  • Severity changed from major to critical
  • Type changed from defect to enhancement

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.