localpkg.remove_all()
tarball = '%s/%s-%s-tizen.tar.bz2' % (workdir, name, version)
- msger.info('archive git tree to tar ball: %s' % tarball)
+ msger.info('archive git tree to tarball: %s' % os.path.basename(tarball))
mygit.archive("%s-%s/" % (name, version), tarball)
for f in glob.glob('packaging/*'):
'error',
'ask',
'pause',
+ 'waiting',
'PrintBuf',
'PrintBufWrapper',
]
_color_perror(head, ERR_COLOR, msg)
sys.exit(1)
+def waiting(f):
+ """Function decorator to show simple waiting message for
+ long time operations.
+ """
+
+ import functools
+
+ @functools.wraps(f)
+ def _wait_with_print(*args, **kwargs):
+ import threading
+
+ class _WaitingTimer(threading.Thread):
+ def __init__(self):
+ threading.Thread.__init__(self)
+ self.event = threading.Event()
+ self.waited = False
+
+ def run(self):
+ while not self.event.is_set():
+ # put the waiting above the actual
+ # printing to avoid unnecessary msg
+ self.event.wait(1)
+ if self.event.is_set():
+ break
+
+ self.waited = True
+ STDERR.write('.')
+ STDERR.flush()
+
+ def stop(self):
+ self.event.set()
+
+ if self.waited:
+ STDERR.write('\n')
+ STDERR.flush()
+
+ timer = _WaitingTimer()
+ timer.start()
+
+ try:
+ out = f(*args, **kwargs)
+ except:
+ raise
+ finally:
+ timer.stop()
+
+ return out
+
+ return _wait_with_print
+
def ask(msg, default=True):
_general_print('\rQ', ASK_COLOR, '')
try:
with Workdir(self._bdir):
self._bs.mkPac(self._prj, self._pkg)
+ @msger.waiting
def _checkout_latest(self):
""" checkout the 'latest' revision of package with link expanded
"""
else:
msger.warning('Invalid pac working dir, skip')
+ @msger.waiting
def commit(self, msg):
with Workdir(self._pkgpath):
self._bs.submit(msg)
self._apiurl = self._bs.apiurl
self._prj = prj
+ @msger.waiting
def is_new(self):
return self._bs.isNewProject(self._prj)