Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r78638 - trunk/tools/release
From: bdawes_at_[hidden]
Date: 2012-05-26 13:54:28


Author: bemandawes
Date: 2012-05-26 13:54:27 EDT (Sat, 26 May 2012)
New Revision: 78638
URL: http://svn.boost.org/trac/boost/changeset/78638

Log:
inspect.py: Add command line arguments. Create temp directory if needed. Add ftp results to ftp site.
Text files modified:
   trunk/tools/release/inspect.py | 37 +++++++++++++++++++++++++++++++------
   1 files changed, 31 insertions(+), 6 deletions(-)

Modified: trunk/tools/release/inspect.py
==============================================================================
--- trunk/tools/release/inspect.py (original)
+++ trunk/tools/release/inspect.py 2012-05-26 13:54:27 EDT (Sat, 26 May 2012)
@@ -1,4 +1,4 @@
-# Inspect Trunk
+# Inspect Boost source tree and upload results to ftp site
 # Copyright Beman Dawes 2008, 2009, 2012
 
 # Distributed under the Boost Software License, Version 1.0.
@@ -7,6 +7,8 @@
 import os
 import os.path
 import subprocess
+from ftplib import FTP
+import argparse
 
 def cmnd(x): # execute a command
   rc = subprocess.call(x)
@@ -14,12 +16,28 @@
     print 'aborting command:'
     print x
     exit(rc)
+
+argpsr = argparse.ArgumentParser(
+ description='Inspect Boost source tree and upload results to ftp site',
+ epilog='Example: python inspect.py --user foo --pass bar --file inspect-trunk.html')
+argpsr.add_argument('--host', help='URL of ftp site. Default: boost.cowic.de',
+ default='boost.cowic.de')
+argpsr.add_argument('--user', help='User name for ftp site', required=True)
+argpsr.add_argument('--password', help='Password for ftp site', required=True)
+argpsr.add_argument('--filename', help='Filename for ftp site.', required=True)
+args = argpsr.parse_args()
+filepath = 'temp/' + args.filename
 
 if not os.path.exists('.svn'):
   print 'Error: must be run in the boost root directory'
   exit(1)
 print 'Boost root directory detected'
 
+if not os.path.exists('temp'):
+ print 'Create temp directory...'
+ os.mkdir('temp')
+ open('temp/boost-no-inspect', 'w').close()
+
 # cleanup clears locks or other residual problems (learned this the hard way!)
 print 'Clean working copy ...'
 cmnd(['svn', 'cleanup'])
@@ -28,10 +46,17 @@
 cmnd(['svn', 'up', '--non-interactive', '--trust-server-cert'])
 
 print 'Build inspect program...'
-old_dir = os.getcwd()
-os.chdir(['tools/inspect/build'])
-cmnd(['bjam'])
-os.chdir(old_dir)
+cmnd(['bjam', 'tools/inspect/build'])
 
 print 'Running inspect from ' + os.getcwd()
-cmnd(['dist/bin/inspect'])
+subprocess.call('dist/bin/inspect', stdout=open(filepath, 'w'))
+
+print 'Upload web page via ftp...'
+ftp = FTP(args.host, args.user, args.password)
+ftp.retrlines('LIST')
+ftp.storlines('STOR ' + args.filename, open(filepath))
+ftp.retrlines('LIST')
+ftp.quit()
+
+print "Inspect and upload complete"
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk