#NEWLINE# def _build_egg( egg , tarball , to_dir ) : #NEWLINE# #INDENT# tmpdir = tempfile . mkdtemp ( ) #NEWLINE# log . warn ( 'Extracting in %s' , tmpdir ) #NEWLINE# old_wd = os . getcwd ( ) #NEWLINE# try : #NEWLINE# #INDENT# os . chdir ( tmpdir ) #NEWLINE# tar = tarfile . open ( tarball ) #NEWLINE# _extractall ( tar ) #NEWLINE# tar . close ( ) #NEWLINE# subdir = os . path . join ( tmpdir , os . listdir ( tmpdir ) [ 0 ] ) #NEWLINE# os . chdir ( subdir ) #NEWLINE# log . warn ( 'Now working in %s' , subdir ) #NEWLINE# log . warn ( 'Building a Distribute egg in %s' , to_dir ) #NEWLINE# _python_cmd ( 'setup.py' , '-q' , 'bdist_egg' , '--dist-dir' , old_wd ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# os . chdir ( old_wd ) #NEWLINE# #UNINDENT# log . warn ( egg ) #NEWLINE# if ( not os . path . exists ( egg ) ) : #NEWLINE# #INDENT# raise IOError ( 'Could not build the egg.' )