~ubuntu-branches/ubuntu/quantal/enigmail/quantal-security

« back to all changes in this revision

Viewing changes to config/expandlibs_gen.py

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2013-09-13 16:02:15 UTC
  • mfrom: (0.12.16)
  • Revision ID: package-import@ubuntu.com-20130913160215-u3g8nmwa0pdwagwc
Tags: 2:1.5.2-0ubuntu0.12.10.1
* New upstream release v1.5.2 for Thunderbird 24

* Build enigmail using a stripped down Thunderbird 17 build system, as it's
  now quite difficult to build the way we were doing previously, with the
  latest Firefox build system
* Add debian/patches/no_libxpcom.patch - Don't link against libxpcom, as it
  doesn't exist anymore (but exists in the build system)
* Add debian/patches/use_sdk.patch - Use the SDK version of xpt.py and
  friends
* Drop debian/patches/ipc-pipe_rename.diff (not needed anymore)
* Drop debian/patches/makefile_depth.diff (not needed anymore)

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
 
'''Given a list of object files and library names, prints a library
6
 
descriptor to standard output'''
7
 
 
8
 
from __future__ import with_statement
9
 
import sys
10
 
import os
11
 
import expandlibs_config as conf
12
 
from expandlibs import LibDescriptor, isObject, ensureParentDir, ExpandLibsDeps
13
 
from optparse import OptionParser
14
 
 
15
 
def generate(args):
16
 
    desc = LibDescriptor()
17
 
    for arg in args:
18
 
        if isObject(arg):
19
 
            if os.path.exists(arg):
20
 
                desc['OBJS'].append(os.path.abspath(arg))
21
 
            else:
22
 
                raise Exception("File not found: %s" % arg)
23
 
        elif os.path.splitext(arg)[1] == conf.LIB_SUFFIX:
24
 
            if os.path.exists(arg) or os.path.exists(arg + conf.LIBS_DESC_SUFFIX):
25
 
                desc['LIBS'].append(os.path.abspath(arg))
26
 
            else:
27
 
                raise Exception("File not found: %s" % arg)
28
 
    return desc
29
 
 
30
 
if __name__ == '__main__':
31
 
    parser = OptionParser()
32
 
    parser.add_option("--depend", dest="depend", metavar="FILE",
33
 
        help="generate dependencies for the given execution and store it in the given file")
34
 
    parser.add_option("-o", dest="output", metavar="FILE",
35
 
        help="send output to the given file")
36
 
 
37
 
    (options, args) = parser.parse_args()
38
 
    if not options.output:
39
 
        raise Exception("Missing option: -o")
40
 
 
41
 
    ensureParentDir(options.output)
42
 
    with open(options.output, 'w') as outfile:
43
 
        print >>outfile, generate(args)
44
 
    if options.depend:
45
 
        ensureParentDir(options.depend)
46
 
        with open(options.depend, 'w') as depfile:
47
 
            depfile.write("%s : %s\n" % (options.output, ' '.join(ExpandLibsDeps(args))))