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

« back to all changes in this revision

Viewing changes to mozilla/build/link.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
from __future__ import with_statement
 
6
import os, subprocess, sys, threading, time
 
7
from win32 import procmem
 
8
 
 
9
def measure_vsize_threadfunc(proc, output_file):
 
10
    """
 
11
    Measure the virtual memory usage of |proc| at regular intervals
 
12
    until it exits, then print the maximum value and write it to
 
13
    |output_file|.
 
14
    """
 
15
    maxvsize = 0
 
16
    while proc.returncode is None:
 
17
        maxvsize, vsize = procmem.get_vmsize(proc._handle)
 
18
        time.sleep(0.5)
 
19
    print "TinderboxPrint: linker max vsize: %d" % maxvsize
 
20
    with open(output_file, "w") as f:
 
21
        f.write("%d\n" % maxvsize)
 
22
 
 
23
def measure_link_vsize(output_file, args):
 
24
    """
 
25
    Execute |args|, and measure the maximum virtual memory usage of the process,
 
26
    printing it to stdout when finished.
 
27
    """
 
28
    proc = subprocess.Popen(args)
 
29
    t = threading.Thread(target=measure_vsize_threadfunc,
 
30
                         args=(proc, output_file))
 
31
    t.start()
 
32
    # Wait for the linker to finish.
 
33
    exitcode = proc.wait()
 
34
    # ...and then wait for the background thread to finish.
 
35
    t.join()
 
36
    return exitcode
 
37
 
 
38
if __name__ == "__main__":
 
39
    if sys.platform != "win32":
 
40
        print >>sys.stderr, "link.py is only for use on Windows!"
 
41
        sys.exit(1)
 
42
    if len(sys.argv) < 3:
 
43
        print >>sys.stderr, "Usage: link.py <output filename> <commandline>"
 
44
        sys.exit(1)
 
45
    sys.exit(measure_link_vsize(sys.argv[1], sys.argv[2:]))