Skip to content
Snippets Groups Projects
Commit c1d7951e authored by Nathan Wilcox's avatar Nathan Wilcox
Browse files
parents 5ca943cd ea7733a1
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
import socket import socket
import sys import sys
import commands import commands
import subprocess
class CommandError(Exception): class CommandError(Exception):
pass pass
...@@ -504,7 +505,7 @@ def _get_generator(self): ...@@ -504,7 +505,7 @@ def _get_generator(self):
break break
else: else:
print >> sys.stderr, 'Cannot find a Visual Studio installation!' print >> sys.stderr, 'Cannot find a Visual Studio installation!'
eys.exit(1) sys.exit(1)
return self._generator return self._generator
def _set_generator(self, gen): def _set_generator(self, gen):
...@@ -573,29 +574,32 @@ def get_build_cmd(self): ...@@ -573,29 +574,32 @@ def get_build_cmd(self):
if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]: if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]:
config = '\"%s|Win32\"' % config config = '\"%s|Win32\"' % config
return "buildconsole %(prj)s.sln /build /cfg=%(cfg)s" % {'prj': self.project_name, 'cfg': config} executable = 'buildconsole'
cmd = "%(bin)s %(prj)s.sln /build /cfg=%(cfg)s" % {'prj': self.project_name, 'cfg': config, 'bin': executable}
return (executable, cmd)
# devenv.com is CLI friendly, devenv.exe... not so much. # devenv.com is CLI friendly, devenv.exe... not so much.
return ('"%sdevenv.com" %s.sln /build %s' % executable = '%sdevenv.com' % (self.find_visual_studio(),)
(self.find_visual_studio(), self.project_name, self.build_type)) cmd = ('"%s" %s.sln /build %s' %
#return ('devenv.com %s.sln /build %s' % (executable, self.project_name, self.build_type))
# (self.project_name, self.build_type)) return (executable, cmd)
def run(self, command, name=None, retry_on=None, retries=1): def run(self, command, name=None, retry_on=None, retries=1):
'''Run a program. If the program fails, raise an exception.''' '''Run a program. If the program fails, raise an exception.'''
assert name is not None, 'On windows an executable path must be given in name. [DEV-44838]'
if os.path.isfile(name):
path = name
else:
path = self.find_in_path(name)[0]
while retries: while retries:
retries = retries - 1 retries = retries - 1
print "develop.py tries to run:", command print "develop.py tries to run:", command
ret = os.system(command) ret = subprocess.call(command, executable=path)
print "got ret", ret, "from", command print "got ret", ret, "from", command
if ret: if ret == 0:
if name is None: break
name = command.split(None, 1)[0] else:
path = self.find_in_path(name) error = 'exited with status %d' % ret
if not path:
error = 'was not found'
else:
error = 'exited with status %d' % ret
if retry_on is not None and retry_on == ret: if retry_on is not None and retry_on == ret:
print "Retrying... the command %r %s" % (name, error) print "Retrying... the command %r %s" % (name, error)
else: else:
...@@ -617,18 +621,21 @@ def run_vstool(self): ...@@ -617,18 +621,21 @@ def run_vstool(self):
if prev_build == self.build_type: if prev_build == self.build_type:
# Only run vstool if the build type has changed. # Only run vstool if the build type has changed.
continue continue
vstool_cmd = (os.path.join('tools','vstool','VSTool.exe') + executable = os.path.join('tools','vstool','VSTool.exe')
vstool_cmd = (executable +
' --solution ' + ' --solution ' +
os.path.join(build_dir,'SecondLife.sln') + os.path.join(build_dir,'SecondLife.sln') +
' --config ' + self.build_type + ' --config ' + self.build_type +
' --startup secondlife-bin') ' --startup secondlife-bin')
print 'Running %r in %r' % (vstool_cmd, getcwd()) print 'Running %r in %r' % (vstool_cmd, getcwd())
self.run(vstool_cmd) self.run(vstool_cmd, name=executable)
print >> open(stamp, 'w'), self.build_type print >> open(stamp, 'w'), self.build_type
def run_build(self, opts, targets): def run_build(self, opts, targets):
for t in targets:
assert t.strip(), 'Unexpected empty targets: ' + repr(targets)
cwd = getcwd() cwd = getcwd()
build_cmd = self.get_build_cmd() executable, build_cmd = self.get_build_cmd()
for d in self.build_dirs(): for d in self.build_dirs():
try: try:
...@@ -637,11 +644,11 @@ def run_build(self, opts, targets): ...@@ -637,11 +644,11 @@ def run_build(self, opts, targets):
for t in targets: for t in targets:
cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts)) cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts))
print 'Running %r in %r' % (cmd, d) print 'Running %r in %r' % (cmd, d)
self.run(cmd, retry_on=4, retries=3) self.run(cmd, name=executable, retry_on=4, retries=3)
else: else:
cmd = '%s %s' % (build_cmd, ' '.join(opts)) cmd = '%s %s' % (build_cmd, ' '.join(opts))
print 'Running %r in %r' % (cmd, d) print 'Running %r in %r' % (cmd, d)
self.run(cmd, retry_on=4, retries=3) self.run(cmd, name=executable, retry_on=4, retries=3)
finally: finally:
os.chdir(cwd) os.chdir(cwd)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment