Skip to content

Commit 7e6eba6

Browse files
author
Cloud-init-user
committed
update
1 parent e1e4029 commit 7e6eba6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

autoBuilder.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
# -*- coding: utf8 -*-
33

44
import pysvn
5-
import time
65
import locale
76
import os
87
import shutil
98
import json
109
from config import *
1110
import subprocess
11+
import sys
12+
import time
13+
from datetime import datetime
1214

1315
def get_login(realm, username, may_save):
1416
return True, Config.username, Config.password, True
@@ -43,8 +45,8 @@ def svn_update(project,target_version):
4345
print_log('update ' + project.get_name() + ' error:' + str(err));
4446

4547
def print_log(msg):
46-
now = time.strftime("%Y-%m-%d %H:%M:%S");
47-
date = time.strftime('%Y-%m-%d');
48+
dt = time.localtime();
49+
now = time.strftime('%Y-%M-%d %H:%m:%S', time.localtime());
4850
try:
4951
if not os.path.exists(Config.log_dir):
5052
os.makedirs(Config.log_dir);
@@ -128,9 +130,11 @@ def copy_to_dist(project):
128130
print_log('copy project ' + project_name + ' distribution to ' + dist_dir + ' error: ' + str(err));
129131

130132
def run_shell_scripts(scripts):
133+
reload(sys);
134+
sys.setdefaultencoding('utf-8');
131135
p = subprocess.Popen(scripts,shell=True,stdout=subprocess.PIPE);
132-
out = p.communicate();
133-
print_log(out);
136+
out,err = p.communicate();
137+
print_log(out.decode('gbk'));
134138
if(p.returncode != 0 ):
135139
raise Exception('run "' + scripts + '" error! Exit code is ' + str(p.returncode));
136140
print_log('run "' + scripts + '" successfully!');

0 commit comments

Comments
 (0)