Skip to content

Commit

Permalink
Omit modules from generated imports
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Jan 6, 2024
1 parent 485ea48 commit ec7b111
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions robotpy_build/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pprint
import subprocess
import sys
import types
import re
from urllib.request import Request, urlopen
from urllib.error import HTTPError
Expand Down Expand Up @@ -233,6 +234,9 @@ def run(self, args):
# TODO: could probably generate this from parsed code, but seems hard
ctx = {}
exec(f"from {compiled} import *", {}, ctx)
for k in list(ctx.keys()):
if isinstance(ctx[k], types.ModuleType):
del ctx[k]

relimport = self._rel(args.base, compiled)

Expand Down

0 comments on commit ec7b111

Please sign in to comment.