From 5d2167c66a027cc5e4e002dca51e163b0d08fe42 Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Fri, 8 Jan 2010 15:10:59 -0800
Subject: Fix a typo bug caught by pyflakes.  eys.exit(1) -> sys.exit(1)

---
 indra/develop.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index eaecdd0ab6..9d606da1d9 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -504,7 +504,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):
-- 
cgit v1.2.3


From 010bfed411cffdb7037872a209adf51c77f48140 Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Fri, 8 Jan 2010 15:50:09 -0800
Subject: DEV-44838 - This is an attempt at the minimal possible change to fix
 the quoting bug on windows.

This commit is untested!  The simplest approach to testing is to push into a repo watched by parabuild.

Also, develop.py could be improved to use subprocess consistently across all platforms.  Doing so could simplify the code, but until I understand how to test it better, I'm going to leave it alone.
---
 indra/develop.py | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index 9d606da1d9..27c3d0ca2c 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
@@ -576,16 +577,20 @@ class WindowsSetup(PlatformSetup):
             return "buildconsole %(prj)s.sln /build /cfg=%(cfg)s" % {'prj': self.project_name, 'cfg': config}
 
         # 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)
         #return ('devenv.com %s.sln /build %s' % 
         #        (self.project_name, self.build_type))
 
     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.'
         while retries:
             retries = retries - 1
             print "develop.py tries to run:", command
+            ret = subprocess.call(command, executable=name)
             ret = os.system(command)
             print "got ret", ret, "from", command
             if ret:
@@ -617,18 +622,19 @@ 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):
         cwd = getcwd()
-        build_cmd = self.get_build_cmd()
+        executable, build_cmd = self.get_build_cmd()
 
         for d in self.build_dirs():
             try:
@@ -637,11 +643,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)
                 
-- 
cgit v1.2.3


From 6b33d5955a2c4ff34c17b58dd4a23b53a3c1dde7 Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Fri, 8 Jan 2010 17:42:22 -0800
Subject: DEV-44838 - See if the executable parameter to subprocess.Popen must
 be absolute on windows.

---
 indra/develop.py | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index 27c3d0ca2c..dc1190699c 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -587,6 +587,8 @@ class WindowsSetup(PlatformSetup):
     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.'
+        if not os.path.isfile(name):
+            name = self.find_in_path(name)
         while retries:
             retries = retries - 1
             print "develop.py tries to run:", command
-- 
cgit v1.2.3


From 61bc236b355e19bf09851b79c7d73b7210b4a7af Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Fri, 8 Jan 2010 17:58:56 -0800
Subject: DEV-44838 - Remove a typo line which would cause duplicate executions
 for every run call.

---
 indra/develop.py | 1 -
 1 file changed, 1 deletion(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index dc1190699c..e19ecb7314 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -593,7 +593,6 @@ class WindowsSetup(PlatformSetup):
             retries = retries - 1
             print "develop.py tries to run:", command
             ret = subprocess.call(command, executable=name)
-            ret = os.system(command)
             print "got ret", ret, "from", command
             if ret:
                 if name is None:
-- 
cgit v1.2.3


From 8246b382b732a9b49c49a012274cd17ce1af4e94 Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Fri, 8 Jan 2010 18:00:32 -0800
Subject: DEV-44838 - find_in_path() returns a list of candidates.  Select the
 first.

---
 indra/develop.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index e19ecb7314..17ac1b3801 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -588,7 +588,7 @@ class WindowsSetup(PlatformSetup):
         '''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.'
         if not os.path.isfile(name):
-            name = self.find_in_path(name)
+            name = self.find_in_path(name)[0]
         while retries:
             retries = retries - 1
             print "develop.py tries to run:", command
-- 
cgit v1.2.3


From f37f806660f66b064490b9c14d724273dc67fcbb Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Mon, 11 Jan 2010 10:38:13 -0800
Subject: DEV-44838 - Fix a bug introduced by inconsistently changing the
 get_build_cmd() interface.

---
 indra/develop.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index 17ac1b3801..a20badcfba 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -574,15 +574,15 @@ class WindowsSetup(PlatformSetup):
             if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]:
                 config = '\"%s|Win32\"' % config
 
-            return "buildconsole %(prj)s.sln /build /cfg=%(cfg)s" % {'prj': self.project_name, 'cfg': config}
+            executable = self.find_in_path('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.
         executable = '%sdevenv.com' % (self.find_visual_studio(),)
         cmd = ('"%s" %s.sln /build %s' % 
                 (executable, self.project_name, self.build_type))
         return (executable, cmd)
-        #return ('devenv.com %s.sln /build %s' % 
-        #        (self.project_name, self.build_type))
 
     def run(self, command, name=None, retry_on=None, retries=1):
         '''Run a program.  If the program fails, raise an exception.'''
-- 
cgit v1.2.3


From 11eac588c2e26b42e269da9394bbb8918552fb1c Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Mon, 11 Jan 2010 10:45:01 -0800
Subject: DEV-44838 - Fix another bug introduced by passing "executable" in
 WindowsSetup.run();  find_in_path() does not handle absolute paths, but name
 is guaranteed to be an absolute path.

This explains the bogus message in the log of the form "process $foo exited with nonzero status; process $foo is not found", described here:
https://jira.lindenlab.com/jira/browse/DEV-44838?focusedCommentId=328441&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_328441
---
 indra/develop.py | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index a20badcfba..71569f15d2 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -595,10 +595,7 @@ class WindowsSetup(PlatformSetup):
             ret = subprocess.call(command, executable=name)
             print "got ret", ret, "from", command
             if ret:
-                if name is None:
-                    name = command.split(None, 1)[0]
-                path = self.find_in_path(name)
-                if not path:
+                if not name:
                     error = 'was not found'
                 else:
                     error = 'exited with status %d' % ret
-- 
cgit v1.2.3


From 33df069238130a9e8c02a2aadcd41956780397db Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Mon, 11 Jan 2010 11:07:04 -0800
Subject: DEV-44838 - Fix a silly bug in yet another place: find_in_path
 returns a list, so select the first element.

---
 indra/develop.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index 71569f15d2..897fbb6544 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -574,7 +574,7 @@ class WindowsSetup(PlatformSetup):
             if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]:
                 config = '\"%s|Win32\"' % config
 
-            executable = self.find_in_path('buildconsole')
+            executable = self.find_in_path('buildconsole')[0]
             cmd = "%(bin)s %(prj)s.sln /build /cfg=%(cfg)s" % {'prj': self.project_name, 'cfg': config, 'bin': executable}
             return (executable, cmd)
 
-- 
cgit v1.2.3


From 2d337ca8c6b05ecd7e8d4a8f0c3d88fabcc5bcbc Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Mon, 11 Jan 2010 12:30:27 -0800
Subject: DEV-44838 - See if buildconsole is confused by having the absolute
 path (with spaces) in the commandline.  To accomplish this we put relative
 paths in the command string but lookup the absolute path for the executable
 parameter.

---
 indra/develop.py | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index 897fbb6544..b8fdd1a815 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -574,7 +574,7 @@ class WindowsSetup(PlatformSetup):
             if self.gens[self.generator]['ver'] in [ r'8.0', r'9.0' ]:
                 config = '\"%s|Win32\"' % config
 
-            executable = self.find_in_path('buildconsole')[0]
+            executable = 'buildconsole'
             cmd = "%(bin)s %(prj)s.sln /build /cfg=%(cfg)s" % {'prj': self.project_name, 'cfg': config, 'bin': executable}
             return (executable, cmd)
 
@@ -587,18 +587,17 @@ class WindowsSetup(PlatformSetup):
     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.'
-        if not os.path.isfile(name):
-            name = self.find_in_path(name)[0]
+        if os.path.isfile(name):
+            path = name
+        else:
+            path = self.find_in_path(name)[0]
         while retries:
             retries = retries - 1
             print "develop.py tries to run:", command
-            ret = subprocess.call(command, executable=name)
+            ret = subprocess.call(command, executable=path)
             print "got ret", ret, "from", command
             if ret:
-                if not name:
-                    error = 'was not found'
-                else:
-                    error = 'exited with status %d' % ret
+                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:
-- 
cgit v1.2.3


From dd7840aa9e0627430753522c4480212cf032463e Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Wed, 13 Jan 2010 15:47:57 -0800
Subject: Add an assertion for my sanity.

---
 indra/develop.py | 2 ++
 1 file changed, 2 insertions(+)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index b8fdd1a815..59722c4bc2 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -630,6 +630,8 @@ class WindowsSetup(PlatformSetup):
             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()
         executable, build_cmd = self.get_build_cmd()
 
-- 
cgit v1.2.3


From bee98d70e3a8eca7f6f6f80d4ee6a14939771ae0 Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Wed, 13 Jan 2010 16:08:30 -0800
Subject: DEV-44838 - Add the string "DEV-44838" to assertion failures to
 future devs understand preconditions on windows run().

---
 indra/develop.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index 59722c4bc2..a8a7b63aa7 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -586,7 +586,7 @@ class WindowsSetup(PlatformSetup):
 
     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.'
+        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:
-- 
cgit v1.2.3


From d194d95391f03b8a60c779f50f830df014e4b71e Mon Sep 17 00:00:00 2001
From: Nathan Wilcox <inoshiro@lindenlab.com>
Date: Wed, 13 Jan 2010 16:09:07 -0800
Subject: DEV-44838 - Fix a logic flaw in the windows run() retry code which
 would re-execute a process if its exit status was 0.

---
 indra/develop.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'indra/develop.py')

diff --git a/indra/develop.py b/indra/develop.py
index a8a7b63aa7..0a2d3c5e52 100755
--- a/indra/develop.py
+++ b/indra/develop.py
@@ -596,7 +596,9 @@ class WindowsSetup(PlatformSetup):
             print "develop.py tries to run:", command
             ret = subprocess.call(command, executable=path)
             print "got ret", ret, "from", command
-            if ret:
+            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)
-- 
cgit v1.2.3