Revert "12/21 modernizations from TG live"
This commit is contained in:
+4
-15
@@ -4,7 +4,6 @@ import subprocess
|
||||
import os
|
||||
import sys
|
||||
import argparse
|
||||
import time
|
||||
from subprocess import PIPE, STDOUT
|
||||
|
||||
null = open("/dev/null", "wb")
|
||||
@@ -37,8 +36,7 @@ def stage2(map):
|
||||
p = subprocess.Popen(args, shell=True)
|
||||
wait(p)
|
||||
|
||||
def stage3(profile_mode=False):
|
||||
start_time = time.time()
|
||||
def stage3():
|
||||
play("sound/misc/compiler-stage2.ogg")
|
||||
logfile = open('server.log~','w')
|
||||
p = subprocess.Popen(
|
||||
@@ -47,15 +45,9 @@ def stage3(profile_mode=False):
|
||||
try:
|
||||
while p.returncode is None:
|
||||
stdout = p.stdout.readline()
|
||||
if "Initializations complete." in stdout:
|
||||
t = "Initializations complete."
|
||||
if t in stdout:
|
||||
play("sound/misc/server-ready.ogg")
|
||||
time_taken = time.time() - start_time
|
||||
print("{} seconds taken to fully start".format(time_taken))
|
||||
if "Map is ready." in stdout:
|
||||
time_taken = time.time() - start_time
|
||||
print("{} seconds for initial map loading".format(time_taken))
|
||||
if profile_mode:
|
||||
return time_taken
|
||||
sys.stdout.write(stdout)
|
||||
sys.stdout.flush()
|
||||
logfile.write(stdout)
|
||||
@@ -71,7 +63,6 @@ def main():
|
||||
parser.add_argument('-s','---stage',default=1,type=int)
|
||||
parser.add_argument('--only',action='store_true')
|
||||
parser.add_argument('-m','--map',type=str)
|
||||
parser.add_argument('--profile-mode',action='store_true')
|
||||
args = parser.parse_args()
|
||||
stage = args.stage
|
||||
assert stage in (1,2,3)
|
||||
@@ -84,9 +75,7 @@ def main():
|
||||
if not args.only:
|
||||
stage = 3
|
||||
if stage == 3:
|
||||
value = stage3(profile_mode=args.profile_mode)
|
||||
with open('profile~', 'a') as f:
|
||||
f.write("{}\n".format(value))
|
||||
stage3()
|
||||
|
||||
if __name__=='__main__':
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user