~ubuntu-branches/ubuntu/precise/enigmail/precise-security

« back to all changes in this revision

Viewing changes to util/buildlist.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2014-01-30 11:42:56 UTC
  • mfrom: (0.12.17)
  • Revision ID: package-import@ubuntu.com-20140130114256-6yvx7ylu1cwrhwp2
Tags: 2:1.7-0ubuntu0.12.04.1
* New upstream release v1.7 to support Thunderbird 31

* No longer requires a Mozilla build system, so we use the upstream
  tarball directly now
  - update debian/rules
  - drop libgtk2.0-dev, libidl-dev, libdbus-glib-1-dev, libnotify-dev,
    libasound2-dev, libxt-dev, autoconf2.13 and mesa-common-dev
    build-depends, as these were only there because we were using a hacked
    Mozilla build system
* Update to source format 3.0
* Drop thunderbird-dev build-depend - the only binary code in enigmail now
  uses ctypes, so we don't need the SDK
* Drop debian/patches/no_libxpcom.patch - it doesn't build a binary component
  now
* Drop debian/patches/use_sdk.patch - there's no dependency on the
  Thunderbird SDK now

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# This Source Code Form is subject to the terms of the Mozilla Public
 
2
# License, v. 2.0. If a copy of the MPL was not distributed with this
 
3
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
4
 
 
5
'''A generic script to add entries to a file 
 
6
if the entry does not already exist.
 
7
 
 
8
Usage: buildlist.py <filename> <entry> [<entry> ...]
 
9
'''
 
10
from __future__ import print_function
 
11
 
 
12
import sys
 
13
import os
 
14
from utils import lockFile
 
15
 
 
16
def addEntriesToListFile(listFile, entries):
 
17
  """Given a file |listFile| containing one entry per line,
 
18
  add each entry in |entries| to the file, unless it is already
 
19
  present."""
 
20
  lock = lockFile(listFile + ".lck")
 
21
  try:
 
22
    if os.path.exists(listFile):
 
23
      f = open(listFile)
 
24
      existing = set(x.strip() for x in f.readlines())
 
25
      f.close()
 
26
    else:
 
27
      existing = set()
 
28
    f = open(listFile, 'a')
 
29
    for e in entries:
 
30
      if e not in existing:
 
31
        f.write("{0}\n".format(e))
 
32
        existing.add(e)
 
33
    f.close()
 
34
  finally:
 
35
    lock = None
 
36
 
 
37
if __name__ == '__main__':
 
38
  if len(sys.argv) < 3:
 
39
    print("Usage: buildlist.py <list file> <entry> [<entry> ...]",
 
40
          file=sys.stderr)
 
41
    sys.exit(1)
 
42
  addEntriesToListFile(sys.argv[1], sys.argv[2:])