Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 510682 - dev-vcs/mercurial should (unconditionally) (R)DEPEND on dev-python/pygments - hg serve: ImportError: No module named pygments
Summary: dev-vcs/mercurial should (unconditionally) (R)DEPEND on dev-python/pygments -...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Dirkjan Ochtman (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-18 20:44 UTC by Albert W. Hopkins
Modified: 2014-06-03 07:43 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert W. Hopkins 2014-05-18 20:44:39 UTC
Mercurial comes with it's own http server (hg serve) that can either be used as an ad-hoc rcs server for a single repo or a convenient way to browse a repo.  When used as the latter, clicking on a filename link without pygments installed produces the following:

    from pygments import highlight
  File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 130, in _demandimport
    mod = _hgextimport(_origimport, name, globals, locals)
  File "/usr/lib64/python2.7/site-packages/mercurial/demandimport.py", line 43, in _hgextimport
    return importfunc(name, globals, *args)
ImportError: No module named pygments

And the file does not get displayed in the browser.

I realize that some people will choose not to use the built-in http server and thus have no need for pygments, so perhaps it should be a use flag or something added to the post-inst message explaining that pygments may be required to use the http server.

dev-vcs/mercurial-3.0

Actually looking at the ebuild I see the "test" flag pulls in pygments in DEPEND (but not RDEPEND).
Comment 1 Nikolaj Šujskij 2014-05-19 07:57:03 UTC
This seems to be Mercurial bug, because Pygments should be required only when `highlight` extension is enabled. I'll try to investigate.
Comment 2 Nikolaj Šujskij 2014-05-19 08:14:19 UTC
Reported: http://bz.selenic.com/show_bug.cgi?id=4254
Comment 3 Nikolaj Šujskij 2014-05-19 11:40:16 UTC
(In reply to Albert W. Hopkins from comment #0)
Albert, here's what Mercurial devs say:

> It works just fine for me without pygments.
> 
> Can you show a full trace?
> 
> Are you absolutely sure the highlight extension isn't enabled? Check 'hg
> showconfig extensions' as the hgweb user.
Comment 4 Albert W. Hopkins 2014-05-19 13:22:41 UTC
(In reply to Nikolaj Sjujskij from comment #3)
> (In reply to Albert W. Hopkins from comment #0)
> Albert, here's what Mercurial devs say:
> 
> > It works just fine for me without pygments.
> > 
> > Can you show a full trace?
> > 
> > Are you absolutely sure the highlight extension isn't enabled? Check 'hg
> > showconfig extensions' as the hgweb user.

It is correct that I did have the highlight extension enabled.  I never noticed it was enabled.  It does in fact work w/o the pygments if the extension is turned off.

I think that perhaps pygments was installed somehow on my system before, perhaps as a dependency of something else, and that in time it was no longer a dependency and thus was depcleaned out, then Mercurial started to break.

Indeed, the help for the highlight extension does mention.

     highlight     syntax highlighting for hgweb (requires Pygments)

Sorry to have wasted resources on this.  It is neither a hard requirement nor undocumented.

This can be closed out.
Comment 5 Ian Delaney (RETIRED) gentoo-dev 2014-06-03 07:43:45 UTC
ok thx Nik