From ac4b139b08f26a1809c7c096acc92e248ae79727 Mon Sep 17 00:00:00 2001 From: DragonMinded Date: Fri, 28 May 2021 19:50:59 -0400 Subject: [PATCH] Fix multiprocessing crash on windows. --- 2dxutils | 13 +++++++------ afputils | 15 ++++++++------- api | 15 ++++++++------- arcutils | 15 ++++++++------- bemanishark | 15 ++++++++------- binutils | 15 ++++++++------- cardconvert | 15 ++++++++------- dbutils | 15 ++++++++------- frontend | 15 ++++++++------- ifsutils | 15 ++++++++------- iidxutils | 15 ++++++++------- proxy | 15 ++++++++------- psmap | 15 ++++++++------- read | 15 ++++++++------- replay | 15 ++++++++------- responsegen | 15 ++++++++------- scheduler | 15 ++++++++------- services | 15 ++++++++------- shell | 13 +++++++------ struct | 15 ++++++++------- trafficgen | 15 ++++++++------- verifylibs | 27 ++++++++++++++------------- 22 files changed, 180 insertions(+), 158 deletions(-) diff --git a/2dxutils b/2dxutils index 54c209c..b01c5c7 100755 --- a/2dxutils +++ b/2dxutils @@ -1,9 +1,10 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module("bemani.utils.twodxutils", run_name="__main__") + import runpy + runpy.run_module("bemani.utils.twodxutils", run_name="__main__") \ No newline at end of file diff --git a/afputils b/afputils index a0917b9..ce6f396 100755 --- a/afputils +++ b/afputils @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/api b/api index a0917b9..ce6f396 100755 --- a/api +++ b/api @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/arcutils b/arcutils index a0917b9..ce6f396 100755 --- a/arcutils +++ b/arcutils @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/bemanishark b/bemanishark index a0917b9..ce6f396 100755 --- a/bemanishark +++ b/bemanishark @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/binutils b/binutils index a0917b9..ce6f396 100755 --- a/binutils +++ b/binutils @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/cardconvert b/cardconvert index a0917b9..ce6f396 100755 --- a/cardconvert +++ b/cardconvert @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/dbutils b/dbutils index a0917b9..ce6f396 100755 --- a/dbutils +++ b/dbutils @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/frontend b/frontend index a0917b9..ce6f396 100755 --- a/frontend +++ b/frontend @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/ifsutils b/ifsutils index a0917b9..ce6f396 100755 --- a/ifsutils +++ b/ifsutils @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/iidxutils b/iidxutils index a0917b9..ce6f396 100755 --- a/iidxutils +++ b/iidxutils @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/proxy b/proxy index a0917b9..ce6f396 100755 --- a/proxy +++ b/proxy @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/psmap b/psmap index a0917b9..ce6f396 100755 --- a/psmap +++ b/psmap @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/read b/read index a0917b9..ce6f396 100755 --- a/read +++ b/read @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/replay b/replay index a0917b9..ce6f396 100755 --- a/replay +++ b/replay @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/responsegen b/responsegen index a0917b9..ce6f396 100755 --- a/responsegen +++ b/responsegen @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/scheduler b/scheduler index a0917b9..ce6f396 100755 --- a/scheduler +++ b/scheduler @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/services b/services index a0917b9..ce6f396 100755 --- a/services +++ b/services @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/shell b/shell index 3554a1e..3c1aad8 100755 --- a/shell +++ b/shell @@ -1,9 +1,10 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import code -code.InteractiveConsole().interact() + import code + code.InteractiveConsole().interact() \ No newline at end of file diff --git a/struct b/struct index a0917b9..ce6f396 100755 --- a/struct +++ b/struct @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/trafficgen b/trafficgen index a0917b9..ce6f396 100755 --- a/trafficgen +++ b/trafficgen @@ -1,10 +1,11 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) -name = os.path.basename(__file__) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) + name = os.path.basename(__file__) -import sys -sys.path.append(path) + import sys + sys.path.append(path) -import runpy -runpy.run_module(f"bemani.utils.{name}", run_name="__main__") + import runpy + runpy.run_module(f"bemani.utils.{name}", run_name="__main__") \ No newline at end of file diff --git a/verifylibs b/verifylibs index 28164a0..f366b8f 100755 --- a/verifylibs +++ b/verifylibs @@ -1,16 +1,17 @@ #! /usr/bin/env python3 -import os -path = os.path.abspath(os.path.dirname(__file__)) +if __name__ == "__main__": + import os + path = os.path.abspath(os.path.dirname(__file__)) -import sys -sys.path.append(path) -sys.argv = [ - sys.argv[0], - "discover", - "-s", - os.path.join(path, "bemani/tests"), - *sys.argv[1:], -] + import sys + sys.path.append(path) + sys.argv = [ + sys.argv[0], + "discover", + "-s", + os.path.join(path, "bemani/tests"), + *sys.argv[1:], + ] -import runpy -runpy.run_module("unittest", run_name="__main__") + import runpy + runpy.run_module("unittest", run_name="__main__") \ No newline at end of file