[PATCH 4 of 4] cli: front-end-build: generate pygments.css dynamically
Mads Kiilerich
mads at kiilerich.com
Tue Nov 27 01:04:21 UTC 2018
On 11/26/2018 09:39 PM, Thomas De Schampheleire wrote:
> 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.
I don't think that is a good assumption: One value of the setuptools /
virtualenv bin/ entries is that they can be used without enabling the
venv first. They will do what is necessary to set the right Python path.
I don't think we can assume that PATH is been set to include the bin
directory. I also doubt it would be a good idea to have the tool set a
custom PATH ... but perhaps ...
/Mads
More information about the kallithea-general
mailing list