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,52 +181,25 @@ 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)
|
||||||
|
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
|
||||||
version = '>= 2.8.0'
|
# we don't need to worry about the version; CmakeLists.txt does this for us!
|
||||||
found_cmd = ''
|
if p.returncode != 0:
|
||||||
for test_cmd in (self.cmake_cmd, r'tool\cmake\bin\%s' % self.cmake_cmd):
|
# if return code from cmake is not 0, then either something has
|
||||||
print 'Testing for CMake version %s by running `%s`...' % (version, test_cmd)
|
# gone terribly wrong with --version, or it genuinely doesn't exist.
|
||||||
p = subprocess.Popen([test_cmd, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
print ('Could not find `%s` in system path.\n'
|
||||||
stdout, stderr = p.communicate()
|
'Download the latest version from:\n %s') % (
|
||||||
m = re.search('cmake version (2\.8\.\d+)', stdout)
|
self.cmake_cmd, self.cmake_url)
|
||||||
if p.returncode == 0 and m:
|
raise Exception('Cannot continue without CMake.')
|
||||||
# found one that works, hurrah!
|
else:
|
||||||
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:
|
|
||||||
|
|
||||||
found_cmake = False
|
|
||||||
|
|
||||||
# if prompting allowed
|
|
||||||
if not self.no_prompts:
|
|
||||||
msg = 'CMake 2.8.0 not installed. Auto download now? [Y/n]'
|
|
||||||
print msg,
|
|
||||||
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:
|
|
||||||
return self.cmake_cmd
|
return self.cmake_cmd
|
||||||
|
|
||||||
def build(self, targets=[]):
|
def build(self, targets=[]):
|
||||||
|
|
Loading…
Reference in New Issue