diff options
Diffstat (limited to 'tools/regression/xsl_reports/utils')
-rw-r--r-- | tools/regression/xsl_reports/utils/__init__.py | 13 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/accept_args.py | 30 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/char_translation_table.py | 13 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/check_existance.py | 9 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/checked_system.py | 22 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/libxslt.py | 49 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/log.py | 18 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/makedirs.py | 7 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/rename.py | 17 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/send_mail.py | 13 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/sourceforge.py | 48 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/tar.py | 16 | ||||
-rw-r--r-- | tools/regression/xsl_reports/utils/zip.py | 12 |
13 files changed, 0 insertions, 267 deletions
diff --git a/tools/regression/xsl_reports/utils/__init__.py b/tools/regression/xsl_reports/utils/__init__.py deleted file mode 100644 index 6d542083d..000000000 --- a/tools/regression/xsl_reports/utils/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ - -from accept_args import * -from char_translation_table import * -from check_existance import * -from checked_system import * -from libxslt import * -from log import * -from makedirs import * -from rename import * -from tar import * -from zip import * - -import sourceforge diff --git a/tools/regression/xsl_reports/utils/accept_args.py b/tools/regression/xsl_reports/utils/accept_args.py deleted file mode 100644 index b08739f40..000000000 --- a/tools/regression/xsl_reports/utils/accept_args.py +++ /dev/null @@ -1,30 +0,0 @@ - -import getopt -import re -import sys - -def accept_args( args_spec, args, options, usage ): - - defaults_num = len(options) - - ( option_pairs, rest_args ) = getopt.getopt( args, '', args_spec ) - map( lambda x: options.__setitem__( x[0], x[1] ), option_pairs ) - - if ( options.has_key( '--help' ) or len( options.keys() ) == defaults_num ): - usage() - sys.exit( 1 ) - - if len( rest_args ) > 0 and rest_args[0][0] == '@': - f = open( rest_args[0][1:], 'r' ) - config_lines = f.read().splitlines() - f.close() - for l in config_lines: - if re.search( r'^\s*#', l ): continue - if re.search( r'^\s*$', l ): continue - m = re.match( r'^(?P<name>.*?)=(?P<value>.*)', l ) - if m: - options[ '--%s' % m.group( 'name' ) ] = m.group( 'value' ) - else: - raise 'Invalid format of config line "%s"' % l - - return rest_args diff --git a/tools/regression/xsl_reports/utils/char_translation_table.py b/tools/regression/xsl_reports/utils/char_translation_table.py deleted file mode 100644 index c2d8fb6c9..000000000 --- a/tools/regression/xsl_reports/utils/char_translation_table.py +++ /dev/null @@ -1,13 +0,0 @@ - -import string - -def chr_or_question_mark( c ): - if chr(c) in string.printable and c < 128 and c not in ( 0x09, 0x0b, 0x0c ): - return chr(c) - else: - return '?' - -char_translation_table = string.maketrans( - ''.join( map( chr, range(0, 256) ) ) - , ''.join( map( chr_or_question_mark, range(0, 256) ) ) - ) diff --git a/tools/regression/xsl_reports/utils/check_existance.py b/tools/regression/xsl_reports/utils/check_existance.py deleted file mode 100644 index 9e3d0e7b2..000000000 --- a/tools/regression/xsl_reports/utils/check_existance.py +++ /dev/null @@ -1,9 +0,0 @@ - -import os - -def check_existance( name ): - a = os.popen( '%s --version' % name ) - output = a.read() - rc = a.close() - if rc is not None: - raise Exception( '"%s" is required' % name ) diff --git a/tools/regression/xsl_reports/utils/checked_system.py b/tools/regression/xsl_reports/utils/checked_system.py deleted file mode 100644 index bdb8e8f8e..000000000 --- a/tools/regression/xsl_reports/utils/checked_system.py +++ /dev/null @@ -1,22 +0,0 @@ - -import os -import string -import sys - -def system( commands ): - if sys.platform == 'win32': - f = open( 'tmp.cmd', 'w' ) - f.write( string.join( commands, '\n' ) ) - f.close() - rc = os.system( 'tmp.cmd' ) - return rc - else: - rc = os.system( '&&'.join( commands ) ) - return rc - - -def checked_system( commands, valid_return_codes = [ 0 ] ): - rc = system( commands ) - if rc not in [ 0 ] + valid_return_codes: - raise Exception( 'Command sequence "%s" failed with return code %d' % ( commands, rc ) ) - return rc diff --git a/tools/regression/xsl_reports/utils/libxslt.py b/tools/regression/xsl_reports/utils/libxslt.py deleted file mode 100644 index d9184100e..000000000 --- a/tools/regression/xsl_reports/utils/libxslt.py +++ /dev/null @@ -1,49 +0,0 @@ - -# Copyright (c) MetaCommunications, Inc. 2003-2007 -# -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import utils.makedirs -import utils.rename -import os.path -import os -import sys - - -def xslt_param( path, replace_spaces = 1 ): - path = path.replace( '\\', '/' ) - if sys.platform == 'win32' and replace_spaces: - path = path.replace( ' ', '%20' ) - return path - - -def libxslt( log, xml_file, xsl_file, output_file, parameters = None ): - - utils.makedirs( os.path.dirname( output_file ) ) - - if sys.platform == 'win32': - os.chdir( os.path.dirname( xsl_file ) ) - - transform_command = 'xsltproc' - transform_command = transform_command + ' -o ' + '"%s"' % xslt_param( output_file ) - - if parameters is not None: - for i in parameters: - if parameters[i]: - parameters[i] = xslt_param( parameters[i] ) - transform_command = transform_command + ' --param %s "\'%s\'" ' % ( i, parameters[ i ] ) - - transform_command = transform_command + ' "%s" ' % xslt_param( xsl_file ) - transform_command = transform_command + ' "%s" ' % xslt_param( xml_file ) - log( transform_command ) - rc = os.system( transform_command ) - if rc != 0: - raise Exception( '"%s" failed with return code %d' % ( transform_command, rc ) ) - - output_file = xslt_param( output_file, 0 ) - xlst_output_file = xslt_param( output_file ) - if output_file != xlst_output_file and os.path.exists( xlst_output_file ): - utils.rename( log, xlst_output_file, output_file ) - diff --git a/tools/regression/xsl_reports/utils/log.py b/tools/regression/xsl_reports/utils/log.py deleted file mode 100644 index 28b1366f8..000000000 --- a/tools/regression/xsl_reports/utils/log.py +++ /dev/null @@ -1,18 +0,0 @@ - -import inspect -import sys - -def log_level(): - frames = inspect.stack() - level = 0 - for i in frames[ 3: ]: - if i[0].f_locals.has_key( '__log__' ): - level = level + i[0].f_locals[ '__log__' ] - return level - - -def stdlog( message ): - sys.stderr.write( '# ' + ' ' * log_level() + message + '\n' ) - sys.stderr.flush() - -log = stdlog diff --git a/tools/regression/xsl_reports/utils/makedirs.py b/tools/regression/xsl_reports/utils/makedirs.py deleted file mode 100644 index 94b68d32f..000000000 --- a/tools/regression/xsl_reports/utils/makedirs.py +++ /dev/null @@ -1,7 +0,0 @@ - -import os.path -import os - -def makedirs( path ): - if not os.path.exists( path ): - os.makedirs( path ) diff --git a/tools/regression/xsl_reports/utils/rename.py b/tools/regression/xsl_reports/utils/rename.py deleted file mode 100644 index 95fb36ff4..000000000 --- a/tools/regression/xsl_reports/utils/rename.py +++ /dev/null @@ -1,17 +0,0 @@ - -# Copyright (c) MetaCommunications, Inc. 2003-2007 -# -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os.path -import os - - -def rename( log, src, dst ): - log( 'Renaming %s to %s' % ( src, dst ) ) - if os.path.exists( dst ): - os.unlink( dst ) - - os.rename( src, dst ) diff --git a/tools/regression/xsl_reports/utils/send_mail.py b/tools/regression/xsl_reports/utils/send_mail.py deleted file mode 100644 index d0ed98fd1..000000000 --- a/tools/regression/xsl_reports/utils/send_mail.py +++ /dev/null @@ -1,13 +0,0 @@ - -import smtplib - -def send_mail( mail, subject, msg = '' ): - smtp_server = smtplib.SMTP( 'mail.%s' % mail.split( '@' )[-1] ) - smtp_server.sendmail( - mail - , [ mail ] - , 'Subject: %s\n' % subject - + 'To: %s\n' % mail - + '\n' - + msg - ) diff --git a/tools/regression/xsl_reports/utils/sourceforge.py b/tools/regression/xsl_reports/utils/sourceforge.py deleted file mode 100644 index 0c6b08528..000000000 --- a/tools/regression/xsl_reports/utils/sourceforge.py +++ /dev/null @@ -1,48 +0,0 @@ - -import utils.checked_system -import os -import sys - -site_dir = '/home/groups/b/bo/boost/htdocs/' - -def download( source, destination, user ): - if sys.platform == 'win32': - destination = os.popen( 'cygpath "%s"' % destination ).read().splitlines()[0] - - utils.checked_system( [ - 'rsync -v -r -z --progress %(user)s@shell.sourceforge.net:%(site_dir)s%(source)s %(dest)s' - % { 'user': user, 'site_dir': site_dir, 'source': source, 'dest': destination } - ] ) - - -def upload( source, destination, user ): - if sys.platform == 'win32': - source = os.popen( 'cygpath "%s"' % source ).read().splitlines()[0] - - utils.checked_system( [ - 'rsync -v -r -z --progress %(source)s %(user)s@shell.sourceforge.net:%(site_dir)s%(dest)s' - % { 'user': user, 'site_dir': site_dir, 'source': source, 'dest': destination } - ] ) - - -def checked_system( commands, user, background = False ): - if not background: - cmd = 'ssh -l %s shell.sourceforge.net "%s"' - else: - cmd = 'ssh -f -l %s shell.sourceforge.net "%s"' - - utils.checked_system( - [ cmd % ( user, '&&'.join( commands ) ) ] - ) - - -def untar( archive, user, background ): - checked_system( - [ - 'cd %s' % os.path.join( site_dir, os.path.dirname( archive ) ) - , 'tar -x -z --overwrite --mode=+w -f %s' % os.path.basename( archive ) - , 'rm -f %s' % archive - ] - , user = user - , background = background - ) diff --git a/tools/regression/xsl_reports/utils/tar.py b/tools/regression/xsl_reports/utils/tar.py deleted file mode 100644 index 19deb1992..000000000 --- a/tools/regression/xsl_reports/utils/tar.py +++ /dev/null @@ -1,16 +0,0 @@ - -import utils.checked_system -import os.path - -def tar( source_dir, archive_name ): - utils.checked_system( [ - 'cd %s' % source_dir - , 'tar -c -f ../%s -z *' % archive_name - ] ) - -def untar( archive_path ): - #utils.checked_system( [ 'tar -xjf "%s"' % archive_path ] ) - utils.checked_system( [ - 'cd %s' % os.path.dirname( archive_path ) - , 'tar -xjf "%s"' % os.path.basename( archive_path ) - ] ) diff --git a/tools/regression/xsl_reports/utils/zip.py b/tools/regression/xsl_reports/utils/zip.py deleted file mode 100644 index 7473aa005..000000000 --- a/tools/regression/xsl_reports/utils/zip.py +++ /dev/null @@ -1,12 +0,0 @@ - -import zipfile -import os.path - -def unzip( archive_path, result_dir ): - z = zipfile.ZipFile( archive_path, 'r', zipfile.ZIP_DEFLATED ) - for f in z.infolist(): - result = open( os.path.join( result_dir, f.filename ), 'wb' ) - result.write( z.read( f.filename ) ) - result.close() - - z.close() |