diff --git a/mitmproxy/addons/script.py b/mitmproxy/addons/script.py index b09aefec9..0a4daa25e 100644 --- a/mitmproxy/addons/script.py +++ b/mitmproxy/addons/script.py @@ -28,7 +28,7 @@ def load_script(path: str) -> typing.Optional[types.ModuleType]: sys.path.insert(0, os.path.dirname(path)) m = None try: - loader = importlib.machinery.SourceFileLoader(fullname, path) + loader = importlib.machinery.SourcelessFileLoader(fullname, path) spec = importlib.util.spec_from_loader(fullname, loader=loader) assert spec m = importlib.util.module_from_spec(spec) @@ -123,20 +123,7 @@ class Script: ctx.master.addons.invoke_addon_sync(self.ns, hooks.RunningHook()) async def watcher(self): - last_mtime = 0 - while True: - try: - mtime = os.stat(self.fullpath).st_mtime - except FileNotFoundError: - ctx.log.info("Removing script %s" % self.path) - scripts = list(ctx.options.scripts) - scripts.remove(self.path) - ctx.options.update(scripts=scripts) - return - if mtime > last_mtime: - self.loadscript() - last_mtime = mtime - await asyncio.sleep(ReloadInterval) + self.loadscript() class ScriptLoader: diff --git a/release/cibuild.py b/release/cibuild.py index 13c7c5db7..3d1009cbf 100755 --- a/release/cibuild.py +++ b/release/cibuild.py @@ -364,8 +364,7 @@ def build_pyinstaller(be: BuildEnviron) -> None: # pragma: no cover "--distpath", PYINSTALLER_DIST, "--additional-hooks-dir", PYINSTALLER_HOOKS, "--onefile", - "--console", - "--icon", "icon.ico", + "--noconsole" ] + [x for e in excludes for x in ["--exclude-module", e]] + [tool]