mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-08 09:49:36 +00:00
waifulib: update
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
# encoding: utf-8
|
||||
# gitversion.py -- waf plugin to get git version
|
||||
# Copyright (C) 2018 a1batross
|
||||
# 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 3 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.
|
||||
|
||||
import subprocess
|
||||
from waflib import Configure, Logs
|
||||
|
||||
@Configure.conf
|
||||
def get_git_version(conf):
|
||||
# try grab the current version number from git
|
||||
node = conf.path.find_node('.git')
|
||||
|
||||
if not node:
|
||||
return None
|
||||
|
||||
try:
|
||||
stdout = conf.cmd_and_log([conf.env.GIT[0], 'describe', '--dirty', '--always'],
|
||||
cwd = node.parent)
|
||||
version = stdout.strip()
|
||||
except Exception as e:
|
||||
version = ''
|
||||
Logs.debug(str(e))
|
||||
|
||||
if len(version) == 0:
|
||||
version = None
|
||||
|
||||
return version
|
||||
|
||||
def configure(conf):
|
||||
if conf.find_program('git', mandatory = False):
|
||||
conf.start_msg('Checking git hash')
|
||||
ver = conf.get_git_version()
|
||||
|
||||
if ver:
|
||||
conf.env.GIT_VERSION = ver
|
||||
conf.end_msg(conf.env.GIT_VERSION)
|
||||
else:
|
||||
conf.end_msg('no', color='YELLOW')
|
||||
Reference in New Issue
Block a user