mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Cleanup multithreading, allow running from any dir
This commit is contained in:
parent
abe936065e
commit
1affa0dd18
@ -9,12 +9,11 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import timeit
|
import timeit
|
||||||
import threading
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
######## GLOBALS #########
|
######## GLOBALS #########
|
||||||
MAINPREFIX = "z"
|
MAINPREFIX = "Z"
|
||||||
PREFIX = "ace_"
|
PREFIX = "ACE"
|
||||||
##########################
|
##########################
|
||||||
|
|
||||||
def Fract_Sec(s):
|
def Fract_Sec(s):
|
||||||
@ -36,7 +35,7 @@ def CheckPBO(p,makePboArgs,errors):
|
|||||||
makePboArgs,
|
makePboArgs,
|
||||||
"-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p),
|
"-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p),
|
||||||
p,
|
p,
|
||||||
"{}{}.pbo".format(PREFIX,p)
|
"{}_{}.pbo".format(PREFIX,p)
|
||||||
], stdin=None, input=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
|
], stdin=None, input=None, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print("!! Problem With {} ret {} !!".format(p, e.returncode))
|
print("!! Problem With {} ret {} !!".format(p, e.returncode))
|
||||||
@ -44,21 +43,21 @@ def CheckPBO(p,makePboArgs,errors):
|
|||||||
errors.append(p)
|
errors.append(p)
|
||||||
else:
|
else:
|
||||||
print(" Checked ok {}".format(p))
|
print(" Checked ok {}".format(p))
|
||||||
return
|
return
|
||||||
|
|
||||||
def fullDump(p):
|
def fullDump(p):
|
||||||
try:
|
try:
|
||||||
subprocess.run([
|
subprocess.run([
|
||||||
"makepbo",
|
"makepbo",
|
||||||
"-PQGs", #Q Lint only - Gs Check external references and show deRap - P dont pause
|
"-PQGs", #Q Lint only - Gs Check external references and show deRap - P dont pause
|
||||||
"-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p),
|
"-@={}\\{}\\addons\\{}".format(MAINPREFIX,PREFIX.rstrip("_"),p),
|
||||||
p,
|
p,
|
||||||
"{}{}.pbo".format(PREFIX,p)
|
"{}_{}.pbo".format(PREFIX,p)
|
||||||
], stdin=None, input=None, check=True)
|
], stdin=None, input=None, check=True)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
input("Press Enter to continue...")
|
input("Press Enter to continue...")
|
||||||
return
|
return
|
||||||
|
|
||||||
def main(argv):
|
def main(argv):
|
||||||
print("""
|
print("""
|
||||||
####################
|
####################
|
||||||
@ -68,11 +67,13 @@ def main(argv):
|
|||||||
|
|
||||||
start_time = timeit.default_timer()
|
start_time = timeit.default_timer()
|
||||||
|
|
||||||
scriptpath = os.path.realpath(__file__)
|
addonspath = os.path.join("P:\\",MAINPREFIX,PREFIX,"addons")
|
||||||
projectpath = os.path.dirname(os.path.dirname(scriptpath))
|
|
||||||
addonspath = os.path.join(projectpath, "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
|
#Q Lint only - G Check external references - P dont pause (Gs) does full derap
|
||||||
makePboArgs = "-PQG"
|
makePboArgs = "-PQG"
|
||||||
@ -81,27 +82,19 @@ def main(argv):
|
|||||||
makePboArgs = "-PQ"
|
makePboArgs = "-PQ"
|
||||||
|
|
||||||
errors = []
|
errors = []
|
||||||
|
|
||||||
for p in os.listdir(addonspath):
|
for p in os.listdir(addonspath):
|
||||||
path = os.path.join(addonspath, p)
|
path = os.path.join(addonspath, p)
|
||||||
if not os.path.isdir(path):
|
if not os.path.isdir(path):
|
||||||
continue
|
continue
|
||||||
if p[0] == ".":
|
if p[0] == ".":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# t = threading.Thread(target=CheckPBO, args=(p,makePboArgs,errors))
|
|
||||||
# t.start()
|
|
||||||
CheckPBO(p,makePboArgs,errors)
|
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)
|
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))
|
print("\n# Done with {0} errrors [took: {1:2}h {2:2}m {3:4.5f}s]".format(len(errors),h,m,s))
|
||||||
|
|
||||||
if (len(errors) > 0):
|
if (len(errors) > 0):
|
||||||
if "full" in argv:
|
if "full" in argv:
|
||||||
input("Dumping Full DeRap: Press Enter to continue...")
|
input("Dumping Full DeRap: Press Enter to continue...")
|
||||||
@ -109,7 +102,7 @@ def main(argv):
|
|||||||
fullDump(p)
|
fullDump(p)
|
||||||
else:
|
else:
|
||||||
print("use 'full' arg to show derap")
|
print("use 'full' arg to show derap")
|
||||||
|
|
||||||
ret = len(errors)
|
ret = len(errors)
|
||||||
print("return {}".format(ret))
|
print("return {}".format(ret))
|
||||||
return ret
|
return ret
|
||||||
|
Loading…
Reference in New Issue
Block a user