[game-data-packager] 03/11: version: detect features, not distributions, to load ...VERSION
Simon McVittie
smcv at debian.org
Tue Jan 5 09:55:27 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch master
in repository game-data-packager.
commit 3ef741f952ba6b81177b39fa4e91e5a745009939
Author: Simon McVittie <smcv at debian.org>
Date: Mon Jan 4 22:44:17 2016 +0000
version: detect features, not distributions, to load ...VERSION
---
game_data_packager/version.py | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/game_data_packager/version.py b/game_data_packager/version.py
index 1de0a50..df570dd 100644
--- a/game_data_packager/version.py
+++ b/game_data_packager/version.py
@@ -5,6 +5,15 @@
import os
+with open('debian/changelog', encoding='utf-8') as cl:
+ try:
+ from debian.changelog import ChangeLog
+ except ImportError:
+ GAME_PACKAGE_VERSION = cl.readline().split('(', 1)[1].split(')', 1)[0]
+ else:
+ cl = ChangeLog(cl, strict=False)
+ GAME_PACKAGE_VERSION = str(cl.full_version)
+
if os.path.isfile('/etc/debian_version'):
FORMAT = 'deb'
DISTRO = 'generic'
@@ -12,10 +21,6 @@ if os.path.isfile('/etc/debian_version'):
ASSETS = 'usr/share/games'
LICENSEDIR = 'usr/share/doc'
- from debian.changelog import Changelog
- cl = Changelog(open('debian/changelog', encoding='utf-8'), strict=False)
- GAME_PACKAGE_VERSION = str(cl.full_version)
-
elif os.path.isfile('/etc/redhat-release'):
FORMAT = 'rpm'
DISTRO = 'fedora'
@@ -23,9 +28,6 @@ elif os.path.isfile('/etc/redhat-release'):
ASSETS = 'usr/share'
LICENSEDIR = 'usr/share/licenses'
- cl = open('debian/changelog', encoding='utf-8').readline()
- GAME_PACKAGE_VERSION = cl.split('(')[1].split(')')[0]
-
elif os.path.isfile('/etc/SuSE-release'):
FORMAT = 'rpm'
DISTRO = 'suse'
@@ -33,15 +35,9 @@ elif os.path.isfile('/etc/SuSE-release'):
ASSETS = 'usr/share'
LICENSEDIR = 'usr/share/licenses'
- cl = open('debian/changelog', encoding='utf-8').readline()
- GAME_PACKAGE_VERSION = cl.split('(')[1].split(')')[0]
-
elif os.path.isfile('/etc/arch-release'):
FORMAT = 'arch'
DISTRO = 'arch'
BINDIR = 'usr/bin'
ASSETS = 'usr/share'
LICENSEDIR = 'usr/share/doc'
-
- cl = open('debian/changelog', encoding='utf-8').readline()
- GAME_PACKAGE_VERSION = cl.split('(')[1].split(')')[0]
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git
More information about the Pkg-games-commits
mailing list