Comment #2 on issue 1685 by [email protected]: distutils/setuptools
integration
http://code.google.com/p/robotframework/issues/detail?id=1685
Here is a quick example. This should work for most libraries out of the
box. You can finetune the parameters either on the commandline or with
setup.cfg. Eg put the follwing into setup.cfg to just genereate docs for
the given library.
You can consider this code public domain or whatever you need to put your
copyright header above ;)
[build_rf_docs]
libraries = "OneLibrary TwoLibrary"
diff -r 4765c1acdd4c setup.py
--- a/setup.py Mon Mar 10 12:21:34 2014 +0200
+++ b/setup.py Tue Apr 15 13:58:55 2014 +0200
@@ -65,4 +65,9 @@
package_data = {'robot': PACKAGE_DATA},
packages = PACKAGES,
scripts = SCRIPTS,
+ entry_points = {
+ 'distutils.commands': [
+ 'build_rf_docs = robot.libdocpkg.setup_command:BuildLibdoc',
+ ],
+ },
)
diff -r 4765c1acdd4c src/robot/libdocpkg/setup_command.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/robot/libdocpkg/setup_command.py Tue Apr 15 13:58:55 2014 +0200
@@ -0,0 +1,40 @@
+import sys
+import os.path
+from distutils.cmd import Command
+
+import robot.libdoc
+
+class BuildLibdoc(Command):
+ description = 'Build Robotframework library documentation'
+ user_options = [
+ ('libraries=', 'L', 'Library names'),
+ ('output-dir=', 'o', 'Output directory'),
+ ]
+
+ # assume the first part of the package is the library name
+ def _guess_library_names(self):
+ library_names = list()
+ for package in self.distribution.packages:
+ name = package.split('.')[0]
+ if name not in library_names:
+ library_names.append(name)
+ return library_names
+
+ def initialize_options(self):
+ self.libraries = self._guess_library_names()
+ self.output_dir = 'docs'
+
+ def finalize_options(self):
+ self.output_dir = os.path.abspath(self.output_dir)
+ self.mkpath(self.output_dir)
+ self.ensure_string_list('libraries')
+
+ def run(self):
+ # add all package_dir directory to the module path, so libdoc can
+ # import the library properly
+ for path in self.distribution.package_dir.values():
+ sys.path.insert(0, path)
+
+ for lib in self.libraries:
+ html_file = os.path.join(self.output_dir, lib + '.html')
+ robot.libdoc.libdoc(lib, html_file)
--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.