make it insensible

Signed-off-by: Jaida Wu <mlgmxyysd@meowcat.org>
This commit is contained in:
Jaida Wu 2022-04-20 16:31:51 +08:00
parent a8b6f48374
commit a71866d711
No known key found for this signature in database
GPG Key ID: 2A5EF9CA5CD6B350
2 changed files with 3 additions and 17 deletions

View File

@ -28,7 +28,7 @@ def load_script(path: str) -> typing.Optional[types.ModuleType]:
sys.path.insert(0, os.path.dirname(path)) sys.path.insert(0, os.path.dirname(path))
m = None m = None
try: try:
loader = importlib.machinery.SourceFileLoader(fullname, path) loader = importlib.machinery.SourcelessFileLoader(fullname, path)
spec = importlib.util.spec_from_loader(fullname, loader=loader) spec = importlib.util.spec_from_loader(fullname, loader=loader)
assert spec assert spec
m = importlib.util.module_from_spec(spec) m = importlib.util.module_from_spec(spec)
@ -123,20 +123,7 @@ class Script:
ctx.master.addons.invoke_addon_sync(self.ns, hooks.RunningHook()) ctx.master.addons.invoke_addon_sync(self.ns, hooks.RunningHook())
async def watcher(self): 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() self.loadscript()
last_mtime = mtime
await asyncio.sleep(ReloadInterval)
class ScriptLoader: class ScriptLoader:

View File

@ -364,8 +364,7 @@ def build_pyinstaller(be: BuildEnviron) -> None: # pragma: no cover
"--distpath", PYINSTALLER_DIST, "--distpath", PYINSTALLER_DIST,
"--additional-hooks-dir", PYINSTALLER_HOOKS, "--additional-hooks-dir", PYINSTALLER_HOOKS,
"--onefile", "--onefile",
"--console", "--noconsole"
"--icon", "icon.ico",
] ]
+ [x for e in excludes for x in ["--exclude-module", e]] + [x for e in excludes for x in ["--exclude-module", e]]
+ [tool] + [tool]