Ejemplo n.º 1
0
 def test_extraction(self):
   try:
     generate.extract()
   except RuntimeError:
     print('*****************************************************************')
     print('If this test fails, you have most likely introduced an unsealed')
     print('module. Make sure to use remove_undocumented or similar utilities')
     print('to avoid leaking symbols. See below for more information on the')
     print('failure.')
     print('*****************************************************************')
     raise
Ejemplo n.º 2
0
 def test_extraction(self):
   try:
     generate.extract()
   except RuntimeError:
     print('*****************************************************************')
     print('If this test fails, you have most likely introduced an unsealed')
     print('module. Make sure to use remove_undocumented or similar utilities')
     print('to avoid leaking symbols. See below for more information on the')
     print('failure.')
     print('*****************************************************************')
     raise
Ejemplo n.º 3
0
def _main(input_dir, output_dir):
    """Convert all the files in `input_dir` and write results to `output_dir`."""
    visitor = generate.extract()

    # Make output_dir.
    try:
        if not os.path.exists(output_dir):
            os.makedirs(output_dir)
    except OSError as e:
        print('Creating output dir "%s" failed: %s' % (output_dir, e))
        raise

    # How to get from api_guides/python/ to api_docs/python/
    relative_path_to_root = '../../api_docs/python/'

    # Iterate through all the source files and process them.
    for full_path, base_name in _md_files_in_dir(input_dir):
        print('Processing %s...' % base_name)
        md_string = open(full_path).read()
        output = parser.replace_references(md_string, relative_path_to_root,
                                           visitor.duplicate_of)
        open(os.path.join(output_dir, base_name), 'w').write(output)
    print('Done.')
Ejemplo n.º 4
0
def _main(input_dir, output_dir):
  """Convert all the files in `input_dir` and write results to `output_dir`."""
  visitor = generate.extract()

  # Make output_dir.
  try:
    if not os.path.exists(output_dir):
      os.makedirs(output_dir)
  except OSError as e:
    print('Creating output dir "%s" failed: %s' % (output_dir, e))
    raise

  # How to get from api_guides/python/ to api_docs/python/
  relative_path_to_root = '../../api_docs/python/'

  # Iterate through all the source files and process them.
  for full_path, base_name in _md_files_in_dir(input_dir):
    print('Processing %s...' % base_name)
    md_string = open(full_path).read()
    output = parser.replace_references(
        md_string, relative_path_to_root, visitor.duplicate_of)
    open(os.path.join(output_dir, base_name), 'w').write(output)
  print('Done.')