#NEWLINE# def setup( self ) : #NEWLINE# #INDENT# 'Prepare the repository and virtualenvs.' #NEWLINE# try : #NEWLINE# #INDENT# os . mkdir ( basedir ) #NEWLINE# #UNINDENT# except OSError as e : #NEWLINE# #INDENT# if ( e . errno != errno . EEXIST ) : #NEWLINE# #INDENT# raise #NEWLINE# #UNINDENT# #UNINDENT# os . chdir ( basedir ) #NEWLINE# for venv in glob ( 'venv-*' ) : #NEWLINE# #INDENT# shutil . rmtree ( venv ) #NEWLINE# #UNINDENT# for py in self . available_python_versions ( ) : #NEWLINE# #INDENT# check_call ( [ 'virtualenv' , '-p' , py , '--system-site-packages' , ( 'venv-%s' % py ) ] ) #NEWLINE# self . venvs . append ( ( py , ( 'venv-%s' % py ) ) ) #NEWLINE# #UNINDENT# if ( not os . path . exists ( 'networkx' ) ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# check_call ( [ 'git' , 'clone' , nx_repository ] ) #NEWLINE# #UNINDENT# except CalledProcessError : #NEWLINE# #INDENT# check_call ( [ 'git' , 'clone' , nx_http_repository ] ) #NEWLINE# #UNINDENT# #UNINDENT# os . chdir ( repodir ) #NEWLINE# check_call ( [ 'git' , 'checkout' , 'master' ] ) #NEWLINE# try : #NEWLINE# #INDENT# check_call ( [ 'git' , 'pull' , 'origin' , 'master' ] ) #NEWLINE# #UNINDENT# except CalledProcessError : #NEWLINE# #INDENT# check_call ( [ 'git' , 'pull' , nx_http_repository , 'master' ] ) #NEWLINE# #UNINDENT# self . master_sha = check_output ( [ 'git' , 'log' , '-1' , '--format=%h' ] ) . decode ( 'ascii' ) . strip ( ) #NEWLINE# os . chdir ( basedir )