diff options
author | Eli Schwartz <eschwartz@archlinux.org> | 2023-04-17 00:55:15 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz@archlinux.org> | 2023-05-02 19:28:35 -0400 |
commit | 877d5ea8e02c13bb606969d33d0491cfd4e08275 (patch) | |
tree | 92e53a128407d95872359edbbd8af498b1fa9d9c /mesonbuild/scripts/pycompile.py | |
parent | 6a1427401c76db73081e478c4ff49fcc75420de6 (diff) | |
download | meson-877d5ea8e02c13bb606969d33d0491cfd4e08275.zip meson-877d5ea8e02c13bb606969d33d0491cfd4e08275.tar.gz meson-877d5ea8e02c13bb606969d33d0491cfd4e08275.tar.bz2 |
bytecompile: switch to handling destdir in the script launcher env
Diffstat (limited to 'mesonbuild/scripts/pycompile.py')
-rw-r--r-- | mesonbuild/scripts/pycompile.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/mesonbuild/scripts/pycompile.py b/mesonbuild/scripts/pycompile.py index da92655..b236a1c 100644 --- a/mesonbuild/scripts/pycompile.py +++ b/mesonbuild/scripts/pycompile.py @@ -20,28 +20,26 @@ import json, os, subprocess, sys from compileall import compile_file -destdir = os.environ.get('DESTDIR') quiet = int(os.environ.get('MESON_INSTALL_QUIET', 0)) -def destdir_join(d1, d2): - if not d1: - return d2 - # c:\destdir + c:\prefix must produce c:\destdir\prefix - parts = os.path.splitdrive(d2) - return d1 + parts[1] - def compileall(files): for f in files: - if destdir is not None: + # f is prefixed by {py_xxxxlib}, both variants are 12 chars + # the key is the middle 10 chars of the prefix + key = f[1:11].upper() + f = f[12:] + + ddir = None + fullpath = os.environ['MESON_INSTALL_DESTDIR_'+key] + f + f = os.environ['MESON_INSTALL_'+key] + f + + if fullpath != f: ddir = os.path.dirname(f) - fullpath = destdir_join(destdir, f) - else: - ddir = None - fullpath = f if os.path.isdir(fullpath): for root, _, files in os.walk(fullpath): - ddir = os.path.dirname(os.path.splitdrive(f)[0] + root[len(destdir):]) + if ddir is not None: + ddir = root.replace(fullpath, f, 1) for dirf in files: if dirf.endswith('.py'): fullpath = os.path.join(root, dirf) |