build:wafsamba: removed most import * statements
[samba.git] / buildtools / wafsamba / pkgconfig.py
index 4abf8d67d48c2c118c57de9867914490d47d11fb..25cec781bc045a53eb18adba8657079ba7dcd994 100644 (file)
@@ -1,16 +1,13 @@
 # handle substitution of variables in pc files
 
-import Build
-from samba_utils import *
+import os, re, sys
+import Build, Logs
+from samba_utils import SUBST_VARS_RECURSIVE, TO_LIST
 
 def subst_at_vars(task):
     '''substiture @VAR@ style variables in a file'''
-    src = task.inputs[0].srcpath(task.env)
-    tgt = task.outputs[0].bldpath(task.env)
 
-    f = open(src, 'r')
-    s = f.read()
-    f.close()
+    s = task.inputs[0].read()
     # split on the vars
     a = re.split('(@\w+@)', s)
     out = []
@@ -37,9 +34,7 @@ def subst_at_vars(task):
                     break
         out.append(v)
     contents = ''.join(out)
-    f = open(tgt, 'w')
-    s = f.write(contents)
-    f.close()
+    task.outputs[0].write(contents)
     return 0
 
 
@@ -53,6 +48,7 @@ def PKG_CONFIG_FILES(bld, pc_files, vnum=None):
                                 rule=subst_at_vars,
                                 source=f+'.in',
                                 target=f)
+        bld.add_manual_dependency(bld.path.find_or_declare(f), bld.env['PREFIX'])
         t.vars = []
         if t.env.RPATH_ON_INSTALL:
             t.env.LIB_RPATH = t.env.RPATH_ST % t.env.LIBDIR