mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1365722 - Move application.ini processing out to a separate file; r=cmanchester+432261
Windows repackaging for complete mar files will also need to pull a different value out of the application.ini file, so this code should be shareable. MozReview-Commit-ID: CzCoNRYcBPX --HG-- extra : rebase_source : a5e4b31ba876d811436a7d8d15462fa85f0762f8
This commit is contained in:
parent
14106ca069
commit
ca4aa9a838
21
python/mozbuild/mozbuild/repackaging/application_ini.py
Normal file
21
python/mozbuild/mozbuild/repackaging/application_ini.py
Normal file
@ -0,0 +1,21 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import os
|
||||
import ConfigParser
|
||||
import mozpack.path as mozpath
|
||||
|
||||
def get_application_ini_value(application_directory, section, value):
|
||||
rc = None
|
||||
for root, dirs, files in os.walk(application_directory):
|
||||
if 'application.ini' in files:
|
||||
parser = ConfigParser.ConfigParser()
|
||||
parser.read(mozpath.join(root, 'application.ini'))
|
||||
rc = parser.get(section, value)
|
||||
break
|
||||
|
||||
if rc is None:
|
||||
raise Exception("Input package does not contain an application.ini file")
|
||||
|
||||
return rc
|
@ -6,9 +6,9 @@ import os
|
||||
import tempfile
|
||||
import tarfile
|
||||
import shutil
|
||||
import ConfigParser
|
||||
import mozpack.path as mozpath
|
||||
from mozpack.dmg import create_dmg
|
||||
from application_ini import get_application_ini_value
|
||||
|
||||
def repackage_dmg(infile, output):
|
||||
|
||||
@ -28,17 +28,7 @@ def repackage_dmg(infile, output):
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
|
||||
# Grab the volume name
|
||||
volume_name = None
|
||||
for root, dirs, files in os.walk(tmpdir):
|
||||
if 'application.ini' in files:
|
||||
parser = ConfigParser.ConfigParser()
|
||||
parser.read(mozpath.join(root, 'application.ini'))
|
||||
volume_name = parser.get('App', 'CodeName')
|
||||
break
|
||||
|
||||
if volume_name is None:
|
||||
raise Exception("Input package does not contain an application.ini file")
|
||||
volume_name = get_application_ini_value(tmpdir, 'App', 'CodeName')
|
||||
|
||||
# The extra_files argument is empty [] because they are already a part
|
||||
# of the original dmg produced by the build, and they remain in the
|
||||
|
Loading…
Reference in New Issue
Block a user