From 2ec084684600cc1f9b2562c279fc6da8634bac60 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Tue, 4 Sep 2007 11:32:31 +0000 Subject: [PATCH] Use _autoconf.py instead of version.py, generated by Makefile with more variables. The underline is there to mark it as a private module. Reviewed-by: iustinp --- configure.ac | 17 +++++++++++------ lib/Makefile.am | 12 +++++++++--- lib/constants.py | 12 ++++++------ lib/version.py.in | 25 ------------------------- 4 files changed, 26 insertions(+), 40 deletions(-) delete mode 100644 lib/version.py.in diff --git a/configure.ac b/configure.ac index 8e03418a4..c7c45324f 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/lib/Makefile.am b/lib/Makefile.am index 59d62fbaf..48e90e8c4 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -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)'"; \ + } > $@ diff --git a/lib/constants.py b/lib/constants.py index 183f32017..246136aa4 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -21,30 +21,30 @@ """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 index e6aa45e97..000000000 --- a/lib/version.py.in +++ /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@" -- GitLab