mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-17 02:40:50 +12:00
prequeue: say how many files are being preprocessed
This commit is contained in:
parent
39a55822ce
commit
493b483490
14
prequeue.py
14
prequeue.py
|
@ -10,13 +10,14 @@ import sys
|
||||||
|
|
||||||
import preprocessor
|
import preprocessor
|
||||||
|
|
||||||
def main():
|
def preprocess_queue(filenames=sys.argv[1:]):
|
||||||
processor = preprocessor.setup_processor()
|
|
||||||
|
|
||||||
stdin = sys.stdin
|
stdin = sys.stdin
|
||||||
stdout = sys.stdout
|
stdout = sys.stdout
|
||||||
|
|
||||||
for source in sys.argv[1:]:
|
processor = preprocessor.setup_processor()
|
||||||
|
|
||||||
|
for source in filenames:
|
||||||
dest = os.path.splitext(source)[0] + '.tx'
|
dest = os.path.splitext(source)[0] + '.tx'
|
||||||
sys.stdin = open(source, 'r')
|
sys.stdin = open(source, 'r')
|
||||||
sys.stdout = open(dest, 'w')
|
sys.stdout = open(dest, 'w')
|
||||||
|
@ -27,6 +28,13 @@ def main():
|
||||||
sys.stdin = stdin
|
sys.stdin = stdin
|
||||||
sys.stdout = stdout
|
sys.stdout = stdout
|
||||||
|
|
||||||
|
def main():
|
||||||
|
filenames = list(set(sys.argv[1:]))
|
||||||
|
if filenames:
|
||||||
|
num_files = len(filenames)
|
||||||
|
s = '' if num_files == 1 else 's'
|
||||||
|
sys.stdout.write('Preprocessing {0} file{1}...\n'.format(num_files, s))
|
||||||
|
preprocess_queue(filenames)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue