##// END OF EJS Templates
Make submodule checks work under Python 3....
Thomas Kluyver -
Show More
@@ -32,21 +32,14 b' def ipython_parent():'
32 32
33 33 def ipython_submodules(root):
34 34 """return IPython submodules relative to root"""
35 from IPython.frontend.html.notebook import DEFAULT_STATIC_FILES_PATH
36 35 return [
37 pjoin(DEFAULT_STATIC_FILES_PATH, 'components')
36 pjoin(root, 'IPython', 'frontend', 'html', 'notebook', 'static', 'components'),
38 37 ]
39 38
40 39 def is_repo(d):
41 40 """is d a git repo?"""
42 41 return os.path.exists(pjoin(d, '.git'))
43 42
44 def is_package():
45 """Is a package manager responsible for the static files path?"""
46 from IPython.utils.path import get_ipython_package_dir
47 from IPython.frontend.html.notebook import DEFAULT_STATIC_FILES_PATH
48 return not DEFAULT_STATIC_FILES_PATH.startswith(get_ipython_package_dir())
49
50 43 def check_submodule_status(root=None):
51 44 """check submodule status
52 45
@@ -60,13 +53,13 b' def check_submodule_status(root=None):'
60 53 if hasattr(sys, "frozen"):
61 54 # frozen via py2exe or similar, don't bother
62 55 return 'clean'
63
64 if is_package():
65 # package manager is responsible for static files, don't bother
66 return 'clean'
67 56
68 57 if not root:
69 58 root = ipython_parent()
59
60 if not is_repo(root):
61 # not in git, assume clean
62 return 'clean'
70 63
71 64 submodules = ipython_submodules(root)
72 65
@@ -74,10 +67,6 b' def check_submodule_status(root=None):'
74 67 if not os.path.exists(submodule):
75 68 return 'missing'
76 69
77 if not is_repo(root):
78 # not in git, assume clean
79 return 'clean'
80
81 70 # check with git submodule status
82 71 proc = subprocess.Popen('git submodule status',
83 72 stdout=subprocess.PIPE,
@@ -121,6 +121,8 b' def require_clean_submodules():'
121 121 after everything has been set in motion,
122 122 this is not a distutils command.
123 123 """
124 # PACKAGERS: Add a return here to skip checks for git submodules
125
124 126 # don't do anything if nothing is actually supposed to happen
125 127 for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'):
126 128 if do_nothing in sys.argv:
General Comments 0
You need to be logged in to leave comments. Login now