mirror of
https://github.com/boostorg/boost.git
synced 2025-04-15 01:08:14 +00:00
Factor out rename into a function
[SVN r37627]
This commit is contained in:
parent
32d6732dd5
commit
1f3d4fb409
4 changed files with 26 additions and 9 deletions
|
@ -674,11 +674,11 @@ def fix_file_names( dir ):
|
|||
for file in files:
|
||||
if file.find( "%20" ) > -1:
|
||||
new_name = file.replace( "%20", " " )
|
||||
old_file_path = os.path.join( root, file )
|
||||
new_file_path = os.path.join( root, new_name )
|
||||
utils.log( 'Renaming %s to %s' % ( old_file_path, new_file_path ) )
|
||||
os.unlink( new_file_path )
|
||||
os.rename( old_file_path, new_file_path )
|
||||
utils.rename(
|
||||
utils.log
|
||||
, os.path.join( root, file )
|
||||
, os.path.join( root, new_name )
|
||||
)
|
||||
|
||||
|
||||
def build_xsl_reports(
|
||||
|
|
|
@ -6,6 +6,7 @@ from checked_system import *
|
|||
from libxslt import *
|
||||
from log import *
|
||||
from makedirs import *
|
||||
from rename import *
|
||||
from tar import *
|
||||
from zip import *
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
import utils.makedirs
|
||||
import utils.rename
|
||||
import os.path
|
||||
import os
|
||||
import sys
|
||||
|
@ -43,8 +44,6 @@ def libxslt( log, xml_file, xsl_file, output_file, parameters = None ):
|
|||
|
||||
output_file = xslt_param( output_file, 0 )
|
||||
xlst_output_file = xslt_param( output_file )
|
||||
if output_file != xlst_output_file:
|
||||
log( 'Renaming %s to %s' % ( xlst_output_file, output_file ) )
|
||||
os.unlink( output_file )
|
||||
os.rename( xlst_output_file, output_file )
|
||||
if output_file != xlst_output_file:
|
||||
utils.rename( log, xlst_output_file, output_file )
|
||||
|
||||
|
|
17
tools/regression/xsl_reports/utils/rename.py
Normal file
17
tools/regression/xsl_reports/utils/rename.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
|
||||
# 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 )
|
Loading…
Add table
Reference in a new issue