Author: andar

Revision: 5521

Log:
        Add a 'build_docs' command to build the documentation

Diff:
Modified: trunk/setup.cfg
===================================================================
--- trunk/setup.cfg     2009-07-22 20:56:08 UTC (rev 5520)
+++ trunk/setup.cfg     2009-07-22 23:04:48 UTC (rev 5521)
@@ -2,7 +2,7 @@
 tag_build = -dev
 tag_svn_revision = false
 
-[build_sphinx]
+[build_docs]
 source-dir = docs/source
 build-dir = docs/build
-all_files = 1
\ No newline at end of file
+all_files = 1

Modified: trunk/setup.py
===================================================================
--- trunk/setup.py      2009-07-22 20:56:08 UTC (rev 5520)
+++ trunk/setup.py      2009-07-22 23:04:48 UTC (rev 5521)
@@ -30,6 +30,7 @@
 from distutils.command.build import build as _build
 from distutils.command.clean import clean as _clean
 from setuptools.command.install import install as _install
+from sphinx.setup_command import BuildDoc
 
 import msgfmt
 import os
@@ -269,6 +270,38 @@
             if os.path.exists(os.path.join(path, "setup.py")):
                 os.system("cd " + path + "&& " + sys.executable + " setup.py 
bdist_egg -d ..")
 
+
+class build_docs(BuildDoc):
+    def finalize_options(self):
+        print self.user_options
+        print self.source_dir
+        BuildDoc.finalize_options(self)
+    def run(self):
+        print self.user_options
+        class FakeModule(object):
+            def __init__(self, *args, **kwargs): pass
+            
+            def __call__(self, *args, **kwargs):
+                return FakeModule()
+
+            def __getattr__(self, key):
+                return FakeModule()
+
+            def __setattr__(self, key, value):
+                self.__dict__[key] = value
+
+        old_import = __builtins__.__import__
+        def new_import(name, globals={}, locals={}, fromlist=[], level=-1):
+            try:
+                return old_import(name, globals, locals, fromlist, level)
+            except ImportError:
+                return FakeModule()
+            except:
+                raise
+        __builtins__.__import__ = new_import
+        
+        BuildDoc.run(self)
+
 class build(_build):
     sub_commands = [('build_trans', None), ('build_plugins', None)] + 
_build.sub_commands
     def run(self):
@@ -326,6 +359,7 @@
     'build': build,
     'build_trans': build_trans,
     'build_plugins': build_plugins,
+    'build_docs': build_docs,
     'clean_plugins': clean_plugins,
     'clean': clean,
     'install': install



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to