From 9b22af1b3210419780fe10b65b26c90797b4e7a7 Mon Sep 17 00:00:00 2001 From: guido Date: Thu, 8 Feb 2007 17:28:33 +0100 Subject: [PATCH] [svn r38179] Allowing to rsync also when tests are failing using a --ignorefail switch, and added a --help switch that shows a short help message. --HG-- branch : trunk --- py/bin/_update_website.py | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/py/bin/_update_website.py b/py/bin/_update_website.py index 2efd768fb..1e6cf316b 100755 --- a/py/bin/_update_website.py +++ b/py/bin/_update_website.py @@ -42,13 +42,16 @@ def run_tests(pkgpath, args=''): status = py.std.os.system(cmd) return status -def main(pkgpath, apidocspath, rhost, rpath, args=''): +def main(pkgpath, apidocspath, rhost, rpath, args='', ignorefail=False): print 'running tests' errors = run_tests(pkgpath, args) if errors: print >>sys.stderr, \ 'Errors while running the unit tests: %s' % (errors,) - sys.exit(1) + if not ignorefail: + print >>sys.stderr, ('if you want to continue the update ' + 'regardless of failures, use --ignorefail') + sys.exit(1) print 'rsyncing' gateway = py.execnet.SshGateway(rhost) @@ -58,9 +61,26 @@ def main(pkgpath, apidocspath, rhost, rpath, args=''): sys.exit(1) if __name__ == '__main__': + args = sys.argv[1:] + if '--help' in args or '-h' in args: + print 'usage: %s [options]' + print + print 'run the py lib tests and update the py lib website' + print 'options:' + print ' --ignorefail: ignore errors in the unit tests and always' + print ' try to rsync' + print ' --help: show this message' + print + print 'any additional arguments are passed on as-is to the py.test' + print 'child process' + sys.exit() + ignorefail = False + if '--ignorefail' in args: + args.remove('--ignorefail') + ignorefail = True args = ' '.join(sys.argv[1:]) pkgpath = py.__package__.getpath() apidocspath = pkgpath.dirpath().join('apigen') main(pkgpath, apidocspath, 'codespeak.net', - '/home/guido/rsynctests', args) + '/home/guido/rsynctests', args, ignorefail)