2012-04-07 76 views
3

我目前使用以下valadoc建設任務生成API文檔我VALA應用:如何遞歸安裝目錄與WAF

doc = bld.new_task_gen (
    features = 'valadoc', 
    output_dir = '../doc/html', 
    package_name = bld.env['PACKAGE_NAME'], 
    package_version = bld.env['VERSION'], 
    packages = 'gtk+-3.0 gee-1.0 libxml-2.0 x11 gdk-x11-3.0 libpeas-gtk-1.0 libpeas-1.0 config xtst gdk-3.0', 
    vapi_dirs = '../vapi', 
    force = True) 

path = bld.path.find_dir ('../src') 
doc.files = path.ant_glob (incl='**/*.vala') 

此任務會在輸出目錄的目錄HTML包括幾個子目錄與HTML和圖片文件。

我所知道的試圖將這些文件安裝到/ usr/share/doc/projectname/html /。要做到這一點,我添加以下到wscript_build文件(我發現here文檔以下):

output_dir = doc.bld.path.find_or_declare('../doc/html') 
doc.outputs = output_dir.ant_glob (incl='**/*') 
doc.bld.install_files('${PREFIX}/share/doc/projectname/html', doc.outputs) 

然而,這會導致一個錯誤「失蹤節點簽名」。有誰知道如何解決這個錯誤?還是有一種簡單的方法來遞歸地用waf安裝一個目錄?

你可以找到一個完整的樣本here

+0

通用信息---上述問題與試圖通過ctx.install_files將庫文件安裝到目錄時會出現的問題相同 – drahnr 2012-12-01 23:51:24

回答

3

我有一個類似的問題與生成的文件,並不得不更新相應的節點對象的簽名。嘗試創建一個任務:

def signature_task(task): 
    for x in task.generator.bld.path.find_dir('../doc/html').ant_glob('**/*', remove=False): 
     x.sig = Utils.h_file(x.abspath()) 

向你建立規則上,試着加入:

#Support running task groups serially 
bld.post_mode = Build.POST_LAZY 
在你構建結束

然後,添加:

#Previous tasks belong to a group 
bld.add_group() 
#This task runs last 
bld(rule=signature_task, always=True, name="signature_task") 
+0

謝謝。這幫了很多。但是需要進行更多的調整。請參閱http://bazaar.launchpad.net/~diodon-team/diodon/trunk/view/head:/doc/wscript_build – 2012-04-21 19:36:09

0

有一個使用relative_trick更簡單的方法。

bld.install_files(destination, 
        bld.path.ant_glob('../doc/html/**'), 
        cwd=bld.path.find_dir('../doc/html'), 
        relative_trick=True) 

這將從glob中獲取文件列表,將前綴截斷並將其放入目標中。