all: start using pathlib
Change-Id: I2b0d6ff8f534382913414fa9b35150d6f697acb4 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/34463 Reviewed-by: Alexander Zaft <a.zaft@fz-juelich.de> Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de>
This commit is contained in:
@@ -352,7 +352,7 @@ def watch(*args, **kwds):
|
||||
|
||||
def close_node(online, state):
|
||||
if online and state != 'shutdown':
|
||||
return
|
||||
return None
|
||||
close_event.set()
|
||||
return UnregisterCallback
|
||||
|
||||
@@ -450,7 +450,7 @@ def run(filepath):
|
||||
"__file__": filepath,
|
||||
"__name__": "__main__",
|
||||
})
|
||||
with open(filepath, 'rb') as file:
|
||||
with filepath.open('rb') as file:
|
||||
# pylint: disable=exec-used
|
||||
exec(compile(file.read(), filepath, 'exec'), clientenv.namespace, None)
|
||||
|
||||
|
||||
@@ -21,15 +21,15 @@
|
||||
# *****************************************************************************
|
||||
|
||||
|
||||
from os import path
|
||||
from pathlib import Path
|
||||
|
||||
from frappy.gui.qt import QColor, uic
|
||||
|
||||
uipath = path.dirname(__file__)
|
||||
uipath = Path(__file__).parent
|
||||
|
||||
|
||||
def loadUi(widget, uiname, subdir='ui'):
|
||||
uic.loadUi(path.join(uipath, subdir, uiname), widget)
|
||||
uic.loadUi(uipath / subdir / uiname, widget)
|
||||
|
||||
|
||||
def is_light_theme(palette):
|
||||
|
||||
@@ -21,14 +21,13 @@
|
||||
#
|
||||
# *****************************************************************************
|
||||
|
||||
import os.path
|
||||
from pathlib import Path
|
||||
from subprocess import PIPE, Popen
|
||||
|
||||
__all__ = ['get_version']
|
||||
|
||||
RELEASE_VERSION_FILE = os.path.join(os.path.dirname(__file__),
|
||||
'RELEASE-VERSION')
|
||||
GIT_REPO = os.path.join(os.path.dirname(__file__), '..', '.git')
|
||||
RELEASE_VERSION_FILE = Path(__file__).parent / 'RELEASE-VERSION'
|
||||
GIT_REPO = (Path(__file__).parents[1] / '.git').resolve()
|
||||
|
||||
|
||||
def translate_version(ver):
|
||||
@@ -49,14 +48,14 @@ def get_git_version(abbrev=4):
|
||||
|
||||
def read_release_version():
|
||||
try:
|
||||
with open(RELEASE_VERSION_FILE, encoding='utf-8') as f:
|
||||
with RELEASE_VERSION_FILE.open(encoding='utf-8') as f:
|
||||
return f.readline().strip()
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
|
||||
def write_release_version(version):
|
||||
with open(RELEASE_VERSION_FILE, 'w', encoding='utf-8') as f:
|
||||
with RELEASE_VERSION_FILE.open('w', encoding='utf-8') as f:
|
||||
f.write(f'{version}\n')
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user