From 61a7dae37b5ea231d3a449f9e65bc2caaaafef16 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Tue, 15 Sep 2009 02:19:49 -0700 Subject: Applied patch by Robin Cornelius for VWR-11138 - Make develop.py play nicely with express editions of Visual Studio --- linden/indra/develop.py | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'linden') diff --git a/linden/indra/develop.py b/linden/indra/develop.py index bd8f080..207a48b 100755 --- a/linden/indra/develop.py +++ b/linden/indra/develop.py @@ -469,8 +469,15 @@ class WindowsSetup(PlatformSetup): print 'Building with ', self.gens[version]['gen'] break else: - print >> sys.stderr, 'Cannot find a Visual Studio installation!' - eys.exit(1) + print >> sys.stderr, 'Cannot find a Visual Studio installation, testing for express editions' + for version in 'vc80 vc90 vc71'.split(): + if self.find_visual_studio_express(version): + self._generator = version + print 'Building with ', self.gens[version]['gen'] , "Express edition" + break + else: + print >> sys.stderr, 'Cannot find any Visual Studio installation' + eys.exit(1) return self._generator def _set_generator(self, gen): @@ -523,6 +530,28 @@ class WindowsSetup(PlatformSetup): print >> sys.stderr, "Didn't find ", self.gens[gen]['gen'] return '' + def find_visual_studio_express(self, gen=None): + if gen is None: + gen = self._generator + gen = gen.lower() + try: + import _winreg + key_str = (r'SOFTWARE\Microsoft\VCEXpress\%s\Setup\VC' % + self.gens[gen]['ver']) + value_str = (r'ProductDir') + print ('Reading VS environment from HKEY_LOCAL_MACHINE\%s\%s' % + (key_str, value_str)) + print key_str + + reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) + key = _winreg.OpenKey(reg, key_str) + value = _winreg.QueryValueEx(key, value_str)[0]+"IDE" + print 'Found: %s' % value + return value + except WindowsError, err: + print >> sys.stderr, "Didn't find ", self.gens[gen]['gen'] + return '' + def get_build_cmd(self): if self.incredibuild: config = self.build_type @@ -530,10 +559,23 @@ class WindowsSetup(PlatformSetup): config = '\"%s|Win32\"' % config return "buildconsole %s.sln /build %s" % (self.project_name, config) + + environment = self.find_visual_studio() + if environment == '': + environment = self.find_visual_studio_express() + if environment == '': + print >> sys.stderr, "Something went very wrong during build stage, could not find a Visual Studio?" + else: + print >> sys.stderr, "\nSolution generation complete, as you are using an express edition the final\n stages will need to be completed by hand" + build_dirs=self.build_dirs(); + print >> sys.stderr, "Solution can now be found in:", build_dirs[0] + print >> sys.stderr, "Set %s as startup project" % self.project_name + print >> sys.stderr, "Set build target is Release or RelWithDbgInfo" + exit(0) # 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)) + (environment, self.project_name, self.build_type)) # this override of run exists because the PlatformSetup version # uses Unix/Mac only calls. Freakin' os module! -- cgit v1.1