make flashtool.pyz run again

This commit is contained in:
andreas 2023-11-05 19:43:05 +01:00
parent 247f96e2ba
commit 9b955d135d
2 changed files with 7 additions and 3 deletions

Binary file not shown.

View File

@ -24,16 +24,17 @@ class MyFinder(importlib.abc.MetaPathFinder):
self.dir=basedir self.dir=basedir
self.debug=debug self.debug=debug
def find_spec(self,fullname, path, target=None): def find_spec(self,fullname, path, target=None):
if self.debug:
print("F:fullname=%s"%fullname)
if fullname == self.pkg: if fullname == self.pkg:
if self.debug: if self.debug:
print("F:matching %s"%fullname) print("F:matching %s(%s)"%(fullname,self.dir))
spec=importlib.util.spec_from_file_location(fullname, self.dir,loader=MyLoader(), submodule_search_locations=[self.dir]) spec=importlib.util.spec_from_file_location(fullname, self.dir,loader=MyLoader(), submodule_search_locations=[self.dir])
if self.debug: if self.debug:
print("F:injecting:",spec) print("F:injecting:",spec)
return spec return spec
sys.meta_path.insert(0,MyFinder('flashtool')) sys.meta_path.insert(0,MyFinder('flashtool'))
try: try:
import serial import serial
except ImportError: except ImportError:
@ -48,6 +49,9 @@ import tkinter.font as tkFont
import os import os
import serial.tools.list_ports import serial.tools.list_ports
from tkinter import filedialog as FileDialog from tkinter import filedialog as FileDialog
try:
from flasher import Flasher
except:
from flashtool.flasher import Flasher from flashtool.flasher import Flasher