changeset 38831:1c17bd7a9bd1

gnulib-tool.py: follow gnulib-tool changes, part 9 Follow gnulib-tool change 2014-09-05 Mathieu Anquetin <mathieu@anquetin.eu> Fallback to wget when rsync of PO files fails.
author Bruno Haible <bruno@clisp.org>
date Sat, 09 Sep 2017 01:26:20 +0200
parents 2a923a32c235
children 3701883dffe1
files pygnulib/GLImport.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/pygnulib/GLImport.py	Sat Sep 09 01:16:46 2017 +0200
+++ b/pygnulib/GLImport.py	Sat Sep 09 01:26:20 2017 +0200
@@ -1204,16 +1204,15 @@
             if not self.config['dryrun']:
                 print('Fetching gnulib PO files from %s' % TP_URL)
                 os.chdir(joinpath(destdir, pobase))
-                cmd = 'if type rsync 2>/dev/null | grep / > /dev/null; '
-                cmd += 'then echo 1; else echo 0; fi'
-                result = sp.check_output(cmd, shell=True)
-                result = bool(int(result))
-                if result:  # use rsync
+                cmd = 'type rsync 2>/dev/null | grep / > /dev/null'
+                result = sp.call(cmd, shell=True)
+                if result == 0:  # use rsync
                     args = ['rsync', '-Lrtz', '%sgnulib/' % TP_RSYNC_URI, '.']
-                else:  # use wget
+                    result = sp.call(args, shell=True)
+                if result != 0:  # use wget
                     args = ['wget', '--no-verbose', '-r', '-l1', '-nd', '-np', '-A.po',
                             '%sgnulib/' % TP_URL]
-                sp.call(args, shell=True)
+                    sp.call(args, shell=True)
             else:  # if self.config['dryrun']
                 print('Fetch gnulib PO files from %s' % TP_URL)