+2024-03-23 Collin Funk <collin.funk1@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 69.
+ Follow gnulib-tool change
+ 2012-08-19 Bruno Haible <bruno@clisp.org>
+ gnulib-tool: Remove old file names from .cvsignore, .gitignore.
+ * pygnulib/GLImport.py (GLImport._update_ignorelist_): Add
+ gnulib-comp.m4 to the added file list.
+ (GLImport.execute): Remove unused variables. Use sets to match the
+ 'join' invocations in gnulib-tool.sh.
+
2024-03-22 Collin Funk <collin.funk1@gmail.com>
gnulib-tool.py: Don't remove newlines in testdir's Automake snippets.
--------------------------------------------------------------------------------
-commit 9bdf6c8a0cdeb13c12e4b65dee9538c5468dbe1d
-Author: Bruno Haible <bruno@clisp.org>
-Date: Sun Aug 19 14:06:50 2012 +0200
-
- gnulib-tool: Remove old file names from .cvsignore, .gitignore.
-
- * gnulib-tool (func_update_ignorelist): Don't use 'join -v 1' command
- on the list of removed files.
-
---------------------------------------------------------------------------------
-
================================================================================
'''GLImport._update_ignorelist_(directory, ignore, dirs_added, dirs_removed)
Update .gitignore or .cvsignore files.'''
- result = ''
destdir = self.config['destdir']
if ignore == '.gitignore':
anchor = '/'
if dirs_added or dirs_removed:
with codecs.open(joinpath(destdir, srcpath), 'rb', 'UTF-8') as file:
srcdata = file.read()
- dirs_ignore = sorted(set(srcdata.split('\n')))
- dirs_ignore = [ line
- for line in dirs_ignore
- if line.strip() ]
- srcdata = lines_to_multiline(sorted(set(dirs_ignore)))
- dirs_ignore += [ d
- for d in dirs_added
- if d not in dirs_ignore ]
- dirs_ignore = [ d
- for d in dirs_ignore
- if d in dirs_removed ]
+ dirs_ignore = { filename
+ if not filename.startswith(anchor) else filename[len(anchor):]
+ for filename in srcdata.split('\n')
+ if filename.strip() }
+ srcdata = lines_to_multiline(sorted(dirs_ignore))
dirs_ignore = [ '%s%s' % (anchor, d)
- for d in dirs_ignore ]
- dirs_ignore = sorted(set(dirs_ignore))
- destdata = lines_to_multiline(sorted(set(dirs_ignore)))
+ for d in set(dirs_added).difference(dirs_ignore) ]
+ destdata = lines_to_multiline(sorted(dirs_ignore))
if srcdata != destdata:
if not self.config['dryrun']:
print('Updating %s (backup in %s)' % (srcpath, backupname))
copyfile2(joinpath(destdir, srcpath), joinpath(destdir, backupname))
- result = ''
with codecs.open(joinpath(destdir, srcpath), 'ab', 'UTF-8') as file:
file.write(destdata)
else: # if self.config['dryrun']
if vc_files != False:
# Update the .cvsignore and .gitignore files.
ignorelist = list()
+ # Treat gnulib-comp.m4 like an added file, even if it already existed.
+ filetable['added'] += [joinpath(m4base, 'gnulib-comp.m4')]
filetable['added'] = sorted(set(filetable['added']))
filetable['removed'] = sorted(set(filetable['added']))
for file in filetable['added']: