diff options
Diffstat (limited to 'indra/develop.py')
-rwxr-xr-x | indra/develop.py | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/indra/develop.py b/indra/develop.py index b2b494d1b3..0a2d3c5e52 100755 --- a/indra/develop.py +++ b/indra/develop.py @@ -41,6 +41,7 @@ import shutil import socket import sys import commands +import subprocess class CommandError(Exception): pass @@ -239,6 +240,7 @@ class UnixSetup(PlatformSetup): def run(self, command, name=None): '''Run a program. If the program fails, raise an exception.''' + sys.stdout.flush() ret = os.system(command) if ret: if name is None: @@ -439,7 +441,6 @@ class DarwinSetup(UnixSetup): ) if self.universal == 'ON': args['universal'] = '-DCMAKE_OSX_ARCHITECTURES:STRING=\'i386;ppc\'' - pass #if simple: # return 'cmake %(opts)s %(dir)r' % args return ('cmake -G %(generator)r ' @@ -457,7 +458,7 @@ class DarwinSetup(UnixSetup): targets = ' '.join(['-target ' + repr(t) for t in targets]) else: targets = '' - cmd = ('xcodebuild -configuration %s %s %s' % + cmd = ('xcodebuild -configuration %s %s %s | grep -v "^[[:space:]]*setenv" ; exit ${PIPESTATUS[0]}' % (self.build_type, ' '.join(opts), targets)) for d in self.build_dirs(): try: @@ -504,7 +505,7 @@ class WindowsSetup(PlatformSetup): break else: print >> sys.stderr, 'Cannot find a Visual Studio installation!' - eys.exit(1) + sys.exit(1) return self._generator def _set_generator(self, gen): @@ -573,25 +574,32 @@ class WindowsSetup(PlatformSetup): if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]: config = '\"%s|Win32\"' % config - return "buildconsole %s.sln /build %s" % (self.project_name, 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. - return ('"%sdevenv.com" %s.sln /build %s' % - (self.find_visual_studio(), self.project_name, self.build_type)) + executable = '%sdevenv.com' % (self.find_visual_studio(),) + cmd = ('"%s" %s.sln /build %s' % + (executable, self.project_name, self.build_type)) + return (executable, cmd) def run(self, command, name=None, retry_on=None, retries=1): '''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: retries = retries - 1 - ret = os.system(command) - if ret: - if name is None: - name = command.split(None, 1)[0] - path = self.find_in_path(name) - if not path: - error = 'was not found' - else: - error = 'exited with status %d' % ret + print "develop.py tries to run:", command + ret = subprocess.call(command, executable=path) + print "got ret", ret, "from", command + if ret == 0: + break + else: + error = 'exited with status %d' % ret if retry_on is not None and retry_on == ret: print "Retrying... the command %r %s" % (name, error) else: @@ -613,18 +621,21 @@ class WindowsSetup(PlatformSetup): if prev_build == self.build_type: # Only run vstool if the build type has changed. continue - vstool_cmd = (os.path.join('tools','vstool','VSTool.exe') + + executable = os.path.join('tools','vstool','VSTool.exe') + vstool_cmd = (executable + ' --solution ' + os.path.join(build_dir,'SecondLife.sln') + ' --config ' + self.build_type + ' --startup secondlife-bin') 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 def run_build(self, opts, targets): + for t in targets: + assert t.strip(), 'Unexpected empty targets: ' + repr(targets) cwd = getcwd() - build_cmd = self.get_build_cmd() + executable, build_cmd = self.get_build_cmd() for d in self.build_dirs(): try: @@ -633,11 +644,11 @@ class WindowsSetup(PlatformSetup): for t in targets: cmd = '%s /project %s %s' % (build_cmd, t, ' '.join(opts)) 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: cmd = '%s %s' % (build_cmd, ' '.join(opts)) 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: os.chdir(cwd) |