comparison paint/package.py @ 38:c9d8abb2026f

error handling
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 15:10:49 -0700
parents 36e70712fc9a
children cc25499e9485
comparison
equal deleted inserted replaced
37:36e70712fc9a 38:c9d8abb2026f
122 setup_py = os.path.join(directory, 'setup.py') 122 setup_py = os.path.join(directory, 'setup.py')
123 if not os.path.exists(setup_py): 123 if not os.path.exists(setup_py):
124 raise AssertionError("%s does not exist" % setup_py) 124 raise AssertionError("%s does not exist" % setup_py)
125 125
126 # setup the egg info 126 # setup the egg info
127 call([sys.executable, 'setup.py', 'egg_info'], cwd=directory, stdout=subprocess.PIPE) 127 try:
128 call([sys.executable, 'setup.py', 'egg_info'], cwd=directory, stdout=subprocess.PIPE)
129 except BaseException, e:
130 print "Failure to generate egg_info"
131 print ' - src: %s' % self.src
132 print ' - directory: %s' % directory
133 raise
128 134
129 # get the .egg-info directory 135 # get the .egg-info directory
130 egg_info = [i for i in os.listdir(directory) 136 egg_info = [i for i in os.listdir(directory)
131 if i.endswith('.egg-info')] 137 if i.endswith('.egg-info')]
132 assert len(egg_info) == 1, 'Expected one .egg-info directory in %s, got: %s' % (directory, egg_info) 138 assert len(egg_info) == 1, 'Expected one .egg-info directory in %s, got: %s' % (directory, egg_info)