[geany/geany-plugins] cfd65c: Drop old SVN revision detection code and check for GIT only
Enrico Tröger
git-noreply at xxxxx
Sun Apr 13 08:48:55 UTC 2014
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger at uvena.de>
Committer: Enrico Tröger <enrico.troeger at uvena.de>
Date: Sun, 13 Apr 2014 08:48:55 UTC
Commit: cfd65cebe39a92d2a9773794a0f1e4481381c83b
https://github.com/geany/geany-plugins/commit/cfd65cebe39a92d2a9773794a0f1e4481381c83b
Log Message:
-----------
Drop old SVN revision detection code and check for GIT only
Modified Paths:
--------------
build/wafutils.py
wscript
Modified: build/wafutils.py
50 files changed, 11 insertions(+), 39 deletions(-)
===================================================================
@@ -182,45 +182,17 @@ def get_plugins():
return sorted(plugins)
-def get_svn_rev(conf):
- def in_git():
- cmd = 'git ls-files >/dev/null 2>&1'
- return (conf.exec_command(cmd) == 0)
-
- def in_svn():
- return os.path.exists('.svn')
-
- # try GIT
- if in_git():
- cmds = [ 'git svn find-rev HEAD 2>/dev/null',
- 'git svn find-rev origin/trunk 2>/dev/null',
- 'git svn find-rev trunk 2>/dev/null',
- 'git svn find-rev master 2>/dev/null'
- ]
- for cmd in cmds:
- try:
- stdout = conf.cmd_and_log(cmd)
- if stdout:
- return int(stdout.strip())
- except WafError:
- pass
- except ValueError:
- Logs.pprint('RED', 'Unparseable revision number')
- # try SVN
- elif in_svn():
- try:
- _env = None if target_is_win32(conf) else dict(LANG='C')
- stdout = conf.cmd_and_log(cmd='svn info --non-interactive', env=_env)
- lines = stdout.splitlines(True)
- for line in lines:
- if line.startswith('Last Changed Rev'):
- value = line.split(': ', 1)[1]
- return int(value.strip())
- except WafError:
- pass
- except (IndexError, ValueError):
- Logs.pprint('RED', 'Unparseable revision number')
- return 0
+def get_git_rev(conf):
+ if not os.path.isdir('.git'):
+ return
+
+ try:
+ cmd = 'git rev-parse --short --revs-only HEAD'
+ revision = conf.cmd_and_log(cmd).strip()
+ except WafError:
+ return None
+ else:
+ return revision
def install_docs(ctx, name, files):
Modified: wscript
14 files changed, 7 insertions(+), 7 deletions(-)
===================================================================
@@ -51,7 +51,7 @@ from build.wafutils import (
check_cfg_cached,
get_plugins,
get_enabled_plugins,
- get_svn_rev,
+ get_git_rev,
install_docs,
launch,
load_intltool_if_available,
@@ -94,9 +94,9 @@ def configure(conf):
args='--cflags --libs')
set_lib_dir(conf)
- # SVN/GIT detection
- svn_rev = get_svn_rev(conf)
- conf.define('REVISION', svn_rev, 1)
+ # GIT detection
+ revision = get_git_rev(conf)
+ conf.define('REVISION', revision, 1)
# GTK/Geany versions
geany_version = conf.check_cfg(modversion='geany') or 'Unknown'
gtk_version = conf.check_cfg(modversion='gtk+-2.0') or 'Unknown'
@@ -116,7 +116,7 @@ def configure(conf):
conf.write_config_header('config.h')
# enable debug when compiling from VCS
- if svn_rev > 0:
+ if revision > 0:
conf.env.append_value('CFLAGS', '-g -DDEBUG'.split()) # -DGEANY_DISABLE_DEPRECATED
# summary
@@ -124,8 +124,8 @@ def configure(conf):
conf.msg('Install Geany Plugins ' + VERSION + ' in', conf.env['G_PREFIX'])
conf.msg('Using GTK version', gtk_version)
conf.msg('Using Geany version', geany_version)
- if svn_rev > 0:
- conf.msg('Compiling Subversion revision', svn_rev)
+ if revision > 0:
+ conf.msg('Compiling Git revision', revision)
conf.msg('Plugins to compile', ' '.join(enabled_plugins))
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Plugins-Commits
mailing list