Skip to content

Commit f446930

Browse files
committed
[Meson] Add the file install_modules.py
1 parent 18ea09d commit f446930

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

install_modules.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env python3
2+
# Initially proposed by Sebastian Ehlert (@awvwgk)
3+
from os import environ, listdir, makedirs, walk
4+
from os.path import join, isdir, exists
5+
from sys import argv
6+
from shutil import copy
7+
8+
build_dir = environ["MESON_BUILD_ROOT"]
9+
if "MESON_INSTALL_DESTDIR_PREFIX" in environ:
10+
install_dir = environ["MESON_INSTALL_DESTDIR_PREFIX"]
11+
else:
12+
install_dir = environ["MESON_INSTALL_PREFIX"]
13+
14+
include_dir = "modules"
15+
module_dir = join(install_dir, include_dir)
16+
17+
modules = []
18+
# finds $build_dir/**/*.mod and $build_dir/**/*.smod
19+
for root, dirs, files in walk(build_dir):
20+
modules += [join(root, f) for f in files if f.endswith(".mod") or f.endswith(".smod")]
21+
22+
if not exists(module_dir):
23+
makedirs(module_dir)
24+
25+
for mod in modules:
26+
print("Installing", mod, "to", module_dir)
27+
copy(mod, module_dir)

0 commit comments

Comments
 (0)