@ -373,27 +373,10 @@ def check_for_dependencies():
# VCS related
#---------------------------------------------------------------------------
def check_for_submodules ( ) :
""" return False if there are any submodules that need to be checked out,
True otherwise .
This doesn ' t check if they are up to date, only existence.
"""
here = os . path . dirname ( __file__ )
submodules = [
os . path . join ( here , ' IPython ' , ' frontend ' , ' html ' , ' notebook ' , ' static ' , ' components ' )
]
for submodule in submodules :
if not os . path . exists ( submodule ) :
return False
return True
here = os . path . abspath ( os . path . dirname ( __file__ ) )
def update_submodules ( ) :
""" update git submodules """
import subprocess
print ( " updating git submodules " )
subprocess . check_call ( ' git submodule init ' . split ( ) )
subprocess . check_call ( ' git submodule update --recursive ' . split ( ) )
# utils.submodule has checks for submodule status
execfile ( pjoin ( ' IPython ' , ' utils ' , ' submodule.py ' ) , globals ( ) )
class UpdateSubmodules ( Command ) :
""" Update git submodules
@ -418,12 +401,10 @@ class UpdateSubmodules(Command):
failure = e
print ( e )
if not check_ for_ submodules( ) :
if not check_ submodule_statu s( here ) == ' clean ' :
print ( " submodules could not be checked out " )
sys . exit ( 1 )
# re-scan package data after update
self . distribution . package_data = find_package_data ( )
def git_prebuild ( pkg_dir , build_cmd = build_py ) :
""" Return extended build or sdist command class for recording commit
@ -438,10 +419,6 @@ def git_prebuild(pkg_dir, build_cmd=build_py):
class MyBuildPy ( build_cmd ) :
''' Subclass to write commit data into installation tree '''
def run ( self ) :
if not check_for_submodules ( ) :
print ( " submodules missing! Run `setup.py submodule` and try again " )
sys . exit ( 1 )
build_cmd . run ( self )
# this one will only fire for build commands
if hasattr ( self , ' build_lib ' ) :
@ -478,14 +455,14 @@ def git_prebuild(pkg_dir, build_cmd=build_py):
' # GENERATED BY setup.py \n ' ,
' commit = " %s " \n ' % repo_commit ,
] )
return MyBuildPy
return require_submodules( MyBuildPy)
def require_submodules ( command ) :
""" decorator for instructing a command to check for submodules before running """
class DecoratedCommand ( command ) :
def run ( self ) :
if not check_ for_ submodules( ) :
if not check_ submodule_statu s( here ) == ' clean ' :
print ( " submodules missing! Run `setup.py submodule` and try again " )
sys . exit ( 1 )
command . run ( self )