[LNT] r184772 - lnt tool: Check that the installed version matches the current version.
Daniel Dunbar
daniel at zuster.org
Mon Jun 24 11:20:42 PDT 2013
Author: ddunbar
Date: Mon Jun 24 13:20:42 2013
New Revision: 184772
URL: http://llvm.org/viewvc/llvm-project?rev=184772&view=rev
Log:
lnt tool: Check that the installed version matches the current version.
- This check forces users of "development mode" to re-install LNT when the
version changes, which is useful for providing more seamless transitions when
making certain changes (like adding new package dependencies).
Modified:
lnt/trunk/lnt/lnttool/main.py
Modified: lnt/trunk/lnt/lnttool/main.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/main.py?rev=184772&r1=184771&r2=184772&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/main.py (original)
+++ lnt/trunk/lnt/lnttool/main.py Mon Jun 24 13:20:42 2013
@@ -350,8 +350,33 @@ def action_send_daily_report(name, args)
###
+def _version_check():
+ """
+ Check that the installed version of the LNT is up-to-date with the running
+ package.
+
+ This check is used to force users of distribute's develop mode to reinstall
+ when the version number changes (which may involve changing package
+ requirements).
+ """
+ import pkg_resources
+
+ # Get the current distribution.
+ installed_dist = pkg_resources.get_distribution("LNT")
+ installed_dist_name = "%s %s" % (installed_dist.project_name,
+ installed_dist.version)
+ current_dist_name = "LNT %s" % (lnt.__version__,)
+ if installed_dist_name != current_dist_name:
+ raise SystemExit("""\
+error: installed distribution %s is not current (%s), you may need to reinstall
+LNT or rerun 'setup.py develop' if using development mode.""" % (
+ installed_dist_name, current_dist_name))
+
tool = lnt.util.multitool.MultiTool(locals())
-main = tool.main
+
+def main(*args, **kwargs):
+ _version_check()
+ return tool.main(*args, **kwargs)
if __name__ == '__main__':
main()
More information about the llvm-commits
mailing list