[geany/geany] f219ea: Cleanup apidoc and hackingdoc commands to use ctx.top_dir and ctx.out_dir

Enrico Tröger git-noreply at xxxxx
Fri Aug 29 14:12:40 UTC 2014


Branch:      refs/heads/master
Author:      Enrico Tröger <enrico.troeger at uvena.de>
Committer:   Enrico Tröger <enrico.troeger at uvena.de>
Date:        Fri, 29 Aug 2014 14:12:40 UTC
Commit:      f219ea1b38d06c15e8e53a705c1aa09f04bf97fb
             https://github.com/geany/geany/commit/f219ea1b38d06c15e8e53a705c1aa09f04bf97fb

Log Message:
-----------
Cleanup apidoc and hackingdoc commands to use ctx.top_dir and ctx.out_dir

This should be cleaner and safer than using '../' mixed with os.chdir().


Modified Paths:
--------------
    wscript

Modified: wscript
20 lines changed, 10 insertions(+), 10 deletions(-)
===================================================================
@@ -43,6 +43,7 @@ import sys
 import os
 import tempfile
 from waflib import Logs, Options, Scripting, Utils
+from waflib.Build import BuildContext
 from waflib.Configure import ConfigurationContext
 from waflib.Errors import WafError
 from waflib.TaskGen import feature, before_method
@@ -685,29 +686,28 @@ def updatepo(ctx):
 
 def apidoc(ctx):
     """generate API reference documentation"""
-    basedir = ctx.path.abspath()
+    ctx = BuildContext()  # create our own context to have ctx.top_dir
+    basedir = ctx.top_dir
     doxygen = _find_program(ctx, 'doxygen')
-    doxyfile = '%s/%s/doc/Doxyfile' % (basedir, out)
-    os.chdir('doc')
+    doxyfile = '%s/doc/Doxyfile' % ctx.out_dir
     Logs.pprint('CYAN', 'Generating API documentation')
     ret = ctx.exec_command('%s %s' % (doxygen, doxyfile))
     if ret != 0:
         raise WafError('Generating API documentation failed')
-    # update hacking.html
-    cmd = _find_rst2html(ctx)
-    ctx.exec_command('%s  -stg --stylesheet=geany.css %s %s' % (cmd, '../HACKING', 'hacking.html'))
-    os.chdir('..')
 
 
 def hackingdoc(ctx):
     """generate HACKING documentation"""
-    os.chdir('doc')
+    ctx = BuildContext()  # create our own context to have ctx.top_dir
     Logs.pprint('CYAN', 'Generating HACKING documentation')
     cmd = _find_rst2html(ctx)
-    ret = ctx.exec_command('%s  -stg --stylesheet=geany.css %s %s' % (cmd, '../HACKING', 'hacking.html'))
+    hacking_file = os.path.join(ctx.top_dir, 'HACKING')
+    hacking_html_file = os.path.join(ctx.top_dir, 'doc', 'hacking.html')
+    stylesheet = os.path.join(ctx.top_dir, 'doc', 'geany.css')
+    ret = ctx.exec_command('%s  -stg --stylesheet=%s %s %s' % (
+        cmd, stylesheet, hacking_file, hacking_html_file))
     if ret != 0:
         raise WafError('Generating HACKING documentation failed')
-    os.chdir('..')
 
 
 def _find_program(ctx, cmd, **kw):



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list