使用 Python 书写项目打包程序(已经存在 shell 的脚本,经过对比 Python 脚本的执行过程更加的可控人性化实现的功能相同)
1 #!/usr/bin/env python 2 # _*_coding:utf-8_*_ 3 # author: 'Edward.Liu' 4 # dateTime: '15/12/9' 5 # motto: 'Good memory as bad written' 6 import datetime, time 7 import os 8 import shutil 9 import subprocess 10 import tarfile 11 12 13 class Packages(object): 14 def __init__(self): 15 self.SVN_Checked_Directory = "/install/online/" 16 self.Project_Directory_F = "%scybershop-front/target" % self.SVN_Checked_Directory 17 self.Project_Directory_B = "%scybershop-web/target" % self.SVN_Checked_Directory 18 self.Upload_Directory = "/software/backwar/" 19 self.Project_Directory_F_Name = "cybershop-front-0.0.1-SNAPSHOT.war" 20 self.Project_Directory_B_Name = "cybershop-web-0.0.1-SNAPSHOT.war" 21 self.density_name = ['pro', 'demo', 'ptest'] 22 self.bulid_home = "/install/maven/bin/mvn" 23 self.date_time = datetime.datetime.now().strftime('%Y-%m-%d-%H') 24 25 def Subervison_Check(self): 26 global SVN_NUMBER 27 try: 28 while True: 29 SVN_NUMBER = raw_input("