aboutsummaryrefslogtreecommitdiffstats
path: root/examples/utils
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-03-23 08:46:34 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-03-23 10:02:37 +0100
commit401d8c212b1d394b05cfd7f5db05062a07604150 (patch)
tree8e5645e8ec5e8f1464d880f68859264ba9c439ec /examples/utils
parent570cc14c50782ed46393a0a6a8d9d491fbb3785a (diff)
Replace .format() in examples by f-strings
As a drive by, fix the chartthemes example to work. Task-number: PYSIDE-1112 Change-Id: I35deeba69f2db2c8c0848cce7316fb621b1b5818 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/utils')
-rw-r--r--examples/utils/pyside_config.py26
1 files changed, 15 insertions, 11 deletions
diff --git a/examples/utils/pyside_config.py b/examples/utils/pyside_config.py
index 6382185c5..523879c12 100644
--- a/examples/utils/pyside_config.py
+++ b/examples/utils/pyside_config.py
@@ -122,7 +122,7 @@ options.append(("--pyside-shared-libraries-cmake",
options_usage = ''
for i, (flag, _, _, description) in enumerate(options):
- options_usage += ' {:<45} {}'.format(flag, description)
+ options_usage += f' {flag:<45} {description}'
if i < len(options) - 1:
options_usage += '\n'
@@ -250,20 +250,24 @@ def python_link_flags_qmake():
for d in libdir.split("\\"):
if " " in d:
libdir = libdir.replace(d, d.split(" ")[0][:-1]+"~1")
- return '-L{} -l{}'.format(libdir, flags['lib'])
+ lib_flags = flags['lib']
+ return f'-L{libdir} -l{lib_flags}'
elif sys.platform == 'darwin':
- return '-L{} -l{}'.format(flags['libdir'], flags['lib'])
-
+ libdir = flags['libdir']
+ lib_flags = flags['lib']
+ return f'-L{libdir} -l{lib_flags}'
else:
# Linux and anything else
- return '-L{} -l{}'.format(flags['libdir'], flags['lib'])
+ libdir = flags['libdir']
+ lib_flags = flags['lib']
+ return f'-L{libdir} -l{lib_flags}'
def python_link_flags_cmake():
flags = python_link_data()
libdir = flags['libdir']
lib = re.sub(r'.dll$', '.lib', flags['lib'])
- return '{};{}'.format(libdir, lib)
+ return f'{libdir};{lib}'
def python_link_data():
@@ -279,14 +283,14 @@ def python_link_data():
flags['libdir'] = libdir
if sys.platform == 'win32':
suffix = '_d' if is_debug() else ''
- flags['lib'] = 'python{}{}'.format(version_no_dots, suffix)
+ flags['lib'] = f'python{version_no_dots}{suffix}'
elif sys.platform == 'darwin':
- flags['lib'] = 'python{}'.format(version)
+ flags['lib'] = f'python{version}'
# Linux and anything else
else:
- flags['lib'] = 'python{}{}'.format(version, sys.abiflags)
+ flags['lib'] = f'python{version}{sys.abiflags}'
return flags
@@ -306,7 +310,7 @@ def get_package_qmake_lflags(which_package):
if package_path is None:
return None
- link = "-L{}".format(package_path)
+ link = f"-L{package_path}"
glob_result = glob.glob(os.path.join(package_path, shared_library_glob_pattern()))
for lib in filter_shared_libraries(glob_result):
link += ' '
@@ -367,5 +371,5 @@ for argument, handler, error, _ in options:
line = handler_result
if print_all:
- line = "{:<40}: ".format(argument) + line
+ line = f"{argument:<40}: {line}"
print(line)