2009/8/24 Iustin Pop <[email protected]>:
> On Mon, Aug 24, 2009 at 11:56:39AM +0200, Michael Hanselmann wrote:
>> +SCRIPTS = [
>> +  "scripts/gnt-backup",
>> […]
>> +  "scripts/gnt-os",
>> +  ]
>
> This is already available in the Makefile as gnt-scripts, could we write
> it out to _autoconf.py somehow and import it here?

Yes:

diff --git a/Makefile.am b/Makefile.am
index 7f8fc4d..fedd0db 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -347,6 +347,7 @@ lib/_autoconf.py: Makefile stamp-directories
          echo "SOCAT_PATH = '$(SOCAT_PATH)'"; \
          echo "LVM_STRIPECOUNT = $(LVM_STRIPECOUNT)"; \
          echo "TOOLSDIR = '$(toolsdir)'"; \
+         echo "GNT_SCRIPTS = [$(foreach i,$(notdir
$(gnt_scripts)),'$(i)',)]"; \
        } > $@

 $(REPLACE_VARS_SED): Makefile stamp-directories
diff --git a/autotools/build-bash-completion b/autotools/build-bash-completion
index 0e1d4d1..befbe6b 100755
--- a/autotools/build-bash-completion
+++ b/autotools/build-bash-completion
@@ -30,16 +30,9 @@ from ganeti import constants
 from ganeti import cli
 from ganeti import utils

-
-SCRIPTS = [
-  "scripts/gnt-backup",
-  "scripts/gnt-cluster",
-  "scripts/gnt-debug",
-  "scripts/gnt-instance",
-  "scripts/gnt-job",
-  "scripts/gnt-node",
-  "scripts/gnt-os",
-  ]
+# _autoconf shouldn't be imported from anywhere except constants.py, but we're
+# making an exception here because this script is only used at build time.
+from ganeti import _autoconf


 class ShellWriter:
@@ -486,8 +479,8 @@ def main():
   WritePreamble(sw)

   # gnt-* scripts
-  for filename in SCRIPTS:
-    scriptname = os.path.basename(filename)
+  for scriptname in _autoconf.GNT_SCRIPTS:
+    filename = "scripts/%s" % scriptname

     WriteCompletion(sw, scriptname,
                     GetFunctionName(scriptname),

Regards,
Michael

Reply via email to