#!/usr/bin/env python
# coding:utf-8
"""
Created by ben on 2010/11/24 .
Copyright (c) 2010 http://sa3.org All rights reserved.
"""
import shutil
import os
import os.path
import re
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
FILELISTSOURCE = ['./LiveSwitch3/TemplateAssemblyInfo.cs','./LiveSwitch4/TemplateAssemblyInfo.cs']
VERSION_STR = 'MyVersion'
TEMPLATE_STR='Template'
TARGETDIR_STR='/Properties'
TARGETFILE_STR='/AssemblyInfo.cs'
def commit_version(ui,repo,**kwargs):
for filename in FILELISTSOURCE:
fOri = open(filename, 'r+')
data = fOri.read()
strinfo = re.compile(VERSION_STR)
vesion = "%s" %(len(repo) - 1)
b = strinfo.sub(vesion,data)
fOri.close()
nEndIndex = filename.rindex('/')
fileTargetDir = filename[0:nEndIndex]+TARGETDIR_STR
fileTargetFile = fileTargetDir+TARGETFILE_STR
print fileTargetDir
print fileTargetFile
if os.path.isfile(fileTargetFile):
os.remove(fileTargetFile)
if not os.path.isdir(fileTargetDir) :
os.mkdir(fileTargetDir)
fNew = open(fileTargetFile, 'w+')
#print b
fNew.write(b)
fNew.close()
if __name__=='__main__':
pass| 只有注冊用戶登錄后才能發(fā)表評(píng)論。 | ||
|
【推薦】100%開源!大型工業(yè)跨平臺(tái)軟件C++源碼提供,建模,組態(tài)!
|
||
網(wǎng)站導(dǎo)航:
博客園
IT新聞
BlogJava
博問
Chat2DB
管理
|
||
|
|