import.py: use pathlib and support Windows

This commit is contained in:
linsui 2021-06-08 18:33:22 +08:00
parent 7ddcbb3e80
commit d6eece6395
6 changed files with 175 additions and 153 deletions

View file

@ -1,20 +1,21 @@
# workaround the syntax error from: import fdroidserver.import
import inspect
import os
import sys
from pathlib import Path
localmodule = os.path.realpath(
os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..'))
print('localmodule: ' + localmodule)
localmodule = Path(__file__).resolve().parent.parent
print('localmodule: ' + str(localmodule))
if localmodule not in sys.path:
sys.path.insert(0, localmodule)
sys.path.insert(0, str(localmodule))
class Options:
def __init__(self):
self.rev = None
self.subdir = None
module = __import__('fdroidserver.import')
for name, obj in inspect.getmembers(module):
if name == 'import':