From c15e85e713f1d6a1df1a6e5b9dbe1086fea67e61 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 8 Sep 2021 10:06:46 +0300 Subject: [PATCH] pkg-config wrapper: use pathlib instead of strings --- deps/system/bin/pkg-config | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/deps/system/bin/pkg-config b/deps/system/bin/pkg-config index 1a2335ed..6a8b52fc 100755 --- a/deps/system/bin/pkg-config +++ b/deps/system/bin/pkg-config @@ -19,6 +19,7 @@ # import os +from pathlib import Path import shlex import subprocess import sys @@ -31,16 +32,16 @@ def _main(): cmdline = ' '.join(map(shlex.quote, args)) log.write(f'% pkg-config {cmdline}\n') - bin_path = os.path.dirname(os.path.abspath(__file__)) + os.sep - prefix_path = os.path.abspath(bin_path + os.pardir) - config_path = prefix_path + '/lib/pkgconfig' + bin_path = Path(__file__).parent + prefix_path = bin_path.parent + config_path = prefix_path / 'lib/pkgconfig' environment = os.environ - environment['PKG_CONFIG_PATH'] = config_path + environment['PKG_CONFIG_PATH'] = str(config_path) predefined_args = [ - bin_path + 'pkg-config.exe', - '--define-variable=prefix=' + prefix_path, + f'{bin_path}/pkg-config.exe', + f'--define-variable=prefix={prefix_path}', '--static' ] args = predefined_args + args