lyx_mirror/development/cmake/po/cat.py
José Matos 3f03f0a447 Move all python shebangs from /usr/bin/env to python3.
The change is only relevant to development as all the call to python scripts is done
calling C++ os::python that invoques the appropriate python version.

The change is two fold, on one hand remove all the uses of /usr/bin/env for python.

On the other hand rename all the calls to python from python to python3 making it explicit
and being compliant with PEP 394 -- The "python" Command on Unix-Like Systems:
https://www.python.org/dev/peps/pep-0394/

Remove the sheebang from src/graphics/GraphicsConverter.cpp because it is not necessary.

Some small whitespace changes.
2018-12-29 19:14:41 +00:00

44 lines
998 B
Python

#! /usr/bin/python3
from __future__ import print_function
import sys
from getopt import getopt
usage = '''
python cat.py -o OUTFILE FILE1 FILE2 .... FILEn
Replacement for:
cat FILE1 FILE2 ... .FILEn > OUTFILE
If the -o argument is not given, writes to stdout.
'''
outfile = ""
(options, args) = getopt(sys.argv[1:], "ho:")
for (opt, param) in options:
if opt == "-o":
outfile = param
elif opt == "-h":
print(usage)
sys.exit(0)
out = sys.stdout
if outfile:
# always write unix line endings, even on windows
out = open(outfile, "wb")
for f in args:
# accept both windows and unix line endings, since it can happen that we
# are on unix, but the file has been written on windows or vice versa.
fil = open(f, "rU")
for l in fil:
# this does always write unix line endings since the file has
# been opened in binary mode. This is needed since both gettext
# and our .pot file manipulation scripts assume unix line ends.
out.write(l)
fil.close()
if outfile:
out.close()