This adds support for Files, CustomTarget, Indexs of CustomTargets, ConfigureFiles, ExternalPrograms, and Executables. Fixes: #1234 Fixes: #3552 Fixes: #6175pull/7060/head
parent
cd566d2bd5
commit
2c0eaf5c4f
10 changed files with 174 additions and 18 deletions
@ -0,0 +1,19 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import argparse |
||||
import os |
||||
|
||||
|
||||
def main() -> None: |
||||
parser = argparse.ArgumentParser() |
||||
parser.add_argument('dirname') |
||||
args = parser.parse_args() |
||||
|
||||
with open(os.path.join(args.dirname, '1.txt'), 'w') as f: |
||||
f.write('') |
||||
with open(os.path.join(args.dirname, '2.txt'), 'w') as f: |
||||
f.write('') |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main() |
@ -1,12 +1,31 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import argparse |
||||
import os |
||||
import sys |
||||
import shutil |
||||
|
||||
prefix = os.environ['MESON_INSTALL_DESTDIR_PREFIX'] |
||||
|
||||
dirname = os.path.join(prefix, sys.argv[1]) |
||||
|
||||
os.makedirs(dirname) |
||||
with open(os.path.join(dirname, sys.argv[2]), 'w') as f: |
||||
f.write('') |
||||
def main() -> None: |
||||
parser = argparse.ArgumentParser() |
||||
parser.add_argument('dirname') |
||||
parser.add_argument('files', nargs='+') |
||||
parser.add_argument('--mode', action='store', default='create', choices=['create', 'copy']) |
||||
args = parser.parse_args() |
||||
|
||||
dirname = os.path.join(prefix, args.dirname) |
||||
if not os.path.exists(dirname): |
||||
os.makedirs(dirname) |
||||
|
||||
if args.mode == 'create': |
||||
for name in args.files: |
||||
with open(os.path.join(dirname, name), 'w') as f: |
||||
f.write('') |
||||
else: |
||||
for name in args.files: |
||||
shutil.copy(name, dirname) |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
main() |
||||
|
@ -0,0 +1,24 @@ |
||||
#include <stdio.h> |
||||
#include <stdlib.h> |
||||
#include <string.h> |
||||
|
||||
int main(int argc, char * argv[]) { |
||||
if (argc != 2) { |
||||
fprintf(stderr, "Takes exactly 2 arguments\n"); |
||||
return 1; |
||||
} |
||||
|
||||
char * dirname = getenv("MESON_INSTALL_DESTDIR_PREFIX"); |
||||
char * fullname = malloc(strlen(dirname) + 1 + strlen(argv[1]) + 1); |
||||
strcpy(fullname, dirname); |
||||
strcat(fullname, "/"); |
||||
strcat(fullname, argv[1]); |
||||
|
||||
FILE * fp = fopen(fullname, "w"); |
||||
fputs("Some text\n", fp); |
||||
fclose(fp); |
||||
|
||||
free(fullname); |
||||
|
||||
return 0; |
||||
} |
@ -1 +1,5 @@ |
||||
meson.add_install_script('myinstall.py', 'this/does', 'something-different.dat') |
||||
|
||||
afile = files('a file.txt') |
||||
|
||||
exe = executable('exe', 'exe.c', install : false, native : true) |
||||
|
@ -0,0 +1,6 @@ |
||||
#!/usr/bin/env python3 |
||||
|
||||
import subprocess |
||||
import sys |
||||
|
||||
subprocess.run(sys.argv[1:]) |
Loading…
Reference in new issue