@@ -60,24 +60,6 @@ def have_docker():
6060# Force line buffering on stdout.
6161sys .stdout = os .fdopen (1 , 'w' , 1 )
6262
63- # Force stdout FD 1 to be a pipe, so tools like pip don't spam progress bars.
64- if 'TRAVIS_HOME' in os .environ :
65- proc = subprocess .Popen (
66- args = ['stdbuf' , '-oL' , 'cat' ],
67- stdin = subprocess .PIPE
68- )
69-
70- os .dup2 (proc .stdin .fileno (), 1 )
71- os .dup2 (proc .stdin .fileno (), 2 )
72-
73- def cleanup_travis_junk (stdout = sys .stdout , stderr = sys .stderr , proc = proc ):
74- stdout .close ()
75- stderr .close ()
76- proc .terminate ()
77-
78- atexit .register (cleanup_travis_junk )
79-
80- # -----------------
8163
8264def _argv (s , * args ):
8365 """Interpolate a command line using *args, return an argv style list.
@@ -125,6 +107,20 @@ def combine(batch):
125107 ))
126108
127109
110+ def throttle (batch , pause = 1 ):
111+ """
112+ Add pauses between commands in a batch
113+
114+ >>> throttle(['echo foo', 'echo bar', 'echo baz'])
115+ ['echo foo', 'sleep 1', 'echo bar', 'sleep 1', 'echo baz']
116+ """
117+ def _with_pause (batch , pause ):
118+ for cmd in batch :
119+ yield cmd
120+ yield 'sleep %i' % (pause ,)
121+ return list (_with_pause (batch , pause ))[:- 1 ]
122+
123+
128124def run_batches (batches ):
129125 """ Run shell commands grouped into batches, showing an execution trace.
130126
@@ -188,27 +184,9 @@ def destroy(self, rmtree=shutil.rmtree):
188184
189185
190186class Fold (object ):
191- """
192- Bracket a section of stdout with travis_fold markers.
193-
194- This allows the section to be collapsed or expanded in Travis CI web UI.
195-
196- >>> with Fold('stage 1'):
197- ... print('Frobnicate the frobnitz')
198- ...
199- travis_fold:start:stage 1
200- Frobnicate the frobnitz
201- travis_fold:end:stage 1
202- """
203- def __init__ (self , name ):
204- self .name = name
205-
206- def __enter__ (self ):
207- print ('travis_fold:start:%s' % (self .name ))
208-
209- def __exit__ (self , _1 , _2 , _3 ):
210- print ('' )
211- print ('travis_fold:end:%s' % (self .name ))
187+ def __init__ (self , name ): pass
188+ def __enter__ (self ): pass
189+ def __exit__ (self , _1 , _2 , _3 ): pass
212190
213191
214192os .environ .setdefault ('ANSIBLE_STRATEGY' ,
0 commit comments