From 69251d051ae267e66f0f83e748ce7265230ee6db Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Mon, 25 Feb 2019 07:09:35 +0200 Subject: [PATCH 1/3] build: Use python3 for the post install script While *some* systems alias python to python3 nowdays, this is not true for eveything. Especially systems that can potentially offer both python2 and python3. According to both PEP 394 and PEP 441 its recommended to always add the 3 in the shebang. --- build-aux/meson/post-install.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-aux/meson/post-install.py b/build-aux/meson/post-install.py index f84b1971f5..b66961c02b 100644 --- a/build-aux/meson/post-install.py +++ b/build-aux/meson/post-install.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys From efbb26b8cb5dcf07eba386e1939651ee33b05784 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Wed, 27 Feb 2019 00:51:55 +0200 Subject: [PATCH 2/3] build: no need to replace path separators Python APIs accept both `\` and `/` as path separators. --- build-aux/meson/post-install.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build-aux/meson/post-install.py b/build-aux/meson/post-install.py index b66961c02b..d61873c551 100644 --- a/build-aux/meson/post-install.py +++ b/build-aux/meson/post-install.py @@ -7,8 +7,8 @@ import subprocess if 'DESTDIR' not in os.environ: gtk_api_version = sys.argv[1] gtk_abi_version = sys.argv[2] - gtk_libdir = sys.argv[3].replace('/', os.sep) - gtk_datadir = sys.argv[4].replace('/', os.sep) + gtk_libdir = sys.argv[3] + gtk_datadir = sys.argv[4] gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version) gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends') From 539e3d387b91cd3600440ffd080735bb98e3a4f0 Mon Sep 17 00:00:00 2001 From: Jordan Petridis Date: Wed, 27 Feb 2019 00:55:08 +0200 Subject: [PATCH 3/3] build: use condense the mkdir calls to oneliners --- build-aux/meson/post-install.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/build-aux/meson/post-install.py b/build-aux/meson/post-install.py index d61873c551..d81abd28a4 100644 --- a/build-aux/meson/post-install.py +++ b/build-aux/meson/post-install.py @@ -23,11 +23,9 @@ if 'DESTDIR' not in os.environ: os.path.join(gtk_datadir, 'icons', 'hicolor')]) print('Updating module cache for print backends...') - if not os.path.isdir(gtk_printmodule_dir): - os.mkdir(gtk_printmodule_dir) + os.makedirs(gtk_printmodule_dir, exist_ok=True) subprocess.call(['gio-querymodules', gtk_printmodule_dir]) print('Updating module cache for input methods...') - if not os.path.isdir(gtk_immodule_dir): - os.mkdir(gtk_immodule_dir) + os.makedirs(gtk_immodule_dir, exist_ok=True) subprocess.call(['gio-querymodules', gtk_immodule_dir])