From 4366c12d46526f4d206ff6baa64a3be25f4409d6 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 17 Jul 2011 14:16:59 +0200 Subject: [PATCH] Make version number easily configureable in setup.py. --- .gitignore | 1 + Makefile | 6 +++++- pakfire/__init__.py | 2 +- pakfire/constants.py | 2 +- setup.py | 7 ++++++- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 86a607ecc..1cd1d3f55 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /build +/pakfire/__version__.py /tmp *.py[co] diff --git a/Makefile b/Makefile index 5b9c98b1b..85581ed92 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ DESTDIR ?= / -all: build +all: po build .PHONY: build build: @@ -27,3 +27,7 @@ install: .PHONY: check check: ./runpychecker.sh + +.PHONY: po +po: + find pakfire -name "*.py" | grep -v "__version__.py" | sort > po/POTFILES.in diff --git a/pakfire/__init__.py b/pakfire/__init__.py index efb21e43a..c5b3a6659 100644 --- a/pakfire/__init__.py +++ b/pakfire/__init__.py @@ -2,6 +2,6 @@ from base import Pakfire -from constants import * +from constants import PAKFIRE_VERSION __version__ = PAKFIRE_VERSION diff --git a/pakfire/constants.py b/pakfire/constants.py index 80fa14778..f1f86e8f0 100644 --- a/pakfire/constants.py +++ b/pakfire/constants.py @@ -4,7 +4,7 @@ import os.path from errors import * -PAKFIRE_VERSION = "0.9.2" +from __version__ import PAKFIRE_VERSION SYSCONFDIR = "/etc" diff --git a/setup.py b/setup.py index 412be67bb..50bc2990c 100644 --- a/setup.py +++ b/setup.py @@ -5,11 +5,16 @@ from distutils.core import Extension, setup from DistUtilsExtra.command import * -#from pakfire.constants import PAKFIRE_VERSION PAKFIRE_VERSION = "0.9.2" _pakfire_module_files = [os.path.join("src", f) for f in os.listdir("src") if f.endswith(".c")] +# Update program version. +f = open("pakfire/__version__.py", "w") +f.write("# this file is autogenerated by setup.py\n") +f.write("PAKFIRE_VERSION = \"%s\"\n" % PAKFIRE_VERSION) +f.close() + setup( name = "pakfire", version = PAKFIRE_VERSION, -- 2.39.5