gnome.gtkdoc: Allow passing file objects as xml_files
If we pass a source files() object, we will look for it in the build directory, which is wrong. If we pass a build files() object (from configure_file()), we will find it in the build directory, and then try to copy it on top of itself in gtkdochelper.py getting a SameFileError. Add a test for it, and also properly iterate custom target outputs when adding to content files.
This commit is contained in:
parent
c5865c50c4
commit
c1f275bfa6
|
@ -793,11 +793,13 @@ This will become a hard error in the future.''')
|
|||
s = s.held_object
|
||||
if isinstance(s, (build.CustomTarget, build.CustomTargetIndex)):
|
||||
depends.append(s)
|
||||
content_files.append(os.path.join(state.environment.get_build_dir(),
|
||||
state.backend.get_target_dir(s),
|
||||
s.get_outputs()[0]))
|
||||
for o in s.get_outputs():
|
||||
content_files.append(os.path.join(state.environment.get_build_dir(),
|
||||
state.backend.get_target_dir(s),
|
||||
o))
|
||||
elif isinstance(s, mesonlib.File):
|
||||
content_files.append(os.path.join(state.environment.get_build_dir(), s.subdir, s.fname))
|
||||
content_files.append(s.absolute_path(state.environment.get_source_dir(),
|
||||
state.environment.get_build_dir()))
|
||||
elif isinstance(s, build.GeneratedList):
|
||||
depends.append(s)
|
||||
for gen_src in s.get_outputs():
|
||||
|
|
|
@ -93,9 +93,12 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,
|
|||
|
||||
# Copy files to build directory
|
||||
for f in content_files:
|
||||
f_abs = os.path.join(doc_src, f)
|
||||
shutil.copyfile(f_abs, os.path.join(
|
||||
abs_out, os.path.basename(f_abs)))
|
||||
# FIXME: Use mesonlib.File objects so we don't need to do this
|
||||
if not os.path.isabs(f):
|
||||
f = os.path.join(doc_src, f)
|
||||
elif os.path.commonpath([f, build_root]) == build_root:
|
||||
continue
|
||||
shutil.copyfile(f, os.path.join(abs_out, os.path.basename(f)))
|
||||
|
||||
shutil.rmtree(htmldir, ignore_errors=True)
|
||||
try:
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
cdata = configuration_data()
|
||||
cdata.set('VERSION', '1.0')
|
||||
configure_file(input : 'version.xml.in',
|
||||
output : 'version.xml',
|
||||
configuration : cdata)
|
||||
version_xml = configure_file(input : 'version.xml.in',
|
||||
output : 'version.xml',
|
||||
configuration : cdata)
|
||||
|
||||
gnome.gtkdoc('foobar',
|
||||
version_xml,
|
||||
src_dir : inc,
|
||||
main_sgml : 'foobar-docs.sgml',
|
||||
content_files : docbook,
|
||||
|
|
Loading…
Reference in New Issue