[gtk-doc/win-no-msys: 30/37] buildsystems/autotools/meson.build: Don't use UNIXy commands




commit 063d485d0285e4eb4d093f7a3af3d0eb4559881f
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Apr 14 11:14:47 2020 +0800

    buildsystems/autotools/meson.build: Don't use UNIXy commands
    
    Replace 'cp' and 'sed' with python equivilants, so that we do not need to worry
    about the underlying platform.

 buildsystems/autotools/meson.build | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/buildsystems/autotools/meson.build b/buildsystems/autotools/meson.build
index 17bbcbd..88d0a76 100644
--- a/buildsystems/autotools/meson.build
+++ b/buildsystems/autotools/meson.build
@@ -15,6 +15,15 @@ foreach mode : ['', 'no-xslt']
     flat = nested + '-flat'
   endif
 
+  replace_string_cmd = '''
+import fileinput
+import sys
+
+with open(sys.argv[1], 'r') as f:
+    for l in f:
+        print(l.replace('EXTRA_DIST =', 'EXTRA_DIST +='), end='')
+'''
+
   custom_target(
     'gtk-doc' + flat + '.make',
     input: 'gtk-doc' + nested + '.make',
@@ -23,9 +32,8 @@ foreach mode : ['', 'no-xslt']
     install_dir: pkgdatadir,
     capture: true,
     command: [
-      'sed',
-      '-e',
-      's/EXTRA_DIST =/EXTRA_DIST +=/',
+      python3, '-c',
+      replace_string_cmd,
       '@INPUT@',
     ]
   )
@@ -36,6 +44,13 @@ foreach mode : ['', 'no-xslt']
   )
 endforeach
 
+copy_file_cmd = '''
+import shutil
+import sys
+
+shutil.copyfile(sys.argv[1], sys.argv[2])
+'''
+
 custom_target(
   'gtk-doc.m4',
   input: 'gtk-doc.m4',
@@ -43,8 +58,8 @@ custom_target(
   install: true,
   install_dir: autoconfdatadir,
   command: [
-    'cp',
-    '-f',
+    python3, '-c',
+    copy_file_cmd,
     '@INPUT@',
     '@OUTPUT@',
   ],


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]