original_docstring:  Creates a Firefox XPI file, based on the various platform
      version files. 
docstring: Creates a Firefox XPI file, based on the various platform
  version files.
docstring_tokens: Creates a Firefox XPI file based on the various platform version files .
code: def makeXpiFile():
      """ Creates a Firefox XPI file, based on the various platform
      version files. """
  
      if not options.host_url:
          print("Cannot generate xpi file without --host-url.")
          sys.exit(1)
  
      print("Generating xpi file")
      root = options.plugin_root
      if os.path.isdir(os.path.join(root, 'plugin')):
          root = os.path.join(root, 'plugin')
  
      xpi = zipfile.ZipFile('nppanda3d.xpi', 'w')
  
      package_id = 'runtime@panda3d.org' #TODO: maybe more customizable?
  
      tempFile = tempfile.mktemp('.txt', 'p3d_')
      rdf = open(tempFile, 'w')
      rdf.write(install_rdf % {
          'package_id' : package_id,
          'version' : options.version,
          'host_url' : options.host_url,
          })
      rdf.close()
      xpi.write(tempFile, 'install.rdf')
      os.unlink(tempFile)
  
      subdirs = os.listdir(root)
      for subdir in subdirs:
          platform = FirefoxPlatformMap.get(subdir, None)
          path = os.path.join(root, subdir)
          if platform and os.path.isdir(path):
              if subdir in ['win32', 'osx_i386']:
                  pluginsXpiDir = 'plugins'
              else:
                  # Create the XPI directory platform/<platform name>/plugins
                  pluginsXpiDir = 'platform/%s/plugins' % (platform)
  
              # Copy the Firefox plugin into this directory.
              if subdir.startswith('win32'):
                  pluginFilename = 'nppanda3d.dll'
              elif subdir.startswith('osx'):
                  pluginFilename = 'nppanda3d.plugin'
              else:
                  pluginFilename = 'nppanda3d.so'
  
              addZipTree(xpi, os.path.join(path, pluginFilename),
                         pluginsXpiDir + '/' + pluginFilename)
      xpi.close()
  
      # Now that we've generated the xpi file, get its hash.
      data = open('nppanda3d.xpi', 'rb').read()
      xpi_hash = sha(data).hexdigest()
  
      # And now we can generate the update.rdf file.
      update = open('update.rdf', 'w')
      update.write(update_rdf % {
          'package_id' : package_id,
          'version' : options.version,
          'host_url' : options.host_url,
          'xpi_hash' : xpi_hash,
          })
      update.close()
code_tokens: def makeXpiFile ( ) : if not options . host_url : print ( "Cannot generate xpi file without --host-url." ) sys . exit ( 1 ) print ( "Generating xpi file" ) root = options . plugin_root if os . path . isdir ( os . path . join ( root , 'plugin' ) ) : root = os . path . join ( root , 'plugin' ) xpi = zipfile . ZipFile ( 'nppanda3d.xpi' , 'w' ) package_id = 'runtime@panda3d.org' tempFile = tempfile . mktemp ( '.txt' , 'p3d_' ) rdf = open ( tempFile , 'w' ) rdf . write ( install_rdf % { 'package_id' : package_id , 'version' : options . version , 'host_url' : options . host_url , } ) rdf . close ( ) xpi . write ( tempFile , 'install.rdf' ) os . unlink ( tempFile ) subdirs = os . listdir ( root ) for subdir in subdirs : platform = FirefoxPlatformMap . get ( subdir , None ) path = os . path . join ( root , subdir ) if platform and os . path . isdir ( path ) : if subdir in [ 'win32' , 'osx_i386' ] : pluginsXpiDir = 'plugins' else : pluginsXpiDir = 'platform/%s/plugins' % ( platform ) if subdir . startswith ( 'win32' ) : pluginFilename = 'nppanda3d.dll' elif subdir . startswith ( 'osx' ) : pluginFilename = 'nppanda3d.plugin' else : pluginFilename = 'nppanda3d.so' addZipTree ( xpi , os . path . join ( path , pluginFilename ) , pluginsXpiDir + '/' + pluginFilename ) xpi . close ( ) data = open ( 'nppanda3d.xpi' , 'rb' ) . read ( ) xpi_hash = sha ( data ) . hexdigest ( ) update = open ( 'update.rdf' , 'w' ) update . write ( update_rdf % { 'package_id' : package_id , 'version' : options . version , 'host_url' : options . host_url , 'xpi_hash' : xpi_hash , } ) update . close ( )
short_docstring: Creates a Firefox XPI file, based on the various platform
  version files.
short_docstring_tokens: Creates a Firefox XPI file based on the various platform version files .
comment: """ Creates a Firefox XPI file, based on the various platform
      version files. """$SEP$#TODO: maybe more customizable?$SEP$# Create the XPI directory platform/<platform name>/plugins$SEP$# Copy the Firefox plugin into this directory.$SEP$# Now that we've generated the xpi file, get its hash.$SEP$# And now we can generate the update.rdf file.