[PATCH 4 of 4] cli: front-end-build: generate pygments.css dynamically

Thomas De Schampheleire patrickdepinguin at gmail.com
Mon Nov 26 20:39:16 UTC 2018


El dom., 25 nov. 2018 a las 3:47, Mads Kiilerich
(<mads at kiilerich.com>) escribió:
>
> On 11/22/2018 10:36 PM, Thomas De Schampheleire wrote:
> > diff --git a/kallithea/bin/kallithea_cli_front_end.py b/kallithea/bin/kallithea_cli_front_end.py
> > --- a/kallithea/bin/kallithea_cli_front_end.py
> > +++ b/kallithea/bin/kallithea_cli_front_end.py
> > @@ -48,3 +48,9 @@ def front_end_build(install_deps, genera
> >           csspath = os.path.join(rootdir, 'kallithea', 'public', 'css', 'style.css')
> >           subprocess.check_call([lesscpath, '--relative-urls', '--source-map',
> >                   '--source-map-less-inline', lesspath, csspath])
> > +        with open(os.path.join(rootdir, 'kallithea', 'public', 'css', 'pygments.css'), 'w') as f:
> > +            subprocess.check_call(['pygmentize',
> > +                    '-S', 'default',
> > +                    '-f', 'html',
> > +                    '-a', '.code-highlight'],
> > +                    stdout=f)
>
> Hmm. I realize this will fail if kallithea-cli is invoked with full path
> into the venv, and pygmentize isn't in PATH but also must be invoked
> with full path.
>
> We should perhaps invoke pygments.cmdline.main directly instead.

Isn't the expectation that users have activated the venv before
calling any commands?
If we can assume that, then pygmentize will be in PATH.

But I'm fine with making a change that would allow external calls too.


More information about the kallithea-general mailing list