2626from paths import SP_PACKAGES_PATH
2727from paths import CUSTOM_PACKAGES_PATH
2828from paths import PLUGIN_PATH
29+ # Plugins
30+ from plugins .manager import plugin_manager
2931
3032
3133# =============================================================================
@@ -42,11 +44,13 @@ def _sp_docs_create(command_info, package):
4244 """Create a Sphinx project."""
4345 _create_sphinx_project (package )
4446
47+
4548@core_command .server_sub_command (['docs' , 'generate' ])
4649def _sp_docs_generate (command_info , package ):
4750 """Generate a Sphinx project."""
4851 _generate_sphinx_project (package )
4952
53+
5054@core_command .server_sub_command (['docs' , 'build' ])
5155def _sp_docs_build (command_info , package ):
5256 """Build a Sphinx project."""
@@ -70,6 +74,7 @@ def _create_sphinx_project(package):
7074 ' Project name must be source-python, ' +
7175 'a custom package name, or a plugin name.' )
7276
77+
7378def _create_source_python_docs ():
7479 """Create a Sphinx project for Source.Python."""
7580 project = SphinxProject (SP_PACKAGES_PATH , SP_DOCS_PATH )
@@ -88,6 +93,7 @@ def _create_source_python_docs():
8893 logger .log_message (
8994 'Sphinx project has been created for Source.Python.' )
9095
96+
9197def _create_custom_package_docs (package ):
9298 """Create a Sphinx project for a custom package."""
9399 project = SphinxProject (
@@ -109,6 +115,7 @@ def _create_custom_package_docs(package):
109115 'Sphinx project has been created for' +
110116 ' custom package "{0}".' .format (package ))
111117
118+
112119def _create_plugin_docs (package ):
113120 """Create a Sphinx project for a plugin."""
114121 project = SphinxProject (
@@ -147,6 +154,7 @@ def _generate_sphinx_project(package):
147154 ' Project name must be source-python, ' +
148155 'a custom package name, or a plugin name.' )
149156
157+
150158def _generate_source_python_docs ():
151159 """Generate Sphinx project files for Source.Python."""
152160 project = SphinxProject (SP_PACKAGES_PATH , SP_DOCS_PATH )
@@ -169,6 +177,7 @@ def _generate_source_python_docs():
169177 logger .log_message (
170178 'Sphinx project does not exist for Source.Python.' )
171179
180+
172181def _prepare_generated_source_python_file (file_path ):
173182 """Rename the generated file if it wasn't already renamed.
174183
@@ -224,6 +233,7 @@ def write_next_4_lines(current):
224233 else :
225234 f .write (line )
226235
236+
227237def _generate_custom_package_docs (package ):
228238 """Generate Sphinx project files for a custom package."""
229239 project = SphinxProject (
@@ -245,6 +255,7 @@ def _generate_custom_package_docs(package):
245255 'Sphinx project does not exist for ' +
246256 'custom package "{0}".' .format (package ))
247257
258+
248259def _generate_plugin_docs (package ):
249260 """Generate Sphinx project files for a plugin."""
250261 project = SphinxProject (
@@ -283,6 +294,7 @@ def _build_sphinx_project(package):
283294 ' Project name must be source-python, ' +
284295 'a custom package name, or a plugin name.' )
285296
297+
286298def _build_source_python_docs ():
287299 """Build Sphinx project files for Source.Python."""
288300 project = SphinxProject (SP_PACKAGES_PATH , SP_DOCS_PATH )
@@ -322,6 +334,7 @@ def _build_source_python_docs():
322334 logger .log_message (
323335 'Sphinx project does not exist for Source.Python.' )
324336
337+
325338def _get_updated_credits_wiki ():
326339 """Return the content for the credits.rst."""
327340 groups = ConfigObj (
@@ -361,6 +374,7 @@ def _get_updated_credits_wiki():
361374
362375 return output
363376
377+
364378def _build_custom_package_docs (package ):
365379 """Build Sphinx project files for a custom package."""
366380 project = SphinxProject (
@@ -382,12 +396,13 @@ def _build_custom_package_docs(package):
382396 'Sphinx project does not exist for ' +
383397 'custom package "{0}".' .format (package ))
384398
399+
385400def _build_plugin_docs (package ):
386401 """Build Sphinx project files for a plugin."""
387402 project = SphinxProject (
388403 PLUGIN_PATH / package , PLUGIN_DOCS_PATH / package )
389404 if project .project_exists ():
390- if not manager .is_loaded (package ):
405+ if not plugin_manager .is_loaded (package ):
391406 logger .log_message (
392407 'Plugin must be loaded to build the project files.' )
393408 return
@@ -415,11 +430,13 @@ def is_source_python(package):
415430 """Return True if the given package name is source-python."""
416431 return package == 'source-python'
417432
433+
418434def is_custom_package (package ):
419435 """Return True if the given package name is a custom package."""
420436 return package in map (
421437 lambda path : str (path .namebase ), CUSTOM_PACKAGES_PATH .listdir ())
422438
439+
423440def is_plugin (package ):
424441 """Return True if the given package name is a plugin."""
425442 return package in map (
0 commit comments