Use _autoconf.py instead of version.py, generated by Makefile with more
authorMichael Hanselmann <hansmi@google.com>
Tue, 4 Sep 2007 11:32:31 +0000 (11:32 +0000)
committerMichael Hanselmann <hansmi@google.com>
Tue, 4 Sep 2007 11:32:31 +0000 (11:32 +0000)
variables. The underline is there to mark it as a private module.

Reviewed-by: iustinp

configure.ac
lib/Makefile.am
lib/constants.py
lib/version.py.in [deleted file]

index 8e03418..c7c4532 100644 (file)
@@ -19,11 +19,16 @@ then
   AC_MSG_WARN([docbook2man not found.])
 fi
 
-AC_SUBST(PACKAGE_VERSION)
-
-AC_CONFIG_FILES([Makefile man/Makefile doc/Makefile
-  testing/Makefile tools/Makefile
-  lib/Makefile scripts/Makefile daemons/Makefile
-  doc/examples/Makefile lib/version.py])
+AC_CONFIG_FILES([
+  Makefile
+  daemons/Makefile
+  doc/Makefile
+  doc/examples/Makefile
+  lib/Makefile
+  man/Makefile
+  scripts/Makefile
+  testing/Makefile
+  tools/Makefile
+])
 
 AC_OUTPUT
index 59d62fb..48e90e8 100644 (file)
@@ -1,7 +1,13 @@
-MAINTAINERCLEANFILES = version.py
-EXTRA_DIST = version.py.in
-nodist_pkgpython_PYTHON = version.py
+MAINTAINERCLEANFILES = _autoconf.py
+nodist_pkgpython_PYTHON = _autoconf.py
 pkgpython_PYTHON = __init__.py backend.py cli.py cmdlib.py config.py \
        objects.py errors.py logger.py ssh.py utils.py rpc.py \
        bdev.py hypervisor.py opcodes.py mcpu.py constants.py \
        ssconf.py
+
+_autoconf.py: Makefile
+       { echo '# This file is automatically generated, do not edit!'; \
+         echo "PACKAGE_VERSION = '$(PACKAGE_VERSION)'"; \
+         echo "LOCALSTATEDIR = '$(localstatedir)'"; \
+         echo "SYSCONFDIR = '$(sysconfdir)'"; \
+       } > $@
index 183f320..246136a 100644 (file)
 
 """Module holding different constants."""
 
-from ganeti import version
+from ganeti import _autoconf
 
 # various versions
 CONFIG_VERSION = 3
 PROTOCOL_VERSION = 2
-RELEASE_VERSION = version.RELEASE_VERSION
+RELEASE_VERSION = _autoconf.PACKAGE_VERSION
 OS_API_VERSION = 4
 EXPORT_VERSION = 0
 
 
 # file paths
-DATA_DIR = "/var/lib/ganeti"
+DATA_DIR = _autoconf.LOCALSTATEDIR + "/lib/ganeti"
 CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
 SSL_CERT_FILE = DATA_DIR + "/server.pem"
 WATCHER_STATEFILE = DATA_DIR + "/restart_state"
 SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
 
-NODE_INITD_SCRIPT = "/etc/init.d/ganeti"
+NODE_INITD_SCRIPT = _autoconf.SYSCONFDIR + "/init.d/ganeti"
 DEFAULT_NODED_PORT = 1811
 FIRST_DRBD_PORT = 11000
 LAST_DRBD_PORT = 14999
 MASTER_SCRIPT = "ganeti-master"
 
-LOG_DIR = "/var/log/ganeti"
+LOG_DIR = _autoconf.LOCALSTATEDIR + "/log/ganeti"
 LOG_OS_DIR = LOG_DIR + "/os"
 LOG_NODESERVER = LOG_DIR + "/node-daemon.log"
 
@@ -54,7 +54,7 @@ EXPORT_DIR = "/srv/ganeti/export"
 EXPORT_CONF_FILE = "config.ini"
 
 # hooks-related constants
-HOOKS_BASE_DIR = "/etc/ganeti/hooks"
+HOOKS_BASE_DIR = _autoconf.SYSCONFDIR + "/ganeti/hooks"
 HOOKS_PHASE_PRE = "pre"
 HOOKS_PHASE_POST = "post"
 HOOKS_VERSION = 1
diff --git a/lib/version.py.in b/lib/version.py.in
deleted file mode 100644 (file)
index e6aa45e..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/python
-#
-
-# Copyright (C) 2007 Google Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-
-"""Ganeti version
-"""
-
-RELEASE_VERSION = "@PACKAGE_VERSION@"