summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2021-04-16 19:10:25 +0200
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2021-04-16 19:10:25 +0200
commit5224ea90bb1a8811763f43d1d51e906a84181b71 (patch)
tree59d145433a1a7407fab96d0781d20f0c01e3527b
parent980d400b893f91a1ee3fc50a644bf301bd510ade (diff)
downloadmm-common-5224ea90bb1a8811763f43d1d51e906a84181b71.tar.gz
extra-install-cmd.py: Ignore FileNotFoundError
util/meson_aux/extra-install-cmd.py: Ignore FileNotFoundError. On Windows, subprocess.run() may fail to find aclocal even if the calling meson.build file has found it. Ignore this case. https://mail.gnome.org/archives/gtkmm-list/2021-April/msg00005.html
-rwxr-xr-xutil/meson_aux/extra-install-cmd.py41
1 files changed, 24 insertions, 17 deletions
diff --git a/util/meson_aux/extra-install-cmd.py b/util/meson_aux/extra-install-cmd.py
index 8414847..2b6d4e2 100755
--- a/util/meson_aux/extra-install-cmd.py
+++ b/util/meson_aux/extra-install-cmd.py
@@ -14,30 +14,37 @@ if not os.getenv('DESTDIR'):
# not known to aclocal will not be picked up automatically.
# (Starting with Python 3.7 text=True is a more understandable equivalent to
# universal_newlines=True. Let's use only features in Python 3.5.)
- result = subprocess.run(['aclocal', '--print-ac-dir'],
- stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
- universal_newlines=True)
- acdir = result.stdout
- aclocal_path = os.getenv('ACLOCAL_PATH')
- # acdir and aclocal_path can be sequences of os.pathsep-separated paths.
- # Merge them to one sequence with leading and trailing os.pathsep.
- # os.pathsep is ':' for Linux, ';' for Windows.
- acdirs = os.pathsep
- if aclocal_path:
- acdirs += aclocal_path + os.pathsep
- if acdir:
- acdirs += acdir + os.pathsep
+ try:
+ result = subprocess.run(['aclocal', '--print-ac-dir'],
+ stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
+ universal_newlines=True)
+ acdir = result.stdout
+ aclocal_path = os.getenv('ACLOCAL_PATH')
+ # acdir and aclocal_path can be sequences of os.pathsep-separated paths.
+ # Merge them to one sequence with leading and trailing os.pathsep.
+ # os.pathsep is ':' for Linux, ';' for Windows.
+ acdirs = os.pathsep
+ if aclocal_path:
+ acdirs += aclocal_path + os.pathsep
+ if acdir:
+ acdirs += acdir.rstrip('\n') + os.pathsep
- if (os.pathsep + sys.argv[1] + os.pathsep) not in acdirs:
- # f'''.....''' would require Python 3.6. Avoid it.
- print('''\
+ if (os.pathsep + sys.argv[1] + os.pathsep) not in acdirs:
+ # f'''.....''' would require Python 3.6. Avoid it.
+ print('''\
NOTE
----
+(If you don't intend to use Autotools, you can ignore this note.)
The mm-common Autoconf macro files have been installed in a different
directory than the system aclocal directory. In order for the installed
macros to be found, it may be necessary to add the mm-common include
path to the ACLOCAL_PATH environment variable:
ACLOCAL_PATH="$ACLOCAL_PATH:{}"
export ACLOCAL_PATH'''.format(sys.argv[1])
- )
+ )
+ except FileNotFoundError:
+ # https://mail.gnome.org/archives/gtkmm-list/2021-April/msg00005.html
+ # On Windows, subprocess.run() may fail to find aclocal even if
+ # the calling meson.build file has found it. Ignore this case.
+ pass
sys.exit(0)