Skip to content

Commit

Permalink
add workaround for multiprocessing
Browse files Browse the repository at this point in the history
  • Loading branch information
hiaselhans committed Jul 10, 2021
1 parent 9ccd051 commit 1fe5a30
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions stubs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sys
import os
import shutil
import multiprocessing

import mypy.stubgen


Expand All @@ -12,21 +14,24 @@
"""

stubgen_path = "."
if len(sys.argv) > 1:
stubgen_path = sys.argv[1]
if __name__ == '__main__':
multiprocessing.freeze_support()

stubgen_path = "."
if len(sys.argv) > 1:
stubgen_path = sys.argv[1]

sys.path.append(stubgen_path)
sys.path.append(stubgen_path)

opts = mypy.stubgen.parse_options([])
opts.packages.append("euklid")
opts.output_dir = stubgen_path
opts = mypy.stubgen.parse_options([])
opts.packages.append("euklid")
opts.output_dir = stubgen_path


mypy.stubgen.generate_stubs(opts)
mypy.stubgen.generate_stubs(opts)


with open(os.path.join(stubgen_path, "euklid", "__init__.pyi"), "w") as outfile:
outfile.write(stub_index)
with open(os.path.join(stubgen_path, "euklid", "__init__.pyi"), "w") as outfile:
outfile.write(stub_index)

shutil.move(os.path.join(stubgen_path, "euklid"), os.path.join(stubgen_path, "euklid-stubs"))
shutil.move(os.path.join(stubgen_path, "euklid"), os.path.join(stubgen_path, "euklid-stubs"))

0 comments on commit 1fe5a30

Please sign in to comment.