code: def _parse_app_spec(src_dir):
      
      if not os.path.isdir(src_dir):
          parser.error("%s is not a directory" % src_dir)
      if not os.path.exists(os.path.join(src_dir, "dxapp.json")):
          raise dxpy.app_builder.AppBuilderException("Directory %s does not contain dxapp.json: not a valid DNAnexus app source directory" % src_dir)
      with open(os.path.join(src_dir, "dxapp.json")) as app_desc:
          try:
              return json_load_raise_on_duplicates(app_desc)
          except Exception as e:
              raise dxpy.app_builder.AppBuilderException("Could not parse dxapp.json file as JSON: " + str(e.args))
docs: Returns the parsed contents of dxapp.json.
  
      Raises either AppBuilderException or a parser error (exit codes 3 or
      2 respectively) if this cannot be done.