Modify

Opened 17 years ago

Closed 14 years ago

#1216 closed task (wontfix)

Please explain how to install Pygments backport to 0.10.3

Reported by: mqm@… Owned by: Matt Good
Priority: normal Component: TracPygmentsPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.10

Description

The http://trac-hacks.org/wiki/TracPygmentsPlugin topic does not explain how to install the plugin which was backported to 0.10.3. It is probably obvious to a Python programmer, but not to a TRAC user.

Once I download the file, what do I need to run? I tried the obvious and it failed:

C:\temp\tracpygments>python setup.py usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]

or: setup.py --help [cmd1 cmd2 ...] or: setup.py --help-commands or: setup.py cmd --help

error: no commands supplied

Attachments (0)

Change History (15)

comment:1 Changed 17 years ago by Matt Good

Status: newassigned

Instructions on installing plugins are on the Trac wiki: trac:TracPlugins#InstallingaTracPlugin

I'll try to update the page here with a link to that information.

comment:2 Changed 17 years ago by bill.mill@…

I followed those instructions (download, python setup.py bdist_egg, easy_install dist/something.egg, tracpygments.* = enabled), and I'm not getting any highlighting on csharp files. Do I need to add something to the mime types, or something?

comment:3 Changed 17 years ago by anonymous

The linked instructions do not work... lots of error messages (the package supplied is not an egg, I suppose, so egg-installing instructions don't work?)

Wouldn't it be easier to make a note to the effect of running 'easy_install trac_pigments' and to state which Trac versions this will work with?

There is a lot of good stuff here on the Hacks site but the documentation is always lacking a simple sentance or two to specifically say what one should do.

Perhaps it is an Open Source tradition that new users should spend days searching Google in vain for an answer that could have been plainly stated in a well-placed sentance or two? (;P) For example, I am amazed how long I have been using Trac and only just discovered this site today (someone finally mentioned it in plain view on the Edgewall page)!

Another mystery is that TortoiseSVN can not connect to the SVN links supplied - error fetching PROPs.

comment:4 Changed 17 years ago by anonymous

This is what I did to get it working:

o C:\temp>c:\python24\scripts\easy_install.exe c:\temp\Pygments-0.8-py2.4.egg

o C:\temp\trac\tracpygmentsplugin\0.10>python setup.py bdist_egg o C:\temp\trac\tracpygmentsplugin\0.10>c:\python24\scripts\easy_install.exe C:\temp\trac\tracpygmentsplugin\0.10\dist\TracPygments-0.3dev-py2.4.egg o trac.ini:

[components] tracpygments.* = enabled

  • C:\temp\trac\tracpygmentsplugin\0.10>python c:\python24\scripts\trac-admin C:\trac\projects\babel upgrade
  • Restart Apache

comment:5 Changed 17 years ago by mqm@…

Sorry for entering the steps bove as anonynous - it was me.

An extra tip:

Make sure the MIME types are correct in Subversion. Example of problem (in TRAC's log file):

2007-06-06 17:52:56,203 Trac[browser] DEBUG: Rendering preview of node Foo.java@None with mime-type text/plain

text/plain should be text/x-java for the highlighting to work.

comment:6 Changed 17 years ago by bill.mill@…

mqm! Thanks!

I did not know that the mime types needed to be supplied as svn properties... you have made my life better.

comment:7 Changed 17 years ago by Matt Good

The mime types aren't required in SVN since Trac will use the file extension to determine it if possible. File extensions not recognized by Trac can also be mapped to a mime type in t:TracIni. The svn:mimetype property is only necessary if the extension is ambiguous.

@mqm: Am I correct in assuming your svn:mimetype properties were actually set to text/plain which was overriding Trac's extension lookup?

comment:8 Changed 17 years ago by Markus Pelkonen

I had also problems, my installation was:

Windows XP, Apache 2.0.58, mod_python 3.3.1, Trac 0.10.3, python 2.4.4 & tracpygments 0.3dev-r2113 installed as:

svn co http://trac-hacks.org/svn/tracpygmentsplugin/
cd tracpygmentsplugin\0.10
python setup.py bdist_egg
"c:\Program Files\Python24\Scripts\easy_install.exe" dist\TracPygments-0.3dev_r2113-py2.4.egg

I enabled plugin from the webadmin for one project - no success. After reading these pages I didn't find solution. Hours later i had tried many things (u don't want to hear). But suddenly it started to work - w00t? After some tests i found that enabling plugin from webadmin is not enough - you need to *restart apache*.

So u just can't turn on/off plugin from webadmin withouth restarting the apache. I would like to know if this is my stupidity or if the webadmin setting is not meant to work in production environments (mod_python or fastcgi)... Restarting apache is a really bad thing and u should fix this if possible.

comment:9 Changed 16 years ago by Cygon

Being a novice with Python, I tried following the instructions on my Gentoo box like this:

wget <url>/tracpygmentsplugin.zip unzip tracpygmentsplugin.zip cd tracpygmentsplugin/0.10 python setup.py bdist_egg cp dist/TracPygments-0.3dev-py2.4.egg /var/lib/trac/myproject/plugins

I don't get any C# syntax highlighting.

Added tracpygments.* = enabled to the [components] section (though the trac manual states you only need to do this of you installed the python .egg globally instead of into the plugins folder), still nothing.

comment:10 in reply to:  9 ; Changed 16 years ago by anonymous

Enabled logging, looks I'm getting the mime type issue:

Trac[browser] DEBUG: Rendering preview of node PathHelper.cs@None with mime-type text/plain

I'm running trac 0.10.4 unmodified, no properties set in subversion for the file in question. Looks like trac 0.10.4 doesn't know .cs files as anything else than silverlight templates.

Added the line

mime_map = text/x-java:cs

to trac.ini under the [mimeviewer] section and got some kind of syntax highlighting to appear.

Looks absolutely horrible, doesn't even highlight keywords.

comment:11 in reply to:  10 Changed 16 years ago by james.telfer@…

Replying to anonymous:

Enabled logging, looks I'm getting the mime type issue:

<snip/>

Added the line

mime_map = text/x-java:cs

to trac.ini under the [mimeviewer] section and got some kind of syntax highlighting to appear.

Looks absolutely horrible, doesn't even highlight keywords.

It looks bad because you're using the Java highlighting for !C#. Try text/x-csharp:cs instead.

See the Pygments lexer documentation for details of other languages, their extensions and mime-types.

comment:12 in reply to:  7 ; Changed 16 years ago by james.telfer@…

Replying to mgood:

@mqm: Am I correct in assuming your svn:mimetype properties were actually set to text/plain which was overriding Trac's extension lookup?

This is happening to me: one of the tools I use (Subclipse/Subversive) seems to add text/plain to the svn:mime-type property of all my Java source. This is a bit irritating, and I'm trying to find a way to turn it off.

Is there a way to make pygments prefer the file extension over the svn:mime-type setting?

Cheers, JT

comment:13 in reply to:  12 Changed 16 years ago by anonymous

Replying to james.telfer@crowncontent.com.au:

Is there a way to make pygments prefer the file extension over the svn:mime-type setting?

No, this is handled by the mimeview system, not the plugin. Such a thing would be considered a bug anyway, I would talk to the subclipse devs.

comment:14 Changed 15 years ago by hanno.stock@…

For those who wonder how to get c# to work:

[mimeviewer]
mime_map = text/x-csharp:cs
pygments_modes = text/x-csharp:csharp:7

(First entry maps .cs extension to mime type while the second entry maps the mime type to the corresponding pygments lexer.)

comment:15 Changed 14 years ago by Ryan J Ollos

Resolution: wontfix
Status: assignedclosed

Closing ticket since plugin is unmaintained and support can be found by upgrading to Trac 0.11.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matt Good.
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.