Details
-
Type:
Story
-
Status: Done
-
Resolution: Done
-
Fix Version/s: None
-
Component/s: pipelines_lsst_io, sconsUtils
-
Labels:None
-
Story Points:2
-
Sprint:Arch 2019-02-11
-
Team:Architecture
Description
Currently sconsUtils requires that doxygen strings be used to create the documentation. This is done because sconsUtils requires that SCons be imported and that is only possible if SCons is importing sconsUtils. Since pydoc and sphinx import python code to extract documentation this makes it hard to use numpydoc.
For example:
$ pydoc lsst.sconsUtils
|
problem in lsst.sconsUtils - ImportError: lsst.sconsUtils cannot be imported outside an scons script.
|
It seems though that this is easy to work around. The following patch allows pydoc to work and opens the possibility of migrating sconsUtils away from doxygen.
diff --git a/python/lsst/sconsUtils/__init__.py b/python/lsst/sconsUtils/__init__.py
|
index ee9f02a..6e3c456 100644
|
--- a/python/lsst/sconsUtils/__init__.py
|
+++ b/python/lsst/sconsUtils/__init__.py
|
@@ -1,4 +1,13 @@
|
# Explain what happens when you try to import outside scons
|
+# When building documentation you want to force a SCons import
|
+import os
|
+import sys
|
+
|
+if ("pydoc" in sys.modules or "sphinx" in sys.modules) and "SCONS_DIR" in os.environ:
|
+ scons_path = os.path.join(os.environ["SCONS_DIR"], "lib", "scons")
|
+ if scons_path not in sys.path:
|
+ sys.path.append(scons_path)
|
+
|
try:
|
import SCons.Script
|
except ImportError: |
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Watchers | Jim Bosch, Jonathan Sick, Tim Jenness [ Jim Bosch, Jonathan Sick, Tim Jenness ] | Jim Bosch, Jonathan Sick, Kian-Tat Lim, Tim Jenness [ Jim Bosch, Jonathan Sick, Kian-Tat Lim, Tim Jenness ] |
Component/s | pipelines_lsst_io [ 16812 ] |
Assignee | Tim Jenness [ tjenness ] |
Story Points | 2 | |
Team | Architecture [ 10304 ] |
Reviewers | Jonathan Sick, Kian-Tat Lim [ jsick, ktl ] | |
Status | To Do [ 10001 ] | In Review [ 10004 ] |
Reviewers | Jonathan Sick, Kian-Tat Lim [ jsick, ktl ] | Kian-Tat Lim [ ktl ] |
Sprint | Arch 2019-02-11 [ 862 ] |
Status | In Review [ 10004 ] | Reviewed [ 10101 ] |
Resolution | Done [ 10000 ] | |
Status | Reviewed [ 10101 ] | Done [ 10002 ] |