3434import os .path
3535from os .path import join
3636import platform
37+ import requests
3738import shutil
3839from string import Template
3940import stat
@@ -82,7 +83,7 @@ def __exit__(self, etype, value, traceback):
8283 os .chdir (self .savedPath )
8384
8485def log (* args , ** kwargs ):
85- print (indent * ' ' + ' ' .join (map (str ,args )), ** kwargs )
86+ print (indent * ' ' + ' ' .join (map (str ,args )), flush = True , ** kwargs )
8687
8788def shell (c ):
8889 log (c )
@@ -252,18 +253,21 @@ def spec_venv(root, target=None):
252253 shell ('%s install --quiet -r requirements.txt' % pip )
253254
254255@action
255- def clones (root = '.' , target = None ):
256+ def get_tarballs (root = '.' , target = None ):
256257 root_only (root )
257- # defer loading this so script can be invoked without installing packages
258- from git import Repo
259- for repo_base in repos :
260- dir = join ('repos' ,repo_base )
261- if os .path .exists (dir ):
262- continue
263- uri = '%s/%s.git' % (os .environ ['EXTRA_REPOS' ], repo_base )
264- log ('clone:' , uri )
265- if not args .dry_run :
266- Repo .clone_from (uri , dir , multi_options = ['--depth' ,'1' ])
258+ if not os .path .exists ('tarballs' ):
259+ makedirs ('tarballs' )
260+ for t in tarballs :
261+ tf = join ('tarballs' ,'%s.tgz' % t )
262+ url = 'https://spec.oneapi.com/tarballs/%s.tgz' % t
263+ r = requests .get (url , stream = True )
264+ log ('wget' , url , end = ' ' )
265+ with open (tf , 'wb' ) as tb :
266+ for chunk in r .iter_content (chunk_size = 4 * 1024 * 1024 ):
267+ if chunk :
268+ tb .write (chunk )
269+ log ('.' , end = '' )
270+ log ('.' )
267271
268272@action
269273def site (root , target = None ):
@@ -285,7 +289,7 @@ def site(root, target=None):
285289 copytree (html , versions_x )
286290 copy (pdf , versions_x )
287291 for t in tarballs :
288- tf = join ('repos' , 'oneapi-spec-tarballs' , ' tarballs' ,'%s.tgz' % t )
292+ tf = join ('tarballs' ,'%s.tgz' % t )
289293 log ('cd' ,versions_x ,'&& tar zxf' ,tf )
290294 if not args .dry_run :
291295 with tarfile .open (tf ) as tar :
@@ -295,9 +299,9 @@ def site(root, target=None):
295299@action
296300def ci (root , target = None ):
297301 root_only (root )
298- clones (root )
302+ get_tarballs (root )
299303 site (root )
300- if args .branch == 'publish' :
304+ if args .branch == 'publish' or args . branch == 'refs/heads/publish' :
301305 stage_publish (root )
302306 else :
303307 ci_publish (root )
@@ -307,7 +311,7 @@ def ci(root, target=None):
307311commands = {'ci' : ci ,
308312 'ci-publish' : ci_publish ,
309313 'clean' : clean ,
310- 'clones ' : clones ,
314+ 'get-tarballs ' : get_tarballs ,
311315 'dockerbuild' : dockerbuild ,
312316 'dockerpush' : dockerpush ,
313317 'dockerrun' : dockerrun ,
@@ -332,10 +336,6 @@ def ci(root, target=None):
332336 'oneL0' ,
333337 'oneDAL' ]
334338
335- repos = ['onetbb-spec' ,
336- 'oneapi-spec-tarballs' ]
337-
338-
339339def main ():
340340 global args
341341 parser = argparse .ArgumentParser (description = 'Build oneapi spec.' )
0 commit comments