Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / build / mac / tweak_info_plist.py
index 0f65e4a..2057bac 100755 (executable)
@@ -29,7 +29,7 @@ import subprocess
 import sys
 import tempfile
 
-TOP = os.path.join(env['SRCROOT'], '..')
+TOP = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
 
 
 def _GetOutput(args):
@@ -76,7 +76,7 @@ def _AddVersionKeys(plist, version=None):
 
   else:
     # Pull in the Chrome version number.
-    VERSION_TOOL = os.path.join(TOP, 'chrome/tools/build/version.py')
+    VERSION_TOOL = os.path.join(TOP, 'build/util/version.py')
     VERSION_FILE = os.path.join(TOP, 'chrome/VERSION')
 
     (stdout, retval1) = _GetOutput([VERSION_TOOL, '-f', VERSION_FILE, '-t',
@@ -114,7 +114,7 @@ def _DoSCMKeys(plist, add_keys):
   scm_revision = None
   if add_keys:
     # Pull in the Chrome revision number.
-    VERSION_TOOL = os.path.join(TOP, 'chrome/tools/build/version.py')
+    VERSION_TOOL = os.path.join(TOP, 'build/util/version.py')
     LASTCHANGE_FILE = os.path.join(TOP, 'build/util/LASTCHANGE')
     (stdout, retval) = _GetOutput([VERSION_TOOL, '-f', LASTCHANGE_FILE, '-t',
                                   '@LASTCHANGE@'])
@@ -132,54 +132,6 @@ def _DoSCMKeys(plist, add_keys):
   return True
 
 
-def _DoPDFKeys(plist, add_keys):
-  """Adds PDF support to the document types list. If add_keys is True, it will
-  add the type information dictionary. If it is False, it will remove it if
-  present."""
-
-  PDF_FILE_EXTENSION = 'pdf'
-
-  def __AddPDFKeys(sub_plist):
-    """Writes the keys into a sub-dictionary of the plist."""
-    sub_plist['CFBundleTypeExtensions'] = [PDF_FILE_EXTENSION]
-    sub_plist['CFBundleTypeIconFile'] = 'document.icns'
-    sub_plist['CFBundleTypeMIMETypes'] = 'application/pdf'
-    sub_plist['CFBundleTypeName'] = 'PDF Document'
-    sub_plist['CFBundleTypeRole'] = 'Viewer'
-
-  DOCUMENT_TYPES_KEY = 'CFBundleDocumentTypes'
-
-  # First get the list of document types, creating it if necessary.
-  try:
-    extensions = plist[DOCUMENT_TYPES_KEY]
-  except KeyError:
-    # If this plist doesn't have a type dictionary, create one if set to add the
-    # keys. If not, bail.
-    if not add_keys:
-      return
-    extensions = plist[DOCUMENT_TYPES_KEY] = []
-
-  # Loop over each entry in the list, looking for one that handles PDF types.
-  for i, ext in enumerate(extensions):
-    # If an entry for .pdf files is found...
-    if 'CFBundleTypeExtensions' not in ext:
-      continue
-    if PDF_FILE_EXTENSION in ext['CFBundleTypeExtensions']:
-      if add_keys:
-        # Overwrite the existing keys with new ones.
-        __AddPDFKeys(ext)
-      else:
-        # Otherwise, delete the entry entirely.
-        del extensions[i]
-      return
-
-  # No PDF entry exists. If one needs to be added, do so now.
-  if add_keys:
-    pdf_entry = {}
-    __AddPDFKeys(pdf_entry)
-    extensions.append(pdf_entry)
-
-
 def _AddBreakpadKeys(plist, branding):
   """Adds the Breakpad keys. This must be called AFTER _AddVersionKeys() and
   also requires the |branding| argument."""
@@ -259,8 +211,6 @@ def Main(argv):
       type='int', default=False, help='Enable Keystone [1 or 0]')
   parser.add_option('--scm', dest='add_scm_info', action='store', type='int',
       default=True, help='Add SCM metadata [1 or 0]')
-  parser.add_option('--pdf', dest='add_pdf_support', action='store', type='int',
-      default=False, help='Add PDF file handler support [1 or 0]')
   parser.add_option('--branding', dest='branding', action='store',
       type='string', default=None, help='The branding of the binary')
   parser.add_option('--bundle_id', dest='bundle_identifier',
@@ -314,9 +264,6 @@ def Main(argv):
   if not _DoSCMKeys(plist, options.add_scm_info):
     return 3
 
-  # Adds or removes the PDF file handler entry.
-  _DoPDFKeys(plist, options.add_pdf_support)
-
   # Now that all keys have been mutated, rewrite the file.
   temp_info_plist = tempfile.NamedTemporaryFile()
   plistlib.writePlist(plist, temp_info_plist.name)