I read the help information of python-exec tool.
I think it is a pygment wapper. There are Formatters, Filters, and so on.
So If I use:
$ python-exec -l python -f html -o /tmp/test.file
#this is the input#
print 'hello world'
....
it will write the input to /tmp/test.file, and use pygments to colorful the code.
But why the pip and layman will softlink to it, I still don't know.
Append:
I have found the reason:
for some reason, some another application overwrite the /usr/bin/python-exec
. (I think maybe is pygments.)
The right content is :
#!/usr/bin/python-exec-c
# vim:fileencoding=utf-8:ft=python
# (c) 2012 Michał Górny
# Released under the terms of the 2-clause BSD license.
#
# This is not the script you are looking for. This is just a wrapper.
# The actual scripts of this application were installed with -python*,
# -pypy* or -jython* suffixes. You are most likely looking for one
# of those.
from __future__ import with_statement
import os, os.path, sys
try:
from epython import EPYTHON
except ImportError:
EPYTHON = os.path.basename(sys.executable)
if '' and EPYTHON.endswith(''):
EPYTHON = EPYTHON[:-len('')]
# In the loop:
# sys.argv[0] keeps the 'bare' name
# __file__ keeps the 'full' name
while True:
__file__ = sys.argv[0] + '-' + EPYTHON
try:
kwargs = {}
if sys.version_info[0] >= 3:
import tokenize
# need to provide encoding
with open(__file__, 'rb') as f:
kwargs['encoding'] = tokenize.detect_encoding(f.readline)[0]
with open(__file__, 'r', **kwargs) as f:
data = f.read()
except IOError:
# follow symlinks (if supported)
try:
sys.argv[0] = os.path.join(os.path.dirname(sys.argv[0]),
os.readlink(sys.argv[0]))
except (OSError, AttributeError):
# no more symlinks? then it's time to fail.
sys.stderr.write('This Python implementation (%s) is not supported by the script.\n'
% EPYTHON)
sys.exit(127)
else:
break
sys.argv[0] = __file__
exec(data)
and many binary files, such as pip, layman will all softlink to it, it is a simple wrapper.