/usr/lib/python2.7/dist-packages/breathe/process.py is in python-breathe 4.4.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | from __future__ import unicode_literals
try:
from shlex import quote # py3
except ImportError:
from pipes import quote # py2
AUTOCFG_TEMPLATE = r"""
PROJECT_NAME = "{project_name}"
OUTPUT_DIRECTORY = {output_dir}
GENERATE_LATEX = NO
GENERATE_MAN = NO
GENERATE_RTF = NO
CASE_SENSE_NAMES = NO
INPUT = {input}
ENABLE_PREPROCESSING = YES
QUIET = YES
JAVADOC_AUTOBRIEF = YES
JAVADOC_AUTOBRIEF = NO
GENERATE_HTML = NO
GENERATE_XML = YES
ALIASES = "rst=\verbatim embed:rst"
ALIASES += "endrst=\endverbatim"
{extra}
""".strip()
class ProjectData(object):
"Simple handler for the files and project_info for each project"
def __init__(self, auto_project_info, files):
self.auto_project_info = auto_project_info
self.files = files
class AutoDoxygenProcessHandle(object):
def __init__(self, path_handler, run_process, write_file, project_info_factory):
self.path_handler = path_handler
self.run_process = run_process
self.write_file = write_file
self.project_info_factory = project_info_factory
def generate_xml(self, projects_source, doxygen_options):
project_files = {}
# First collect together all the files which need to be doxygen processed for each project
for project_name, file_structure in projects_source.items():
folder = file_structure[0]
contents = file_structure[1]
auto_project_info = self.project_info_factory.create_auto_project_info(
project_name, folder)
project_files[project_name] = ProjectData(auto_project_info, contents)
# Iterate over the projects and generate doxygen xml output for the files for each one into
# a directory in the Sphinx build area
for project_name, data in project_files.items():
project_path = self.process(data.auto_project_info, data.files, doxygen_options)
project_info = data.auto_project_info.create_project_info(project_path)
self.project_info_factory.store_project_info_for_auto(project_name, project_info)
def process(self, auto_project_info, files, doxygen_options):
name = auto_project_info.name()
cfgfile = "%s.cfg" % name
full_paths = map(lambda x: auto_project_info.abs_path_to_source_file(x), files)
cfg = AUTOCFG_TEMPLATE.format(
project_name=name,
output_dir=name,
input=" ".join(full_paths),
extra='\n'.join("%s=%s" % pair for pair in doxygen_options.items())
)
build_dir = self.path_handler.join(
auto_project_info.build_dir(),
"breathe",
"doxygen"
)
self.write_file(build_dir, cfgfile, cfg)
# Shell-escape the cfg file name to try to avoid any issue where the name might include
# malicious shell character - We have to use the shell=True option to make it work on
# Windows. See issue #271
self.run_process('doxygen %s' % quote(cfgfile), cwd=build_dir, shell=True)
return self.path_handler.join(build_dir, name, "xml")
|