Cleanup multithreading, allow running from any dir

This commit is contained in:
PabstMirror 2016-01-14 17:42:35 -06:00
parent abe936065e
commit 1affa0dd18

View File

@ -9,12 +9,11 @@ import os
import sys
import subprocess
import timeit
import threading
import time
######## GLOBALS #########
MAINPREFIX = "z"
PREFIX = "ace_"
MAINPREFIX = "Z"
PREFIX = "ACE"
##########################
def Fract_Sec(s):
@ -36,7 +35,7 @@ def CheckPBO(p,makePboArgs,errors):
makePboArgs,
"-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p),
p,
"{}{}.pbo".format(PREFIX,p)
"{}_{}.pbo".format(PREFIX,p)
], stdin=None, input=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
except subprocess.CalledProcessError as e:
print("!! Problem With {} ret {} !!".format(p, e.returncode))
@ -53,7 +52,7 @@ def fullDump(p):
"-PQGs", #Q Lint only - Gs Check external references and show deRap - P dont pause
"-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p),
p,
"{}{}.pbo".format(PREFIX,p)
"{}_{}.pbo".format(PREFIX,p)
], stdin=None, input=None, check=True)
except subprocess.CalledProcessError as e:
input("Press Enter to continue...")
@ -68,11 +67,13 @@ def main(argv):
start_time = timeit.default_timer()
scriptpath = os.path.realpath(__file__)
projectpath = os.path.dirname(os.path.dirname(scriptpath))
addonspath = os.path.join(projectpath, "addons")
addonspath = os.path.join("P:\\",MAINPREFIX,PREFIX,"addons")
os.chdir(addonspath)
print("Switching to dir: {}".format(addonspath))
try:
os.chdir(addonspath)
except:
raise Exception("Failed to switch to addon dir on P:")
#Q Lint only - G Check external references - P dont pause (Gs) does full derap
makePboArgs = "-PQG"
@ -88,17 +89,9 @@ def main(argv):
continue
if p[0] == ".":
continue
# t = threading.Thread(target=CheckPBO, args=(p,makePboArgs,errors))
# t.start()
CheckPBO(p,makePboArgs,errors)
# for t in threading.enumerate():
# if t is threading.currentThread():
# continue
# t.join()
d,h,m,s = Fract_Sec(timeit.default_timer() - start_time)
print("\n# Done with {0} errrors [took: {1:2}h {2:2}m {3:4.5f}s]".format(len(errors),h,m,s))