Пример #1
0
  def finalizeJar(self, jarPath, chromebasepath, register,
                  doZip=True):
    '''Helper method to write out the chrome registration entries to
    jarfile.manifest or chrome.manifest, or both.

    The actual file processing is done in updateManifest.
    '''
    # rewrite the manifest, if entries given
    if not register:
      return

    chromeManifest = os.path.join(os.path.dirname(jarPath),
                                  '..', 'chrome.manifest')

    if self.useJarfileManifest:
      self.updateManifest(jarPath + '.manifest', chromebasepath % '',
                          register)
      addEntriesToListFile(chromeManifest, ['manifest chrome/%s.manifest' % (os.path.basename(jarPath),)])
    if self.useChromeManifest:
      self.updateManifest(chromeManifest, chromebasepath % 'chrome/',
                          register)

    # If requested, add a root chrome manifest entry (assumed to be in the parent directory
    # of chromeManifest) with the application specific id. In cases where we're building
    # lang packs, the root manifest must know about application sub directories.
    if self.rootManifestAppId:
      rootChromeManifest = os.path.join(os.path.normpath(os.path.dirname(chromeManifest)),
                                        '..', 'chrome.manifest')
      rootChromeManifest = os.path.normpath(rootChromeManifest)
      chromeDir = os.path.basename(os.path.dirname(os.path.normpath(chromeManifest)))
      logging.info("adding '%s' entry to root chrome manifest appid=%s" % (chromeDir, self.rootManifestAppId))
      addEntriesToListFile(rootChromeManifest, ['manifest %s/chrome.manifest application=%s' % (chromeDir, self.rootManifestAppId)])
Пример #2
0
  def finalizeJar(self, jarPath, chromebasepath, register,
                  doZip=True):
    '''Helper method to write out the chrome registration entries to
    jarfile.manifest or chrome.manifest, or both.

    The actual file processing is done in updateManifest.
    '''
    # rewrite the manifest, if entries given
    if not register:
      return

    chromeManifest = os.path.join(os.path.dirname(jarPath),
                                  '..', 'chrome.manifest')

    if self.useJarfileManifest:
      self.updateManifest(jarPath + '.manifest', chromebasepath.format(''),
                          register)
      addEntriesToListFile(chromeManifest, ['manifest chrome/{0}.manifest'
                                            .format(os.path.basename(jarPath))])
    if self.useChromeManifest:
      self.updateManifest(chromeManifest, chromebasepath.format('chrome/'),
                          register)

    # If requested, add a root chrome manifest entry (assumed to be in the parent directory
    # of chromeManifest) with the application specific id. In cases where we're building
    # lang packs, the root manifest must know about application sub directories.
    if self.rootManifestAppId:
      rootChromeManifest = os.path.join(os.path.normpath(os.path.dirname(chromeManifest)),
                                        '..', 'chrome.manifest')
      rootChromeManifest = os.path.normpath(rootChromeManifest)
      chromeDir = os.path.basename(os.path.dirname(os.path.normpath(chromeManifest)))
      logging.info("adding '%s' entry to root chrome manifest appid=%s" % (chromeDir, self.rootManifestAppId))
      addEntriesToListFile(rootChromeManifest, ['manifest %s/chrome.manifest application=%s' % (chromeDir, self.rootManifestAppId)])
Пример #3
0
 def test_add_multiple(self):
     """Test that attempting to add the same entry multiple times results in
 only one entry being added."""
     testfile = os.path.join(self.tmpdir, "test.list")
     addEntriesToListFile(testfile, ["a", "b", "a", "a", "b"])
     self.assertFileContains(testfile, ["a", "b"])
     addEntriesToListFile(testfile, ["c", "a", "c", "b", "c"])
     self.assertFileContains(testfile, ["a", "b", "c"])
 def test_add_multiple(self):
   """Test that attempting to add the same entry multiple times results in
   only one entry being added."""
   testfile = os.path.join(self.tmpdir, "test.list")
   addEntriesToListFile(testfile, ["a","b","a","a","b"])
   self.assertFileContains(testfile, ["a","b"])
   addEntriesToListFile(testfile, ["c","a","c","b","c"])
   self.assertFileContains(testfile, ["a","b","c"])
Пример #5
0
 def test_append_some(self):
     "Test adding new entries mixed with existing entries."
     testfile = os.path.join(self.tmpdir, "test.list")
     l = ["a", "b", "c"]
     addEntriesToListFile(testfile, l)
     self.assertFileContains(testfile, l)
     addEntriesToListFile(testfile, ["a", "x", "c", "z"])
     self.assertFileContains(testfile, ["a", "b", "c", "x", "z"])
 def test_append_some(self):
   "Test adding new entries mixed with existing entries."
   testfile = os.path.join(self.tmpdir, "test.list")
   l = ["a", "b", "c"]
   addEntriesToListFile(testfile, l)
   self.assertFileContains(testfile, l)
   addEntriesToListFile(testfile, ["a", "x", "c", "z"])
   self.assertFileContains(testfile, ["a", "b", "c", "x", "z"])
Пример #7
0
 def test_basic(self):
     "Test that addEntriesToListFile works when file doesn't exist."
     testfile = os.path.join(self.tmpdir, "test.list")
     l = ["a", "b", "c"]
     addEntriesToListFile(testfile, l)
     self.assertFileContains(testfile, l)
     # ensure that attempting to add the same entries again doesn't change it
     addEntriesToListFile(testfile, l)
     self.assertFileContains(testfile, l)
 def test_basic(self):
   "Test that addEntriesToListFile works when file doesn't exist."
   testfile = os.path.join(self.tmpdir, "test.list")
   l = ["a", "b", "c"]
   addEntriesToListFile(testfile, l)
   self.assertFileContains(testfile, l)
   # ensure that attempting to add the same entries again doesn't change it
   addEntriesToListFile(testfile, l)
   self.assertFileContains(testfile, l)
Пример #9
0
 def test_append(self):
     "Test adding new entries."
     testfile = os.path.join(self.tmpdir, "test.list")
     l = ["a", "b", "c"]
     addEntriesToListFile(testfile, l)
     self.assertFileContains(testfile, l)
     l2 = ["x", "y", "z"]
     addEntriesToListFile(testfile, l2)
     l.extend(l2)
     self.assertFileContains(testfile, l)
Пример #10
0
 def test_append(self):
   "Test adding new entries."
   testfile = os.path.join(self.tmpdir, "test.list")
   l = ["a", "b", "c"]
   addEntriesToListFile(testfile, l)
   self.assertFileContains(testfile, l)
   l2 = ["x","y","z"]
   addEntriesToListFile(testfile, l2)
   l.extend(l2)
   self.assertFileContains(testfile, l)
Пример #11
0
  def finalizeJar(self, jarPath, chromebasepath, register,
                  doZip=True):
    '''Helper method to write out the chrome registration entries to
    jarfile.manifest or chrome.manifest, or both.

    The actual file processing is done in updateManifest.
    '''
    # rewrite the manifest, if entries given
    if not register:
      return

    chromeManifest = os.path.join(os.path.dirname(jarPath),
                                  '..', 'chrome.manifest')

    if self.useJarfileManifest:
      self.updateManifest(jarPath + '.manifest', chromebasepath % '',
                          register)
      addEntriesToListFile(chromeManifest, ['manifest chrome/%s.manifest' % (os.path.basename(jarPath),)])
    if self.useChromeManifest:
      self.updateManifest(chromeManifest, chromebasepath % 'chrome/',
                          register)
Пример #12
0
  def finalizeJar(self, jarPath, chromebasepath, register,
                  doZip=True):
    '''Helper method to write out the chrome registration entries to
    jarfile.manifest or chrome.manifest, or both.

    The actual file processing is done in updateManifest.
    '''
    # rewrite the manifest, if entries given
    if not register:
      return

    chromeManifest = os.path.join(os.path.dirname(jarPath),
                                  '..', 'chrome.manifest')

    if self.useJarfileManifest:
      self.updateManifest(jarPath + '.manifest', chromebasepath % '',
                          register)
      addEntriesToListFile(chromeManifest, ['manifest chrome/%s.manifest' % (os.path.basename(jarPath),)])
    if self.useChromeManifest:
      self.updateManifest(chromeManifest, chromebasepath % 'chrome/',
                          register)