Newer
Older
# -*- python -*-
# -*- coding: utf-8 -*-
# Installsystems is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# Installsystems 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 Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License
# along with Installsystems. If not, see <http://www.gnu.org/licenses/>.
'''
Retrieve current git version
'''
from os import getcwd, chdir, devnull
from os.path import dirname
from subprocess import check_output, CalledProcessError
version = check_output(["git", "describe", "--tags", "--always" ],
stdin=open(devnull, 'rb'),
stderr=open(devnull, "wb")).strip()
if len(version) > 0:
version = "-" + version
except (OSError, CalledProcessError):
pass
finally:
CANONICAL_NAME = "@PACKAGE@"
VERSION = "@VERSION@"
if VERSION.find("+git") >= 0:
VERSION += git_version()