- python does not export variables beginning with underscore
authorMark Huang <mlhuang@cs.princeton.edu>
Sat, 27 Aug 2005 17:38:57 +0000 (17:38 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Sat, 27 Aug 2005 17:38:57 +0000 (17:38 +0000)
- util-vserver-vars also specifies some values by reference, dereference
  these before converting to python

python/Makefile

index dc4d593..7ae69d7 100644 (file)
@@ -9,11 +9,14 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2005 The Trustees of Princeton University
 #
-# $Id$
+# $Id: Makefile,v 1.7 2005/08/26 04:00:44 mlhuang Exp $
 #
 
 ALL := vserverimpl.so vduimpl.so util_vserver_vars.py
 
+# need command substitution
+SHELL := /bin/bash
+
 pythonlibdir := @libdir@/python@PYTHON_VERSION@/site-packages
 
 all: $(ALL)
@@ -29,7 +32,11 @@ vserverimpl.so vduimpl.so: %.so: %.o
        ../libtool --tag=CC --mode=link $(CC) -shared -o $@ $< ../lib/libvserver.la
 
 util_vserver_vars.py: ../scripts/util-vserver-vars
-       install -m 644 $< $@
+        # python does not export variables beginning with underscore
+       (. $< ; \
+       while read var ; do eval echo $$var=\$${$$var} ; done < \
+       <(sed -ne "s/\([^=]*\)=.*/\1/p" $<) \
+       | sed -e "s/^_*//" -e "s/\([^=]*\)=\(.*\)/\1='\2'/") > $@
 
 install: $(ALL)
         # install relinked libraries and byte-compiled scripts