|
3 | 3 | import os |
4 | 4 | from setuptools import find_packages, setup |
5 | 5 | from pyquicksetup import read_version, read_readme, default_cmdclass |
| 6 | +from pyquicksetup.pyquick import _SetupCommand |
6 | 7 |
|
7 | 8 | ######### |
8 | 9 | # settings |
|
37 | 38 | package_data = {} |
38 | 39 |
|
39 | 40 |
|
| 41 | +class SetupCommandSphinx(_SetupCommand): |
| 42 | + description = "Builds documentation." |
| 43 | + |
| 44 | + user_options = [ |
| 45 | + ("layout=", None, "format generation, default is html,rst."), |
| 46 | + ( |
| 47 | + "nbformats=", |
| 48 | + None, |
| 49 | + "format generation, default is ipynb,slides,html,python,rst,github", |
| 50 | + ), |
| 51 | + ] |
| 52 | + |
| 53 | + def initialize_options(self): |
| 54 | + self.layout = "html,rst" |
| 55 | + self.nbformats = "ipynb,html,python,rst,github" |
| 56 | + |
| 57 | + def finalize_options(self): |
| 58 | + pass |
| 59 | + |
| 60 | + def run(self): |
| 61 | + from pyquickhelper.pycode import process_standard_options_for_setup |
| 62 | + |
| 63 | + parameters = self.get_parameters() |
| 64 | + parameters["argv"] = ["build_sphinx"] |
| 65 | + parameters["layout"] = self.layout.split(",") |
| 66 | + parameters["nbformats"] = self.nbformats.split(",") |
| 67 | + process_standard_options_for_setup(**parameters) |
| 68 | + |
| 69 | + |
| 70 | +defcla = default_cmdclass().copy() |
| 71 | +defcla["build_sphinx"] = SetupCommandSphinx |
| 72 | + |
40 | 73 | setup( |
41 | 74 | name=project_var_name, |
42 | 75 | version=read_version(__file__, project_var_name), |
|
47 | 80 | download_url=f"https://github.com/sdpython/{project_var_name}/", |
48 | 81 | description=DESCRIPTION, |
49 | 82 | long_description=read_readme(__file__), |
50 | | - cmdclass=default_cmdclass(), |
| 83 | + cmdclass=defcla, |
51 | 84 | keywords=KEYWORDS, |
52 | 85 | classifiers=CLASSIFIERS, |
53 | 86 | packages=packages, |
|
0 commit comments