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



commit f20b086921df53bab917545c630f45bd2c360973
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 c39d3fb..a8e66e2 100644
--- a/buildsystems/autotools/meson.build
+++ b/buildsystems/autotools/meson.build
@@ -6,6 +6,15 @@ configure_file(
   install_dir: bindir,
 )
 
+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.make',
@@ -14,13 +23,19 @@ custom_target(
   install_dir: pkgdatadir,
   capture: true,
   command: [
-    'sed',
-    '-e',
-    's/EXTRA_DIST =/EXTRA_DIST +=/',
+    python3, '-c',
+    replace_string_cmd,
     '@INPUT@',
   ]
 )
 
+copy_file_cmd = '''
+import shutil
+import sys
+
+shutil.copyfile(sys.argv[1], sys.argv[2])
+'''
+
 custom_target(
   'gtk-doc.m4',
   input: 'gtk-doc.m4',
@@ -28,8 +43,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]