author Brian Birtles <>
Thu, 16 Feb 2012 08:40:46 +0900
changeset 89836 03ff5cb466daba5aac03c37ae6fde63f64d80f8a
parent 35724 83b704c74e5f0004b7fd629a4fed31d421110bf0
child 98529 f4157e8c410708d76703f19e4dfb61859bfe32d8
permissions -rw-r--r--
Bug 629200 part 25 - Remove unnecessary serialisation from setting SVGStringList; r=jwatt

# Version: MPL 1.1/GPL 2.0/LGPL 2.1
# for the specific language governing rights and limitations under the
# License.
# The Original Code is Mozilla build system.
# The Initial Developer of the Original Code is
# Mozilla Foundation.
# the Initial Developer. All Rights Reserved.
# Contributor(s):
#  Ted Mielczarek <>
# decision by deleting the provisiwons above and replace them with the notice

'''A generic script to add entries to a file 
if the entry does not already exist.

Usage: <filename> <entry> [<entry> ...]

import sys
import os
from utils import lockFile

def addEntriesToListFile(listFile, entries):
  """Given a file |listFile| containing one entry per line,
  add each entry in |entries| to the file, unless it is already
  lock = lockFile(listFile + ".lck")
    if os.path.exists(listFile):
      f = open(listFile)
      existing = set([x.strip() for x in f.readlines()])
      existing = set()
    f = open(listFile, 'a')
    for e in entries:
      if e not in existing:
        f.write("%s\n" % e)
    lock = None

if __name__ == '__main__':
  if len(sys.argv) < 3:
    print >>sys.stderr, "Usage: <list file> <entry> [<entry> ...]"
  addEntriesToListFile(sys.argv[1], sys.argv[2:])