Show More
@@ -65,14 +65,7 b' from setupbase import (' | |||||
65 | find_data_files, |
|
65 | find_data_files, | |
66 | check_for_readline, |
|
66 | check_for_readline, | |
67 | git_prebuild, |
|
67 | git_prebuild, | |
68 | check_submodule_status, |
|
|||
69 | update_submodules, |
|
|||
70 | require_submodules, |
|
|||
71 | UpdateSubmodules, |
|
|||
72 | get_bdist_wheel, |
|
68 | get_bdist_wheel, | |
73 | CompileCSS, |
|
|||
74 | JavascriptVersion, |
|
|||
75 | css_js_prerelease, |
|
|||
76 | install_symlinked, |
|
69 | install_symlinked, | |
77 | install_lib_symlink, |
|
70 | install_lib_symlink, | |
78 | install_scripts_for_symlink, |
|
71 | install_scripts_for_symlink, | |
@@ -98,42 +91,6 b" if os_name == 'windows' and 'sdist' in sys.argv:" | |||||
98 | print('The sdist command is not available under Windows. Exiting.') |
|
91 | print('The sdist command is not available under Windows. Exiting.') | |
99 | sys.exit(1) |
|
92 | sys.exit(1) | |
100 |
|
93 | |||
101 | #------------------------------------------------------------------------------- |
|
|||
102 | # Make sure we aren't trying to run without submodules |
|
|||
103 | #------------------------------------------------------------------------------- |
|
|||
104 | here = os.path.abspath(os.path.dirname(__file__)) |
|
|||
105 |
|
||||
106 | def require_clean_submodules(): |
|
|||
107 | """Check on git submodules before distutils can do anything |
|
|||
108 |
|
||||
109 | Since distutils cannot be trusted to update the tree |
|
|||
110 | after everything has been set in motion, |
|
|||
111 | this is not a distutils command. |
|
|||
112 | """ |
|
|||
113 | # PACKAGERS: Add a return here to skip checks for git submodules |
|
|||
114 |
|
||||
115 | # don't do anything if nothing is actually supposed to happen |
|
|||
116 | for do_nothing in ('-h', '--help', '--help-commands', 'clean', 'submodule'): |
|
|||
117 | if do_nothing in sys.argv: |
|
|||
118 | return |
|
|||
119 |
|
||||
120 | status = check_submodule_status(here) |
|
|||
121 |
|
||||
122 | if status == "missing": |
|
|||
123 | print("checking out submodules for the first time") |
|
|||
124 | update_submodules(here) |
|
|||
125 | elif status == "unclean": |
|
|||
126 | print('\n'.join([ |
|
|||
127 | "Cannot build / install IPython with unclean submodules", |
|
|||
128 | "Please update submodules with", |
|
|||
129 | " python setup.py submodule", |
|
|||
130 | "or", |
|
|||
131 | " git submodule update", |
|
|||
132 | "or commit any submodule changes you have made." |
|
|||
133 | ])) |
|
|||
134 | sys.exit(1) |
|
|||
135 |
|
||||
136 | require_clean_submodules() |
|
|||
137 |
|
94 | |||
138 | #------------------------------------------------------------------------------- |
|
95 | #------------------------------------------------------------------------------- | |
139 | # Things related to the IPython documentation |
|
96 | # Things related to the IPython documentation | |
@@ -193,17 +150,14 b' class UploadWindowsInstallers(upload):' | |||||
193 | self.upload_file('bdist_wininst', 'any', dist_file) |
|
150 | self.upload_file('bdist_wininst', 'any', dist_file) | |
194 |
|
151 | |||
195 | setup_args['cmdclass'] = { |
|
152 | setup_args['cmdclass'] = { | |
196 |
'build_py': |
|
153 | 'build_py': \ | |
197 |
check_package_data_first(git_prebuild('IPython')) |
|
154 | check_package_data_first(git_prebuild('IPython')), | |
198 |
'sdist' : |
|
155 | 'sdist' : git_prebuild('IPython', sdist), | |
199 | 'upload_wininst' : UploadWindowsInstallers, |
|
156 | 'upload_wininst' : UploadWindowsInstallers, | |
200 | 'submodule' : UpdateSubmodules, |
|
|||
201 | 'css' : CompileCSS, |
|
|||
202 | 'symlink': install_symlinked, |
|
157 | 'symlink': install_symlinked, | |
203 | 'install_lib_symlink': install_lib_symlink, |
|
158 | 'install_lib_symlink': install_lib_symlink, | |
204 | 'install_scripts_sym': install_scripts_for_symlink, |
|
159 | 'install_scripts_sym': install_scripts_for_symlink, | |
205 | 'unsymlink': unsymlink, |
|
160 | 'unsymlink': unsymlink, | |
206 | 'jsversion' : JavascriptVersion, |
|
|||
207 | } |
|
161 | } | |
208 |
|
162 | |||
209 | ### Temporarily disable install while it's broken during the big split |
|
163 | ### Temporarily disable install while it's broken during the big split | |
@@ -254,20 +208,13 b' extras_require = dict(' | |||||
254 | terminal = [], |
|
208 | terminal = [], | |
255 | kernel = ['ipython_kernel'], |
|
209 | kernel = ['ipython_kernel'], | |
256 | nbformat = ['jupyter_nbformat'], |
|
210 | nbformat = ['jupyter_nbformat'], | |
257 | notebook = ['tornado>=4.0', pyzmq, 'jinja2', 'pygments', 'mistune>=0.5'], |
|
211 | notebook = ['jupyter_notebook'], | |
258 | nbconvert = ['pygments', 'jinja2', 'mistune>=0.3.1'] |
|
212 | nbconvert = ['jupyter_nbconvert'] | |
259 | ) |
|
213 | ) | |
260 |
|
214 | |||
261 | if not sys.platform.startswith('win'): |
|
|||
262 | extras_require['notebook'].append('terminado>=0.3.3') |
|
|||
263 |
|
||||
264 | if sys.version_info < (3, 3): |
|
215 | if sys.version_info < (3, 3): | |
265 | extras_require['test'].append('mock') |
|
216 | extras_require['test'].append('mock') | |
266 |
|
217 | |||
267 | extras_require['nbconvert'].extend(extras_require['nbformat']) |
|
|||
268 | extras_require['notebook'].extend(extras_require['kernel']) |
|
|||
269 | extras_require['notebook'].extend(extras_require['nbconvert']) |
|
|||
270 |
|
||||
271 | install_requires = [ |
|
218 | install_requires = [ | |
272 | 'decorator', |
|
219 | 'decorator', | |
273 | 'pickleshare', |
|
220 | 'pickleshare', | |
@@ -292,10 +239,7 b' for deps in extras_require.values():' | |||||
292 | extras_require['all'] = everything |
|
239 | extras_require['all'] = everything | |
293 |
|
240 | |||
294 | if 'setuptools' in sys.modules: |
|
241 | if 'setuptools' in sys.modules: | |
295 | # setup.py develop should check for submodules |
|
242 | setup_args['cmdclass']['bdist_wheel'] = get_bdist_wheel() | |
296 | from setuptools.command.develop import develop |
|
|||
297 | setup_args['cmdclass']['develop'] = require_submodules(develop) |
|
|||
298 | setup_args['cmdclass']['bdist_wheel'] = css_js_prerelease(get_bdist_wheel()) |
|
|||
299 |
|
243 | |||
300 | setuptools_extra_args['zip_safe'] = False |
|
244 | setuptools_extra_args['zip_safe'] = False | |
301 | setuptools_extra_args['entry_points'] = { |
|
245 | setuptools_extra_args['entry_points'] = { |
@@ -124,73 +124,11 b' def find_package_data():' | |||||
124 | # This is not enough for these things to appear in an sdist. |
|
124 | # This is not enough for these things to appear in an sdist. | |
125 | # We need to muck with the MANIFEST to get this to work |
|
125 | # We need to muck with the MANIFEST to get this to work | |
126 |
|
126 | |||
127 | # exclude components and less from the walk; |
|
|||
128 | # we will build the components separately |
|
|||
129 | # excludes = [ |
|
|||
130 | # pjoin('static', 'components'), |
|
|||
131 | # pjoin('static', '*', 'less'), |
|
|||
132 | # ] |
|
|||
133 | # |
|
|||
134 | # # walk notebook resources: |
|
|||
135 | # cwd = os.getcwd() |
|
|||
136 | # os.chdir(os.path.join('IPython', 'html')) |
|
|||
137 | # static_data = [] |
|
|||
138 | # for parent, dirs, files in os.walk('static'): |
|
|||
139 | # if any(fnmatch(parent, pat) for pat in excludes): |
|
|||
140 | # # prevent descending into subdirs |
|
|||
141 | # dirs[:] = [] |
|
|||
142 | # continue |
|
|||
143 | # for f in files: |
|
|||
144 | # static_data.append(pjoin(parent, f)) |
|
|||
145 | # |
|
|||
146 | # components = pjoin("static", "components") |
|
|||
147 | # # select the components we actually need to install |
|
|||
148 | # # (there are lots of resources we bundle for sdist-reasons that we don't actually use) |
|
|||
149 | # static_data.extend([ |
|
|||
150 | # pjoin(components, "backbone", "backbone-min.js"), |
|
|||
151 | # pjoin(components, "bootstrap", "js", "bootstrap.min.js"), |
|
|||
152 | # pjoin(components, "bootstrap-tour", "build", "css", "bootstrap-tour.min.css"), |
|
|||
153 | # pjoin(components, "bootstrap-tour", "build", "js", "bootstrap-tour.min.js"), |
|
|||
154 | # pjoin(components, "es6-promise", "*.js"), |
|
|||
155 | # pjoin(components, "font-awesome", "fonts", "*.*"), |
|
|||
156 | # pjoin(components, "google-caja", "html-css-sanitizer-minified.js"), |
|
|||
157 | # pjoin(components, "jquery", "jquery.min.js"), |
|
|||
158 | # pjoin(components, "jquery-ui", "ui", "minified", "jquery-ui.min.js"), |
|
|||
159 | # pjoin(components, "jquery-ui", "themes", "smoothness", "jquery-ui.min.css"), |
|
|||
160 | # pjoin(components, "jquery-ui", "themes", "smoothness", "images", "*"), |
|
|||
161 | # pjoin(components, "marked", "lib", "marked.js"), |
|
|||
162 | # pjoin(components, "requirejs", "require.js"), |
|
|||
163 | # pjoin(components, "underscore", "underscore-min.js"), |
|
|||
164 | # pjoin(components, "moment", "moment.js"), |
|
|||
165 | # pjoin(components, "moment", "min", "moment.min.js"), |
|
|||
166 | # pjoin(components, "term.js", "src", "term.js"), |
|
|||
167 | # pjoin(components, "text-encoding", "lib", "encoding.js"), |
|
|||
168 | # ]) |
|
|||
169 | # |
|
|||
170 | # # Ship all of Codemirror's CSS and JS |
|
|||
171 | # for parent, dirs, files in os.walk(pjoin(components, 'codemirror')): |
|
|||
172 | # for f in files: |
|
|||
173 | # if f.endswith(('.js', '.css')): |
|
|||
174 | # static_data.append(pjoin(parent, f)) |
|
|||
175 | # |
|
|||
176 | # os.chdir(os.path.join('tests',)) |
|
|||
177 | # js_tests = glob('*.js') + glob('*/*.js') |
|
|||
178 |
|
||||
179 | # os.chdir(cwd) |
|
|||
180 |
|
||||
181 | package_data = { |
|
127 | package_data = { | |
182 | 'IPython.core' : ['profile/README*'], |
|
128 | 'IPython.core' : ['profile/README*'], | |
183 | 'IPython.core.tests' : ['*.png', '*.jpg'], |
|
129 | 'IPython.core.tests' : ['*.png', '*.jpg'], | |
184 | 'IPython.lib.tests' : ['*.wav'], |
|
130 | 'IPython.lib.tests' : ['*.wav'], | |
185 | 'IPython.testing.plugin' : ['*.txt'], |
|
131 | 'IPython.testing.plugin' : ['*.txt'], | |
186 | # 'IPython.html' : ['templates/*'] + static_data, |
|
|||
187 | # 'IPython.html.tests' : js_tests, |
|
|||
188 | # 'IPython.nbformat' : [ |
|
|||
189 | # 'tests/*.ipynb', |
|
|||
190 | # 'v3/nbformat.v3.schema.json', |
|
|||
191 | # 'v4/nbformat.v4.schema.json', |
|
|||
192 | # ], |
|
|||
193 | # 'IPython.kernel': ['resources/*.*'], |
|
|||
194 | } |
|
132 | } | |
195 |
|
133 | |||
196 | return package_data |
|
134 | return package_data | |
@@ -497,36 +435,6 b' def check_for_readline():' | |||||
497 | # VCS related |
|
435 | # VCS related | |
498 | #--------------------------------------------------------------------------- |
|
436 | #--------------------------------------------------------------------------- | |
499 |
|
437 | |||
500 | # utils.submodule has checks for submodule status |
|
|||
501 | execfile(pjoin('IPython','utils','submodule.py'), globals()) |
|
|||
502 |
|
||||
503 | class UpdateSubmodules(Command): |
|
|||
504 | """Update git submodules |
|
|||
505 |
|
||||
506 | IPython's external javascript dependencies live in a separate repo. |
|
|||
507 | """ |
|
|||
508 | description = "Update git submodules" |
|
|||
509 | user_options = [] |
|
|||
510 |
|
||||
511 | def initialize_options(self): |
|
|||
512 | pass |
|
|||
513 |
|
||||
514 | def finalize_options(self): |
|
|||
515 | pass |
|
|||
516 |
|
||||
517 | def run(self): |
|
|||
518 | failure = False |
|
|||
519 | try: |
|
|||
520 | self.spawn('git submodule init'.split()) |
|
|||
521 | self.spawn('git submodule update --recursive'.split()) |
|
|||
522 | except Exception as e: |
|
|||
523 | failure = e |
|
|||
524 | print(e) |
|
|||
525 |
|
||||
526 | if not check_submodule_status(repo_root) == 'clean': |
|
|||
527 | print("submodules could not be checked out") |
|
|||
528 | sys.exit(1) |
|
|||
529 |
|
||||
530 |
|
438 | |||
531 | def git_prebuild(pkg_dir, build_cmd=build_py): |
|
439 | def git_prebuild(pkg_dir, build_cmd=build_py): | |
532 | """Return extended build or sdist command class for recording commit |
|
440 | """Return extended build or sdist command class for recording commit | |
@@ -534,8 +442,6 b' def git_prebuild(pkg_dir, build_cmd=build_py):' | |||||
534 | records git commit in IPython.utils._sysinfo.commit |
|
442 | records git commit in IPython.utils._sysinfo.commit | |
535 |
|
443 | |||
536 | for use in IPython.utils.sysinfo.sys_info() calls after installation. |
|
444 | for use in IPython.utils.sysinfo.sys_info() calls after installation. | |
537 |
|
||||
538 | Also ensures that submodules exist prior to running |
|
|||
539 | """ |
|
445 | """ | |
540 |
|
446 | |||
541 | class MyBuildPy(build_cmd): |
|
447 | class MyBuildPy(build_cmd): | |
@@ -577,18 +483,9 b' def git_prebuild(pkg_dir, build_cmd=build_py):' | |||||
577 | '# GENERATED BY setup.py\n', |
|
483 | '# GENERATED BY setup.py\n', | |
578 | 'commit = u"%s"\n' % repo_commit, |
|
484 | 'commit = u"%s"\n' % repo_commit, | |
579 | ]) |
|
485 | ]) | |
580 |
return |
|
486 | return MyBuildPy | |
581 |
|
487 | |||
582 |
|
488 | |||
583 | def require_submodules(command): |
|
|||
584 | """decorator for instructing a command to check for submodules before running""" |
|
|||
585 | class DecoratedCommand(command): |
|
|||
586 | def run(self): |
|
|||
587 | if not check_submodule_status(repo_root) == 'clean': |
|
|||
588 | print("submodules missing! Run `setup.py submodule` and try again") |
|
|||
589 | sys.exit(1) |
|
|||
590 | command.run(self) |
|
|||
591 | return DecoratedCommand |
|
|||
592 |
|
489 | |||
593 | #--------------------------------------------------------------------------- |
|
490 | #--------------------------------------------------------------------------- | |
594 | # bdist related |
|
491 | # bdist related | |
@@ -644,8 +541,6 b' def get_bdist_wheel():' | |||||
644 | for pkg in ("gnureadline", "pyreadline", "mock", "terminado", "appnope", "pexpect"): |
|
541 | for pkg in ("gnureadline", "pyreadline", "mock", "terminado", "appnope", "pexpect"): | |
645 | _remove_startswith(requires, pkg) |
|
542 | _remove_startswith(requires, pkg) | |
646 | requires.append("gnureadline; sys.platform == 'darwin' and platform.python_implementation == 'CPython'") |
|
543 | requires.append("gnureadline; sys.platform == 'darwin' and platform.python_implementation == 'CPython'") | |
647 | requires.append("terminado (>=0.3.3); extra == 'notebook' and sys.platform != 'win32'") |
|
|||
648 | requires.append("terminado (>=0.3.3); extra == 'all' and sys.platform != 'win32'") |
|
|||
649 | requires.append("pyreadline (>=2.0); extra == 'terminal' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") |
|
544 | requires.append("pyreadline (>=2.0); extra == 'terminal' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") | |
650 | requires.append("pyreadline (>=2.0); extra == 'all' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") |
|
545 | requires.append("pyreadline (>=2.0); extra == 'all' and sys.platform == 'win32' and platform.python_implementation == 'CPython'") | |
651 | requires.append("mock; extra == 'test' and python_version < '3.3'") |
|
546 | requires.append("mock; extra == 'test' and python_version < '3.3'") | |
@@ -657,85 +552,3 b' def get_bdist_wheel():' | |||||
657 |
|
552 | |||
658 | return bdist_wheel_tag |
|
553 | return bdist_wheel_tag | |
659 |
|
554 | |||
660 | #--------------------------------------------------------------------------- |
|
|||
661 | # Notebook related |
|
|||
662 | #--------------------------------------------------------------------------- |
|
|||
663 |
|
||||
664 | class CompileCSS(Command): |
|
|||
665 | """Recompile Notebook CSS |
|
|||
666 |
|
||||
667 | Regenerate the compiled CSS from LESS sources. |
|
|||
668 |
|
||||
669 | Requires various dev dependencies, such as invoke and lessc. |
|
|||
670 | """ |
|
|||
671 | description = "Recompile Notebook CSS" |
|
|||
672 | user_options = [ |
|
|||
673 | ('minify', 'x', "minify CSS"), |
|
|||
674 | ('force', 'f', "force recompilation of CSS"), |
|
|||
675 | ] |
|
|||
676 |
|
||||
677 | def initialize_options(self): |
|
|||
678 | self.minify = False |
|
|||
679 | self.force = False |
|
|||
680 |
|
||||
681 | def finalize_options(self): |
|
|||
682 | self.minify = bool(self.minify) |
|
|||
683 | self.force = bool(self.force) |
|
|||
684 |
|
||||
685 | def run(self): |
|
|||
686 | cmd = ['invoke', 'css'] |
|
|||
687 | if self.minify: |
|
|||
688 | cmd.append('--minify') |
|
|||
689 | if self.force: |
|
|||
690 | cmd.append('--force') |
|
|||
691 | try: |
|
|||
692 | p = Popen(cmd, cwd=pjoin(repo_root, "jupyter_notebook"), stderr=PIPE) |
|
|||
693 | except OSError: |
|
|||
694 | raise DistutilsExecError("invoke is required to rebuild css (pip install invoke)") |
|
|||
695 | out, err = p.communicate() |
|
|||
696 | if p.returncode: |
|
|||
697 | if sys.version_info[0] >= 3: |
|
|||
698 | err = err.decode('utf8', 'replace') |
|
|||
699 | raise DistutilsExecError(err.strip()) |
|
|||
700 |
|
||||
701 |
|
||||
702 | class JavascriptVersion(Command): |
|
|||
703 | """write the javascript version to notebook javascript""" |
|
|||
704 | description = "Write IPython version to javascript" |
|
|||
705 | user_options = [] |
|
|||
706 |
|
||||
707 | def initialize_options(self): |
|
|||
708 | pass |
|
|||
709 |
|
||||
710 | def finalize_options(self): |
|
|||
711 | pass |
|
|||
712 |
|
||||
713 | def run(self): |
|
|||
714 | nsfile = pjoin(repo_root, "jupyter_notebook", "static", "base", "js", "namespace.js") |
|
|||
715 | with open(nsfile) as f: |
|
|||
716 | lines = f.readlines() |
|
|||
717 | with open(nsfile, 'w') as f: |
|
|||
718 | found = False |
|
|||
719 | for line in lines: |
|
|||
720 | if line.strip().startswith("IPython.version"): |
|
|||
721 | line = ' IPython.version = "{0}";\n'.format(version) |
|
|||
722 | found = True |
|
|||
723 | f.write(line) |
|
|||
724 | if not found: |
|
|||
725 | raise RuntimeError("Didn't find IPython.version line in %s" % nsfile) |
|
|||
726 |
|
||||
727 |
|
||||
728 | def css_js_prerelease(command): |
|
|||
729 | """decorator for building js/minified css prior to a release""" |
|
|||
730 | class DecoratedCommand(command): |
|
|||
731 | def run(self): |
|
|||
732 | self.distribution.run_command('jsversion') |
|
|||
733 | css = self.distribution.get_command_obj('css') |
|
|||
734 | css.minify = True |
|
|||
735 | try: |
|
|||
736 | self.distribution.run_command('css') |
|
|||
737 | except Exception as e: |
|
|||
738 | log.warn("rebuilding css and sourcemaps failed (not a problem)") |
|
|||
739 | log.warn(str(e)) |
|
|||
740 | command.run(self) |
|
|||
741 | return DecoratedCommand |
|
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
1 | NO CONTENT: file was removed |
|
NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now