Merge lp:~mhall119/developer-ubuntu-com/add-autopilot-scopes-docs into lp:developer-ubuntu-com

Proposed by Michael Hall
Status: Merged
Approved by: Daniel Holbach
Approved revision: 122
Merged at revision: 138
Proposed branch: lp:~mhall119/developer-ubuntu-com/add-autopilot-scopes-docs
Merge into: lp:developer-ubuntu-com
Diff against target: 139 lines (+42/-31)
3 files modified
api_docs/importers/autopilot_sections.py (+3/-0)
api_docs/importers/sphinx.py (+35/-31)
update_apidocs.sh (+4/-0)
To merge this branch: bzr merge lp:~mhall119/developer-ubuntu-com/add-autopilot-scopes-docs
Reviewer Review Type Date Requested Status
Daniel Holbach (community) Approve
Review via email: mp+262859@code.launchpad.net

Description of the change

Add the new python3-scope-harness Autopilot API docs to be auto-imported.

To post a comment you must log in.
Revision history for this message
Daniel Holbach (dholbach) wrote :

Works for me and the code looks cleaner now.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'api_docs/importers/autopilot_sections.py'
--- api_docs/importers/autopilot_sections.py 2015-04-09 20:43:39 +0000
+++ api_docs/importers/autopilot_sections.py 2015-06-24 14:45:52 +0000
@@ -14,6 +14,9 @@
14 'autopilot.gestures': 'Input and Display',14 'autopilot.gestures': 'Input and Display',
15 'autopilot.input': 'Input and Display',15 'autopilot.input': 'Input and Display',
1616
17 'scope_harness': 'Scopes',
18 'scope_harness.testing': 'Scopes',
19
17 'tutorial/': 'Tutorials',20 'tutorial/': 'Tutorials',
18 'guides/': 'Guides',21 'guides/': 'Guides',
19 'faq/': 'Frequently Asked Questions',22 'faq/': 'Frequently Asked Questions',
2023
=== modified file 'api_docs/importers/sphinx.py'
--- api_docs/importers/sphinx.py 2015-04-16 14:16:26 +0000
+++ api_docs/importers/sphinx.py 2015-06-24 14:45:52 +0000
@@ -28,6 +28,7 @@
28 self.sections_file = self.options.get('sections')28 self.sections_file = self.options.get('sections')
29 self.pages_sections = dict()29 self.pages_sections = dict()
30 self.page_data_map = dict()30 self.page_data_map = dict()
31 self.module_order = []
3132
32 def parse_line(self, line, source_file, element_fullname):33 def parse_line(self, line, source_file, element_fullname):
33 line = line.replace(u'\u00b6', u'')34 line = line.replace(u'\u00b6', u'')
@@ -213,7 +214,7 @@
213 214
214 self.PRIMARY_NAMESPACE = None215 self.PRIMARY_NAMESPACE = None
215216
216 namespace_order_index = 0217 module_order_index = 0
217 218
218 DOC_MODULE = '0'219 DOC_MODULE = '0'
219 DOC_API_PART = '1'220 DOC_API_PART = '1'
@@ -242,7 +243,7 @@
242 if page_path.endswith('/'):243 if page_path.endswith('/'):
243 page_path = page_path[:-1]244 page_path = page_path[:-1]
244 ns_name = fullname245 ns_name = fullname
245 self.namespace_order.append(fullname)246 self.module_order.append(fullname)
246 self.namespace_map[fullname] = page_path247 self.namespace_map[fullname] = page_path
247 elif doc_enum == DOC_API_PART:248 elif doc_enum == DOC_API_PART:
248 ns_name = '.'.join(fullname.split('.')[:2])249 ns_name = '.'.join(fullname.split('.')[:2])
@@ -281,40 +282,43 @@
281 282
282 continue283 continue
283 284
284 for ns_name in self.namespace_order:285 for module in self.module_order:
285 cleaned_ns_name = self.parse_namespace(ns_name)286
286287 doc_file = os.path.join(self.DOC_ROOT, self.namespace_map[module]+'.fjson')
287 section, created = Section.objects.get_or_create(name=self.get_section(ns_name, None), topic_version=self.version)288 module_data = self.read_json_file(doc_file)
288 if created:289 classes, extra = self.extract_classes(module_data['body'])
289 print "Created section: %s" % section.name
290
291 if self.verbosity >= 1:
292 print 'Namespace: ' + ns_name
293 print 'Section: ' + section.name
294
295
296 doc_file = os.path.join(self.DOC_ROOT, self.namespace_map[ns_name]+'.fjson')
297 ns_data = self.read_json_file(doc_file)
298 classes, extra = self.extract_classes(ns_data['body'])
299
300 if cleaned_ns_name is not None and cleaned_ns_name != '':
301 namespace, created = Namespace.objects.get_or_create(name=ns_name, display_name=cleaned_ns_name, platform_section=section)
302 if created:
303 print "Created Namespace: %s" % ns_name
304 namespace.data = self.clean_content(extra, doc_file, ns_name)
305 namespace.source_file = os.path.basename(doc_file)
306 namespace.source_format = "sphinx"
307 namespace.save()
308 else:
309 namespace = None
310290
311 if len(classes) > 0:291 if len(classes) > 0:
312 292
313 for fullname, doc_data in classes:293 for fullname, doc_data in classes:
314 if fullname.startswith(ns_name):294 if '.' in fullname:
315 classname = fullname[len(ns_name)+1:]295 ns_name = fullname[:fullname.rindex('.')]
296 classname = fullname[fullname.rindex('.')+1:]
316 else:297 else:
317 classname = fullname298 classname = fullname
299 ns_name = None
300
301 cleaned_ns_name = self.parse_namespace(ns_name)
302
303 section, created = Section.objects.get_or_create(name=self.get_section(ns_name, None), topic_version=self.version)
304 if created:
305 print "Created section: %s" % section.name
306
307 if self.verbosity >= 1:
308 print 'Namespace: ' + ns_name
309 print 'Section: ' + section.name
310
311 if cleaned_ns_name is not None and cleaned_ns_name != '':
312 namespace, created = Namespace.objects.get_or_create(name=ns_name, display_name=cleaned_ns_name, platform_section=section)
313 if created:
314 print "Created Namespace: %s" % ns_name
315 namespace.data = self.clean_content(extra, doc_file, ns_name)
316 namespace.source_file = os.path.basename(doc_file)
317 namespace.source_format = "sphinx"
318 namespace.save()
319 else:
320 namespace = None
321
318322
319 if self.verbosity >= 1:323 if self.verbosity >= 1:
320 print 'Element: ' + fullname324 print 'Element: ' + fullname
@@ -346,7 +350,7 @@
346 if not self.options.get('no_pages', False):350 if not self.options.get('no_pages', False):
347 page_order_index = 0351 page_order_index = 0
348 352
349 #self.page_order.extend(self.namespace_order)353 #self.page_order.extend(self.module_order)
350 354
351 for pagefile in self.pages_sections:355 for pagefile in self.pages_sections:
352 ns_name, pagename, pagefullname, pagetitle = self.page_data_map[pagefile]356 ns_name, pagename, pagefullname, pagetitle = self.page_data_map[pagefile]
353357
=== modified file 'update_apidocs.sh'
--- update_apidocs.sh 2015-05-12 19:40:04 +0000
+++ update_apidocs.sh 2015-06-24 14:45:52 +0000
@@ -90,6 +90,10 @@
90find /tmp/apidoc_sources/usr/share/doc/ubuntu-ui-toolkit-autopilot/json/ -name "*.gz" -print0 |xargs -0 gunzip90find /tmp/apidoc_sources/usr/share/doc/ubuntu-ui-toolkit-autopilot/json/ -name "*.gz" -print0 |xargs -0 gunzip
91python manage.py import_sphinx -t autopilot -l python -r 1.5.0 -s ./api_docs/importers/autopilot_sections.py -i /tmp/apidoc_sources/usr/share/doc/ubuntu-ui-toolkit-autopilot/json/objects.inv91python manage.py import_sphinx -t autopilot -l python -r 1.5.0 -s ./api_docs/importers/autopilot_sections.py -i /tmp/apidoc_sources/usr/share/doc/ubuntu-ui-toolkit-autopilot/json/objects.inv
9292
93SERIES=wily ARCH=i386 ./get_package.sh python3-scope-harness
94find /tmp/apidoc_sources/usr/share/doc/python3-scope-harness/json/ -name "*.gz" -print0 |xargs -0 gunzip
95python manage.py import_sphinx -t autopilot -l python -r 1.5.0 -s ./api_docs/importers/autopilot_sections.py -i /tmp/apidoc_sources/usr/share/doc/python3-scope-harness/json/objects.inv
96
93#### Scopes/C++ 97#### Scopes/C++
94## unity.scopes98## unity.scopes
95./get_package.sh libunity-scopes-doc99./get_package.sh libunity-scopes-doc

Subscribers

People subscribed via source and target branches