From: Fredrik Unger Date: Mon, 6 Feb 2012 21:17:29 +0000 (+0100) Subject: Adding target directory and readability with ssh_cmd X-Git-Url: https://source.tree.se/git?p=treecutter.git;a=commitdiff_plain;h=1e2f6591827c99d3ece7f558065a28fc9247e54c Adding target directory and readability with ssh_cmd Making sure that the target directory exists and that it is readable after rsync. ssh_cmd added to simplify the call, but is currently limited to commands with two arguments plus directory. Can be generalized. subroutine call used to not need to add extra dependencies at this point. --- diff --git a/src/tree-cutter.py b/src/tree-cutter.py index 1daed02..4b28acb 100755 --- a/src/tree-cutter.py +++ b/src/tree-cutter.py @@ -46,6 +46,13 @@ def publish(src,target): if retcode: print 'Error: '+' '.join(cmd)+' Returncode ['+str(retcode)+']' +def ssh_cmd(target, command): + t = target.split(":") + c = command.split() + cmd = ["ssh",t[0],c[0],c[1],t[1]] + retcode = subprocess.call(cmd) + if retcode: + print 'Error: '+' '.join(cmd)+' Returncode ['+str(retcode)+']' PREFIXES={u'db': u'http://docbook.org/ns/docbook', u'xi': u'http://www.w3.org/2001/XInclude', @@ -408,9 +415,12 @@ class Sitemap(): return html def publish(self): + ssh_cmd(args.output,"mkdir -p") publish(tmptarget, args.output) - publish(args.style+"css", args.output) - publish(args.style+"images",args.output) + for res in ["css","images","js","favicon.ico"]: + if (os.path.exists(args.style+res)): + publish(args.style+res, args.output) + ssh_cmd(args.output,"chmod a+rx" ts = time.time() dir_ = Directory()