comparison rhodecode/lib/utils.py @ 2897:1f7b8c73c94a

Merge with beta
author Marcin Kuzminski <marcin@python-works.com>
date Mon, 08 Oct 2012 22:37:09 +0200
parents f7a52d548fd0 84414d73c233
children 3148c08cf86f
comparison
equal deleted inserted replaced
2880:3c7c24f9031f 2897:1f7b8c73c94a
670 from pylons import config as pylonsconfig 670 from pylons import config as pylonsconfig
671 671
672 self.path_to_ini_file = os.path.realpath(conf) 672 self.path_to_ini_file = os.path.realpath(conf)
673 conf = paste.deploy.appconfig('config:' + self.path_to_ini_file) 673 conf = paste.deploy.appconfig('config:' + self.path_to_ini_file)
674 pylonsconfig.init_app(conf.global_conf, conf.local_conf) 674 pylonsconfig.init_app(conf.global_conf, conf.local_conf)
675
676
677 def check_git_version():
678 """
679 Checks what version of git is installed in system, and issues a warning
680 if it's to old for RhodeCode to properly work.
681 """
682 import subprocess
683 from distutils.version import StrictVersion
684 from rhodecode import BACKENDS
685
686 p = subprocess.Popen('git --version', shell=True,
687 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
688 stdout, stderr = p.communicate()
689 ver = (stdout.split(' ')[-1] or '').strip() or '0.0.0'
690 try:
691 _ver = StrictVersion(ver)
692 except:
693 _ver = StrictVersion('0.0.0')
694 stderr = traceback.format_exc()
695
696 req_ver = '1.7.4'
697 to_old_git = False
698 if _ver <= StrictVersion(req_ver):
699 to_old_git = True
700
701 if 'git' in BACKENDS:
702 log.debug('GIT version detected: %s' % stdout)
703 if stderr:
704 log.warning('Unable to detect git version org error was:%r' % stderr)
705 elif to_old_git:
706 log.warning('RhodeCode detected git version %s, which is to old '
707 'for the system to function properly make sure '
708 'it is at least in version %s' % (ver, req_ver))
709 return _ver