Task #2733
This commit is contained in:
parent
acc558bcdd
commit
bbe64d40a1
|
@ -42,6 +42,8 @@ class InternalCommands:
|
||||||
qtpro_filename = 'qsynergy.pro'
|
qtpro_filename = 'qsynergy.pro'
|
||||||
doxygen_filename = 'doxygen.cfg'
|
doxygen_filename = 'doxygen.cfg'
|
||||||
|
|
||||||
|
cmake_url = 'http://www.cmake.org/cmake/resources/software.html'
|
||||||
|
|
||||||
# try_chdir(...) and restore_chdir() will use this
|
# try_chdir(...) and restore_chdir() will use this
|
||||||
prevdir = ''
|
prevdir = ''
|
||||||
|
|
||||||
|
@ -179,51 +181,24 @@ class InternalCommands:
|
||||||
self.set_conf_run()
|
self.set_conf_run()
|
||||||
|
|
||||||
def persist_cmake(self):
|
def persist_cmake(self):
|
||||||
if sys.platform == 'win32':
|
# even though we're running `cmake --version`, we're only doing this for the 0 return
|
||||||
|
# code; we don't care about the version, since CMakeLists worrys about this for us.
|
||||||
|
p = subprocess.Popen(
|
||||||
|
[self.cmake_cmd, '--version'],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
shell=True)
|
||||||
|
|
||||||
version = '>= 2.8.0'
|
|
||||||
found_cmd = ''
|
|
||||||
for test_cmd in (self.cmake_cmd, r'tool\cmake\bin\%s' % self.cmake_cmd):
|
|
||||||
print 'Testing for CMake version %s by running `%s`...' % (version, test_cmd)
|
|
||||||
p = subprocess.Popen([test_cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
m = re.search('cmake version (2\.8\.\d+)', stdout)
|
|
||||||
if p.returncode == 0 and m:
|
|
||||||
# found one that works, hurrah!
|
|
||||||
print 'Found valid CMake version %s' % m.group(1)
|
|
||||||
found_cmd = test_cmd
|
|
||||||
# HACK: gotta go out so just hacking this for now
|
|
||||||
if found_cmd == r'tool\cmake\bin\%s' % self.cmake_cmd:
|
|
||||||
found_cmd = r'..\tool\cmake\bin\%s' % self.cmake_cmd
|
|
||||||
break
|
|
||||||
|
|
||||||
if not found_cmd:
|
# we don't need to worry about the version; CmakeLists.txt does this for us!
|
||||||
|
if p.returncode != 0:
|
||||||
found_cmake = False
|
# if return code from cmake is not 0, then either something has
|
||||||
|
# gone terribly wrong with --version, or it genuinely doesn't exist.
|
||||||
# if prompting allowed
|
print ('Could not find `%s` in system path.\n'
|
||||||
if not self.no_prompts:
|
'Download the latest version from:\n %s') % (
|
||||||
msg = 'CMake 2.8.0 not installed. Auto download now? [Y/n]'
|
self.cmake_cmd, self.cmake_url)
|
||||||
print msg,
|
raise Exception('Cannot continue without CMake.')
|
||||||
yn = raw_input()
|
|
||||||
|
|
||||||
# if response was anyting but no
|
|
||||||
if yn not in ['n', 'N']:
|
|
||||||
if not os.path.exists('tool'):
|
|
||||||
os.mkdir('tool')
|
|
||||||
|
|
||||||
err = os.system(r'svn checkout https://synergy-plus.googlecode.com/svn/tools/win/cmake tool\cmake')
|
|
||||||
if err != 0:
|
|
||||||
raise Exception('Unable to get cmake from repository with error code code: ' + str(err))
|
|
||||||
|
|
||||||
found_cmd = r'..\tool\cmake\bin\%s' % self.cmake_cmd
|
|
||||||
found_cmake = True
|
|
||||||
|
|
||||||
# if cmake was not found
|
|
||||||
if not found_cmake:
|
|
||||||
raise Exception('Cannot continue without CMake, exiting.')
|
|
||||||
|
|
||||||
return found_cmd
|
|
||||||
else:
|
else:
|
||||||
return self.cmake_cmd
|
return self.cmake_cmd
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue