Changeset 4586
- Timestamp:
- 10/12/08 09:46:33 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/python/ndg-security-install.py
r4404 r4586 1 1 #!/usr/bin/env python 2 """Install NDG Server package with M2Crypto build settings and to include 3 Twisted 2 """Install NDG Server package with M2Crypto build settings 4 3 5 4 NERC Data Grid Project … … 39 38 @type dependencyLink: string 40 39 41 @cvar defaultTwistedURI: default location for Twisted download42 @type param: string43 44 40 @cvar configDir: default location for configuration directory "conf" 45 41 @type configDir: string''' 46 42 47 43 dependencyLink = "http://ndg.nerc.ac.uk/dist/" 48 defaultTwistedURI = \49 'http://tmrc.mit.edu/mirror/twisted/Twisted/2.2/TwistedSumo-2006-02-12.tar.bz2'50 44 configDir = os.path.join("/etc", "ndg", "security", "conf") 51 45 … … 91 85 default='/usr/local/ssl', 92 86 help="Path to openssl for M2Crypto to link with") 93 94 parser.add_option("-n",95 "--no-twisted",96 dest="noTwisted",97 action="store_true",98 default=False,99 help=\100 """Skip Twisted install. This option applies to the \"all\" and \"server\"101 package options only. Twisted is not needed for the client.""")102 103 parser.add_option("-t",104 "--twisted-uri",105 dest="twistedURI",106 default=self.__class__.defaultTwistedURI,107 help=\108 """Provide an alternative location for Twisted download. A .tar.bz type file109 is expected. The default is \"%s\"""" % self.__class__.defaultTwistedURI)110 87 111 88 parser.add_option("-f", … … 167 144 args += ["ndg_security_server"] 168 145 main(args) 169 self.installTwisted()170 146 171 147 # Config dir is part of server package only … … 176 152 args += ["ndg_security_test"] 177 153 main(args) 178 self.installTwisted()179 154 180 155 elif self.opt.installAll: … … 188 163 "ndg_security_client"] 189 164 main(args) 190 self.installTwisted()191 165 192 166 # Config dir is part of server package … … 247 221 '.pydistutils.cfg') 248 222 configParser.write(open(distutilsCfgFilePath, 'w')) 249 250 251 def installTwisted(self):252 '''Download and install twisted manually as it is not egg compatible253 '''254 255 if self.opt.noTwisted:256 return257 258 log.info("Installing Twisted: %s ..." % self.opt.twistedURI)259 260 # Install Twisted sumo261 try:262 twistedTarBz = os.path.basename(self.opt.twistedURI)263 urllib.urlretrieve(self.opt.twistedURI, twistedTarBz)264 265 except IOError, (errMsg, e):266 raise SecurityInstallError, \267 'Error retrieving Twisted from "%s": %s' % \268 (self.opt.twistedTarURI, e[1])269 except Exception, e:270 raise SecurityInstallError, \271 'Error retrieving Twisted from "%s": %s' % \272 (self.opt.twistedTarURI, e)273 274 import tarfile275 276 twistedTar = tarfile.open(twistedTarBz, 'r:bz2')277 for tarInfo in twistedTar:278 twistedTar.extract(tarInfo)279 280 try:281 twistedDir=os.path.splitext(os.path.splitext(twistedTarBz)[0])[0]282 except Exception:283 raise SecurityInstallError, \284 'Error getting Twisted dir path from tar.bz file name: "%s"' % \285 twistedTarBz286 287 os.chdir(twistedDir)288 try:289 retCode = call([os.path.join(sys.prefix, 'bin', 'python'),290 'setup.py',291 'install'])292 except OSError, e:293 raise SecurityInstallError, \294 "Error calling setup install for Twisted: " + str(e)295 296 if retCode != 0:297 raise SecurityInstallError, "Twisted setup install returned %d" %\298 retCode299 300 os.chdir('..')301 223 302 224
Note: See TracChangeset
for help on using the changeset viewer.