Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make submodule checks work under Python 3. #3387

Merged
merged 1 commit into from
May 30, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 5 additions & 16 deletions IPython/utils/submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,14 @@ def ipython_parent():

def ipython_submodules(root):
"""return IPython submodules relative to root"""
from IPython.frontend.html.notebook import DEFAULT_STATIC_FILES_PATH
return [
pjoin(DEFAULT_STATIC_FILES_PATH, 'components')
pjoin(root, 'IPython', 'frontend', 'html', 'notebook', 'static', 'components'),
]

def is_repo(d):
"""is d a git repo?"""
return os.path.exists(pjoin(d, '.git'))

def is_package():
"""Is a package manager responsible for the static files path?"""
from IPython.utils.path import get_ipython_package_dir
from IPython.frontend.html.notebook import DEFAULT_STATIC_FILES_PATH
return not DEFAULT_STATIC_FILES_PATH.startswith(get_ipython_package_dir())

def check_submodule_status(root=None):
"""check submodule status

Expand All @@ -60,24 +53,20 @@ def check_submodule_status(root=None):
if hasattr(sys, "frozen"):
# frozen via py2exe or similar, don't bother
return 'clean'

if is_package():
# package manager is responsible for static files, don't bother
return 'clean'

if not root:
root = ipython_parent()

if not is_repo(root):
# not in git, assume clean
return 'clean'

submodules = ipython_submodules(root)

for submodule in submodules:
if not os.path.exists(submodule):
return 'missing'

if not is_repo(root):
# not in git, assume clean
return 'clean'

# check with git submodule status
proc = subprocess.Popen('git submodule status',
stdout=subprocess.PIPE,
Expand Down
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ def require_clean_submodules():
after everything has been set in motion,
this is not a distutils command.
"""
# PACKAGERS: Add a return here to skip checks for git submodules

# don't do anything if nothing is actually supposed to happen
for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
if do_nothing in sys.argv:
Expand Down