]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Finish implementing options --vc-files, --no-vc-files.
authorBruno Haible <bruno@clisp.org>
Sat, 6 Aug 2022 21:01:36 +0000 (23:01 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 6 Aug 2022 21:01:36 +0000 (23:01 +0200)
* gnulib-tool.py (main): Accept options --vc-files, --no-vc-files.
* pygnulib/GLImport.py (GLImport.__init__): Correct parsing of
gl_VC_FILES directive.
(GLImport.gnulib_cache): Don't treat the value False like None.
(GLImport.execute): Skip the .gitignore file manipulations if vc_files
is False.

ChangeLog
gnulib-tool.py
gnulib-tool.py.TODO
pygnulib/GLConfig.py
pygnulib/GLImport.py

index 00431039144fd20767bede8d0e230dff1739a9e9..29da7a3a6ef8b41bf171972f974c8c21b9e9c885 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2022-08-06  Bruno Haible  <bruno@clisp.org>
 
+       gnulib-tool.py: Finish implementing options --vc-files, --no-vc-files.
+       * gnulib-tool.py (main): Accept options --vc-files, --no-vc-files.
+       * pygnulib/GLImport.py (GLImport.__init__): Correct parsing of
+       gl_VC_FILES directive.
+       (GLImport.gnulib_cache): Don't treat the value False like None.
+       (GLImport.execute): Skip the .gitignore file manipulations if vc_files
+       is False.
+
        gnulib-tool.py: Finish implementing option --witness-c-macro.
        * gnulib-tool.py (main): Accept option --witness-c-macro.
        * pygnulib/GLConfig.py (GLConfig.__init__): Remove wrong type check of
index 0bf72bf3a0509d3305f32bffbc288ef57a6f9f33..bb763a224580abf92d03597c75889d721a0a63e7 100755 (executable)
@@ -363,6 +363,15 @@ def main():
                         dest='witness_c_macro',
                         default=None,
                         nargs=1)
+    # vc-files
+    parser.add_argument('--vc-files',
+                        dest='vc_files',
+                        default=None,
+                        action='store_true')
+    parser.add_argument('--no-vc-files',
+                        dest='vc_files',
+                        default=None,
+                        action='store_false')
     # single-configure
     parser.add_argument('--single-configure',
                         dest='single_configure',
@@ -553,7 +562,7 @@ def main():
                  or cmdargs.avoids != None or cmdargs.lgpl != None
                  or cmdargs.makefile_name != None
                  or cmdargs.macro_prefix != None or cmdargs.podomain != None
-                 or cmdargs.witness_c_macro != None))):
+                 or cmdargs.witness_c_macro != None or cmdargs.vc_files != None))):
         message = '%s: *** ' % constants.APP['name']
         message += 'invalid options for --%s mode\n' % mode
         message += 'Try \'gnulib-tool --help\' for more information.\n'
@@ -649,6 +658,7 @@ def main():
     witness_c_macro = cmdargs.witness_c_macro
     if witness_c_macro != None:
         witness_c_macro = witness_c_macro[0]
+    vc_files = cmdargs.vc_files
     avoids = cmdargs.avoids
     if avoids != None:
         avoids = [ module
@@ -659,7 +669,6 @@ def main():
     single_configure = cmdargs.single_configure
     docbase = None
     conddeps = None
-    vc_files = None
 
     # Create pygnulib configuration.
     config = classes.GLConfig(
index c37fcbeebfd3aff03b52e762bb81564a1f7bc127..53915662b8f82b0aef436dcb5552cfb99b043d94 100644 (file)
@@ -29,14 +29,14 @@ Implement the options:
   --gnu-make
   --tests-makefile-name
   --automake-subdir
-  --vc-files
-  --no-vc-files
   -h | --hardlink
   --local-hardlink
   -S | --more-symlinks
   -H | --more-hardlinks
   --help (same output)
 
+Remove exit() in GLImport.py.
+
 --------------------------------------------------------------------------------
 
 commit 76c7703cb2e9e0e803d1296618d8ab9e86e13d6c
index 5f30a80797b35051db6f1f5c8de0cfd3b9a0b165..216f2e05fa6ece3819374045fd7d4dc078fde19d 100644 (file)
@@ -276,7 +276,7 @@ class GLConfig(object):
             elif key in ['libtool', 'lgpl', 'conddeps', 'symbolic', 'lsymbolic',
                          'libtests', 'dryrun']:
                 return False
-            if key == 'vc_files':
+            elif key == 'vc_files':
                 return None
             elif key == 'errors':
                 return True
index 9de4b3b93cde1043674f1697e50fdd76aabfbaab..b06fc5b6036972dbc78b4984ea542967d11aa0bd 100644 (file)
@@ -141,9 +141,6 @@ class GLImport(object):
             if 'gl_CONDITIONAL_DEPENDENCIES' in data:
                 self.cache.setCondDeps(True)
                 data = data.replace('gl_CONDITIONAL_DEPENDENCIES', '')
-            if 'gl_VC_FILES' in data:
-                self.cache.setVCFiles(True)
-                data = data.replace('gl_VC_FILES', '')
             if 'gl_WITH_TESTS' in data:
                 self.cache.enableInclTestCategory(TESTS['tests'])
                 data = data.replace('gl_WITH_TESTS', '')
@@ -202,6 +199,8 @@ class GLImport(object):
                 self.cache.setPoDomain(cleaner(tempdict['gl_PO_DOMAIN']))
             if tempdict['gl_WITNESS_C_MACRO']:
                 self.cache.setWitnessCMacro(cleaner(tempdict['gl_WITNESS_C_MACRO']))
+            if tempdict['gl_VC_FILES']:
+                self.cache.setVCFiles(cleaner(tempdict['gl_VC_FILES']))
 
             # Get cached filelist from gnulib-comp.m4.
             destdir, m4base = self.config.getDestDir(), self.config.getM4Base()
@@ -542,7 +541,7 @@ class GLImport(object):
         emit += 'gl_MACRO_PREFIX([%s])\n' % macro_prefix
         emit += 'gl_PO_DOMAIN([%s])\n' % podomain
         emit += 'gl_WITNESS_C_MACRO([%s])\n' % witness_c_macro
-        if vc_files:
+        if vc_files != None:
             emit += 'gl_VC_FILES([%s])\n' % vc_files
         return constants.nlconvert(emit)
 
@@ -1334,33 +1333,34 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
             if isfile(tmpfile):
                 os.remove(tmpfile)
 
-        # Update the .cvsignore and .gitignore files.
-        ignorelist = list()
-        filetable['added'] = sorted(set(filetable['added']))
-        filetable['removed'] = sorted(set(filetable['added']))
-        for file in filetable['added']:
-            directory, basename = os.path.split(file)
-            ignorelist += [tuple([directory, '|A|', basename])]
-        for file in filetable['removed']:
-            directory, basename = os.path.split(file)
-            ignorelist += [tuple([directory, '|R|', basename])]
-        last_dir = ''
-        last_dirs_added = list()
-        last_dirs_removed = list()
-        for row in ignorelist:
-            next_dir = row[0]
-            operand = row[1]
-            filename = row[2]
-            if next_dir != last_dir:
-                self._done_dir_(last_dir, last_dirs_added, last_dirs_removed)
-                last_dir = next_dir
-                last_dirs_added = list()
-                last_dirs_removed = list()
-            if operand == '|A|':
-                last_dirs_added += [filename]
-            elif operand == '|R|':
-                last_dirs_removed += [filename]
-        self._done_dir_(last_dir, last_dirs_added, last_dirs_removed)
+        if vc_files != False:
+            # Update the .cvsignore and .gitignore files.
+            ignorelist = list()
+            filetable['added'] = sorted(set(filetable['added']))
+            filetable['removed'] = sorted(set(filetable['added']))
+            for file in filetable['added']:
+                directory, basename = os.path.split(file)
+                ignorelist += [tuple([directory, '|A|', basename])]
+            for file in filetable['removed']:
+                directory, basename = os.path.split(file)
+                ignorelist += [tuple([directory, '|R|', basename])]
+            last_dir = ''
+            last_dirs_added = list()
+            last_dirs_removed = list()
+            for row in ignorelist:
+                next_dir = row[0]
+                operand = row[1]
+                filename = row[2]
+                if next_dir != last_dir:
+                    self._done_dir_(last_dir, last_dirs_added, last_dirs_removed)
+                    last_dir = next_dir
+                    last_dirs_added = list()
+                    last_dirs_removed = list()
+                if operand == '|A|':
+                    last_dirs_added += [filename]
+                elif operand == '|R|':
+                    last_dirs_removed += [filename]
+            self._done_dir_(last_dir, last_dirs_added, last_dirs_removed)
         exit()
 
         # Finish the work.