~ubuntu-branches/ubuntu/precise/lightning-extension/precise

« back to all changes in this revision

Viewing changes to mozilla/build/automation.py.in

  • Committer: Package Import Robot
  • Author(s): Chris Coulson
  • Date: 2012-02-07 12:00:41 UTC
  • mfrom: (1.1.16)
  • Revision ID: package-import@ubuntu.com-20120207120041-qo3fapzsweii9cra
Tags: 1.3~b1+build1-0ubuntu1
* New upstream release from the beta channel (CALENDAR_1_3b1_BUILD1)
* Drop 02_fix_system_libxul_build.patch - this is fixed upstream
* Add mozilla/mfbt to tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
import threading
53
53
import tempfile
54
54
import sqlite3
55
 
import zipfile
56
55
 
57
56
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
58
57
sys.path.insert(0, SCRIPT_DIR)
98
97
_log.addHandler(handler)
99
98
 
100
99
 
101
 
class ZipFileReader(object):
102
 
  """
103
 
  Class to read zip files in Python 2.5 and later. Limited to only what we
104
 
  actually use.
105
 
  """
106
 
 
107
 
  def __init__(self, filename):
108
 
    self._zipfile = zipfile.ZipFile(filename, "r")
109
 
 
110
 
  def __del__(self):
111
 
    self._zipfile.close()
112
 
 
113
 
  def _getnormalizedpath(self, path):
114
 
    """
115
 
    Gets a normalized path from 'path' (or the current working directory if
116
 
    'path' is None). Also asserts that the path exists.
117
 
    """
118
 
    if path is None:
119
 
      path = os.curdir
120
 
    path = os.path.normpath(os.path.expanduser(path))
121
 
    assert os.path.isdir(path)
122
 
    return path
123
 
 
124
 
  def _extractname(self, name, path):
125
 
    """
126
 
    Extracts a file with the given name from the zip file to the given path.
127
 
    Also creates any directories needed along the way.
128
 
    """
129
 
    filename = os.path.normpath(os.path.join(path, name))
130
 
    if name.endswith("/"):
131
 
      os.makedirs(filename)
132
 
    else:
133
 
      path = os.path.split(filename)[0]
134
 
      if not os.path.isdir(path):
135
 
        os.makedirs(path)
136
 
      with open(filename, "wb") as dest:
137
 
        dest.write(self._zipfile.read(name))
138
 
 
139
 
  def namelist(self):
140
 
    return self._zipfile.namelist()
141
 
 
142
 
  def read(self, name):
143
 
    return self._zipfile.read(name)
144
 
 
145
 
  def extract(self, name, path = None):
146
 
    if hasattr(self._zipfile, "extract"):
147
 
      return self._zipfile.extract(name, path)
148
 
 
149
 
    # This will throw if name is not part of the zip file.
150
 
    self._zipfile.getinfo(name)
151
 
 
152
 
    self._extractname(name, self._getnormalizedpath(path))
153
 
 
154
 
  def extractall(self, path = None):
155
 
    if hasattr(self._zipfile, "extractall"):
156
 
      return self._zipfile.extractall(path)
157
 
 
158
 
    path = self._getnormalizedpath(path)
159
 
 
160
 
    for name in self._zipfile.namelist():
161
 
      self._extractname(name, path)
162
 
 
163
 
 
164
100
#################
165
101
# PROFILE SETUP #
166
102
#################
404
340
user_pref("dom.allow_scripts_to_close_windows", true);
405
341
user_pref("dom.disable_open_during_load", false);
406
342
user_pref("dom.max_script_run_time", 0); // no slow script dialogs
 
343
user_pref("hangmonitor.timeout", 0); // no hang monitor
407
344
user_pref("dom.max_chrome_script_run_time", 0);
408
345
user_pref("dom.popup_maximum", -1);
409
346
user_pref("dom.send_after_paint_to_content", true);
418
355
user_pref("devtools.errorconsole.enabled", true);
419
356
user_pref("layout.debug.enable_data_xbl", true);
420
357
user_pref("browser.EULA.override", true);
 
358
user_pref("javascript.options.jit_hardening", true);
421
359
user_pref("gfx.color_management.force_srgb", true);
422
360
user_pref("network.manage-offline-status", false);
423
361
user_pref("test.mousescroll", true);
429
367
user_pref("browser.panorama.experienced_first_run", true); // Assume experienced
430
368
user_pref("dom.w3c_touch_events.enabled", true);
431
369
user_pref("toolkit.telemetry.prompted", 2);
 
370
// Existing tests assume there is no font size inflation.
 
371
user_pref("font.size.inflation.emPerLine", 0);
 
372
user_pref("font.size.inflation.minTwips", 0);
432
373
 
433
374
// Only load extensions from the application and user profile
434
375
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION
1058
999
      os.makedirs(extensionsRootDir)
1059
1000
 
1060
1001
    if os.path.isfile(extensionSource):
1061
 
      reader = ZipFileReader(extensionSource)
 
1002
      reader = automationutils.ZipFileReader(extensionSource)
1062
1003
 
1063
1004
      for filename in reader.namelist():
1064
1005
        # Sanity check the zip file.