diff options
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | configure.ac | 2 | ||||
-rwxr-xr-x | gtkdoc-check.in | 6 | ||||
-rwxr-xr-x | gtkdoc-fixxref.in | 6 | ||||
-rwxr-xr-x | gtkdoc-mkdb.in | 6 | ||||
-rwxr-xr-x | gtkdoc-mkhtml.in | 6 | ||||
-rwxr-xr-x | gtkdoc-mkhtml2.in | 6 | ||||
-rwxr-xr-x | gtkdoc-mkman.in | 6 | ||||
-rwxr-xr-x | gtkdoc-mkpdf.in | 6 | ||||
-rwxr-xr-x | gtkdoc-rebase.in | 6 | ||||
-rwxr-xr-x | gtkdoc-scan.in | 6 | ||||
-rwxr-xr-x | gtkdoc-scangobj.in | 6 | ||||
-rw-r--r-- | gtkdoc/config.py | 27 | ||||
-rw-r--r-- | gtkdoc/config_data.py.in (renamed from gtkdoc/config.py.in) | 0 | ||||
-rw-r--r-- | gtkdoc/meson.build | 20 | ||||
-rw-r--r-- | gtkdoc/mkhtml.py | 17 | ||||
-rw-r--r-- | gtkdoc/mkhtml2.py | 17 | ||||
-rwxr-xr-x | gtkdoc/mkpdf.py | 8 | ||||
-rw-r--r-- | gtkdoc_uninstalled.py.in | 5 | ||||
-rw-r--r-- | meson.build | 16 |
20 files changed, 108 insertions, 65 deletions
diff --git a/Makefile.am b/Makefile.am index da9b828..d7c7dbb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,6 +37,7 @@ pylibdata_DATA = \ gtkdoc/check.py \ gtkdoc/common.py \ gtkdoc/config.py \ + gtkdoc/config_data.py \ gtkdoc/fixxref.py \ gtkdoc/highlight.py \ gtkdoc/md_to_db.py \ diff --git a/configure.ac b/configure.ac index 96515a4..f242c80 100644 --- a/configure.ac +++ b/configure.ac @@ -160,7 +160,7 @@ gtk-doc.pc buildsystems/autotools/Makefile buildsystems/cmake/Makefile buildsystems/cmake/GtkDocConfigVersion.cmake -gtkdoc/config.py +gtkdoc/config_data.py help/Makefile help/manual/Makefile tests/Makefile diff --git a/gtkdoc-check.in b/gtkdoc-check.in index 8c8e917..d9e2ad5 100755 --- a/gtkdoc-check.in +++ b/gtkdoc-check.in @@ -22,7 +22,11 @@ import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, check, config diff --git a/gtkdoc-fixxref.in b/gtkdoc-fixxref.in index 44f6bd1..3183fd2 100755 --- a/gtkdoc-fixxref.in +++ b/gtkdoc-fixxref.in @@ -23,7 +23,11 @@ import argparse import os import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, fixxref diff --git a/gtkdoc-mkdb.in b/gtkdoc-mkdb.in index 42d5731..641f3c4 100755 --- a/gtkdoc-mkdb.in +++ b/gtkdoc-mkdb.in @@ -24,7 +24,11 @@ from __future__ import print_function import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, mkdb diff --git a/gtkdoc-mkhtml.in b/gtkdoc-mkhtml.in index 0d0a15d..b09f7a9 100755 --- a/gtkdoc-mkhtml.in +++ b/gtkdoc-mkhtml.in @@ -24,7 +24,11 @@ import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, mkhtml diff --git a/gtkdoc-mkhtml2.in b/gtkdoc-mkhtml2.in index 76b357e..14fc3bc 100755 --- a/gtkdoc-mkhtml2.in +++ b/gtkdoc-mkhtml2.in @@ -21,7 +21,11 @@ import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, mkhtml2 diff --git a/gtkdoc-mkman.in b/gtkdoc-mkman.in index c5445cd..8f7b018 100755 --- a/gtkdoc-mkman.in +++ b/gtkdoc-mkman.in @@ -24,7 +24,11 @@ import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, mkman diff --git a/gtkdoc-mkpdf.in b/gtkdoc-mkpdf.in index e8c0c03..7dca4b0 100755 --- a/gtkdoc-mkpdf.in +++ b/gtkdoc-mkpdf.in @@ -22,7 +22,11 @@ import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, mkpdf diff --git a/gtkdoc-rebase.in b/gtkdoc-rebase.in index 17a71c2..e8b0bf5 100755 --- a/gtkdoc-rebase.in +++ b/gtkdoc-rebase.in @@ -23,7 +23,11 @@ import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, rebase diff --git a/gtkdoc-scan.in b/gtkdoc-scan.in index 954c811..7893ebc 100755 --- a/gtkdoc-scan.in +++ b/gtkdoc-scan.in @@ -24,7 +24,11 @@ from __future__ import print_function import argparse import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, scan diff --git a/gtkdoc-scangobj.in b/gtkdoc-scangobj.in index 9676956..7660c70 100755 --- a/gtkdoc-scangobj.in +++ b/gtkdoc-scangobj.in @@ -23,7 +23,11 @@ import argparse import os import sys -sys.path.append('@PYTHON_PACKAGE_DIR@') + +try: + import gtkdoc_uninstalled +except ModuleNotFoundError: + sys.path.append('@PYTHON_PACKAGE_DIR@') from gtkdoc import common, config, scangobj diff --git a/gtkdoc/config.py b/gtkdoc/config.py new file mode 100644 index 0000000..2d072fb --- /dev/null +++ b/gtkdoc/config.py @@ -0,0 +1,27 @@ +import os +import sys + +try: + from gtkdoc_uninstalled import builddir + exec(open(os.path.join(builddir, 'gtkdoc', 'config_data.py')).read()) +except ModuleNotFoundError: + from gtkdoc.config_data import * + +def get_dirs(uninstalled): + try: + from gtkdoc_uninstalled import sourcedir + gtkdocdir = sourcedir + styledir = os.path.join(sourcedir, 'style') + except ModuleNotFoundError: + if uninstalled: + # this does not work from buiddir!=srcdir + gtkdocdir = os.path.split(sys.argv[0])[0] + if not os.path.exists(gtkdocdir + '/gtk-doc.xsl'): + # try 'srcdir' (set from makefiles) too + if os.path.exists(os.environ.get("ABS_TOP_SRCDIR", '') + '/gtk-doc.xsl'): + gtkdocdir = os.environ['ABS_TOP_SRCDIR'] + styledir = gtkdocdir + '/style' + else: + gtkdocdir = os.path.join(config.datadir, 'gtk-doc/data') + styledir = gtkdocdir + return (gtkdocdir, styledir) diff --git a/gtkdoc/config.py.in b/gtkdoc/config_data.py.in index 1264374..1264374 100644 --- a/gtkdoc/config.py.in +++ b/gtkdoc/config_data.py.in diff --git a/gtkdoc/meson.build b/gtkdoc/meson.build index 7ae09d7..0dfb825 100644 --- a/gtkdoc/meson.build +++ b/gtkdoc/meson.build @@ -12,8 +12,8 @@ config_py.set('VERSION', version) config_py.set('EXEEXT', '') configure_file( - input: 'config.py.in', - output: 'config.py', + input: 'config_data.py.in', + output: 'config_data.py', configuration: config_py, install: true, install_dir: join_paths( @@ -26,6 +26,7 @@ gtkdoc_sources = [ '__init__.py', 'check.py', 'common.py', + 'config.py', 'fixxref.py', 'highlight.py', 'md_to_db.py', @@ -39,15 +40,6 @@ gtkdoc_sources = [ 'scangobj.py', ] -custom_target( - 'gtkdoc', - input: gtkdoc_sources, - output: gtkdoc_sources, - build_by_default: true, - command: ['cp', '-f', '@INPUT@', '@OUTDIR@'], - install: true, - install_dir: join_paths( - pkgpythondir, - 'gtkdoc', - ), -)
\ No newline at end of file +install_data(gtkdoc_sources, + install_dir: join_paths(pkgpythondir, 'gtkdoc') +) diff --git a/gtkdoc/mkhtml.py b/gtkdoc/mkhtml.py index 73eda12..52df3f4 100644 --- a/gtkdoc/mkhtml.py +++ b/gtkdoc/mkhtml.py @@ -48,21 +48,6 @@ def run_xsltproc(options, args): return subprocess.call(command + args, stderr=open('profile.txt', 'w')) -def get_dirs(uninstalled): - if uninstalled: - # this does not work from buiddir!=srcdir - gtkdocdir = os.path.split(sys.argv[0])[0] - if not os.path.exists(gtkdocdir + '/gtk-doc.xsl'): - # try 'srcdir' (set from makefiles) too - if os.path.exists(os.environ.get("ABS_TOP_SRCDIR", '') + '/gtk-doc.xsl'): - gtkdocdir = os.environ['ABS_TOP_SRCDIR'] - styledir = gtkdocdir + '/style' - else: - gtkdocdir = os.path.join(config.datadir, 'gtk-doc/data') - styledir = gtkdocdir - return (gtkdocdir, styledir) - - def run(options): logging.info('options: %s', str(options.__dict__)) @@ -74,7 +59,7 @@ def run(options): quiet = '1' remaining_args = options.args[2:] - (gtkdocdir, styledir) = get_dirs(options.uninstalled) + (gtkdocdir, styledir) = config.get_dirs(options.uninstalled) res = run_xsltproc(options, [ '--nonet', diff --git a/gtkdoc/mkhtml2.py b/gtkdoc/mkhtml2.py index 91860a7..9152850 100644 --- a/gtkdoc/mkhtml2.py +++ b/gtkdoc/mkhtml2.py @@ -1751,21 +1751,6 @@ def create_devhelp2(out_dir, module, xml, files): idx.write(line) -def get_dirs(uninstalled): - if uninstalled: - # this does not work from buiddir!=srcdir - gtkdocdir = os.path.split(sys.argv[0])[0] - if not os.path.exists(gtkdocdir + '/gtk-doc.xsl'): - # try 'srcdir' (set from makefiles) too - if os.path.exists(os.environ.get("ABS_TOP_SRCDIR", '') + '/gtk-doc.xsl'): - gtkdocdir = os.environ['ABS_TOP_SRCDIR'] - styledir = gtkdocdir + '/style' - else: - gtkdocdir = os.path.join(config.datadir, 'gtk-doc/data') - styledir = gtkdocdir - return (gtkdocdir, styledir) - - def main(module, index_file, out_dir, uninstalled, src_lang, paths): # == Loading phase == @@ -1785,7 +1770,7 @@ def main(module, index_file, out_dir, uninstalled, src_lang, paths): # 2) copy datafiles _t = timer() # TODO: handle additional images - (gtkdocdir, styledir) = get_dirs(uninstalled) + (gtkdocdir, styledir) = config.get_dirs(uninstalled) # copy navigation images and stylesheets to html directory ... css_file = os.path.join(styledir, 'style.css') for f in glob(os.path.join(styledir, '*.png')) + [css_file]: diff --git a/gtkdoc/mkpdf.py b/gtkdoc/mkpdf.py index beaaf5c..c7c75bf 100755 --- a/gtkdoc/mkpdf.py +++ b/gtkdoc/mkpdf.py @@ -47,13 +47,7 @@ def run(options): module = options.args[0] document = options.args[1] - if options.uninstalled: - # this does not work from buiddir!=srcdir - # we could try this - # MAKE_SCRDIR=$(abs_srcdir) MAKE_BUILDDIR=$(abs_builddir) gtkdoc-mkpdf ... - gtkdocdir = os.path.split(sys.argv[0])[0] - else: - gtkdocdir = os.path.join(config.datadir, 'gtk-doc/data') + gtkdocdir, _ = config.get_dirs(options.uninstalled) if config.dblatex != '': # extra options to consider diff --git a/gtkdoc_uninstalled.py.in b/gtkdoc_uninstalled.py.in new file mode 100644 index 0000000..8febefd --- /dev/null +++ b/gtkdoc_uninstalled.py.in @@ -0,0 +1,5 @@ +import sys + +sourcedir = "@sourcedir@" +builddir = "@builddir@" +sys.path.append(sourcedir) diff --git a/meson.build b/meson.build index 193c452..f7d785f 100644 --- a/meson.build +++ b/meson.build @@ -106,15 +106,25 @@ binary_in.set('PACKAGE', package_name) binary_in.set('VERSION', version) foreach binary: gtkdoc_binaires - configure_file( + prog = configure_file( input: '@0@.in'.format(binary), output: binary, configuration: binary_in, install: true, install_dir: bindir, ) + meson.override_find_program(binary, prog) endforeach +configure_file( + input: 'gtkdoc_uninstalled.py.in', + output: 'gtkdoc_uninstalled.py', + configuration: { + 'sourcedir': meson.current_source_dir(), + 'builddir': meson.current_build_dir(), + }, +) + # Data gtkdoc_data = [ 'devhelp2.xsd', @@ -157,6 +167,10 @@ configure_file( subdir('help') subdir('tests') +# A dummy dependency object that to use gtkdoc as subproject fallback +# To be used as: dependency('gtk-doc', fallback : ['gtk-doc', 'dummy_dep']) +dummy_dep = declare_dependency() + summary = [ '', '------', |