-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile.py
33 lines (29 loc) · 1019 Bytes
/
Makefile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
__author__ = 'nickl-'
# Abstraction layer of pure python only helpers to simplify the implementation
# complexities for ipython as gnu make SHELL.
def prompt(kx):
"""
Facilitate the validation and usage printout for
targets with required values.
"""
if len(kx['value'].strip()) == 0:
print kx['message']
if 'usage' in kx:
print '{:>9}\n{:10}{}'.format('Usage:', '', kx['usage'])
return True
return False
def prompt_in(msg):
"""
Assist with getting a prompt flushed in make target process.
Hopefully there are more elegant ways but I tried readline, stdin, stdout,
input, even print function and it is not like they ace only slightly broken
this is the only way I have managed to both display the prompt message
before the wait on read and successfully managed to retrieve the results.
works for now...
"""
from sys import stdout
print msg
stdout.flush()
inp = raw_input('')
stdout.flush()
return inp