-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.py
37 lines (32 loc) · 1.14 KB
/
publish.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import subprocess
import time
def getContent(fileList):
for eveFile in fileList:
try:
with open(eveFile) as f:
return f.read()
except:
pass
return None
with open('update.list') as f:
publish_list = [eve_app.strip() for eve_app in f.readlines()]
for eve_app in publish_list:
times = 1
while times <= 3:
print("----------------------: ", eve_app)
publish_script = 'https://serverless-registry.oss-cn-hangzhou.aliyuncs.com/publish-file/python3/hub-publish.py'
command = 'cd %s && wget %s && python hub-publish.py' % (
eve_app, publish_script)
child = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, )
stdout, stderr = child.communicate()
if child.returncode == 0:
print("stdout:", stdout.decode("utf-8"))
break
else:
print("stdout:", stdout.decode("utf-8"))
print("stderr:", stderr.decode("utf-8"))
time.sleep(3)
if times == 3:
raise ChildProcessError(stderr)
times = times + 1