Robot Framework Integrated Development Environment (RIDE)
builder.py
Go to the documentation of this file.
1 # Copyright 2008-2015 Nokia Networks
2 # Copyright 2016- Robot Framework Foundation
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 
16 import os
17 
18 from robotide.lib.robot.errors import DataError
19 from robotide.lib.robot.parsing import TEST_EXTENSIONS
20 from robotide.lib.robot.utils import JYTHON, JAVA_VERSION
21 
22 from .robotbuilder import LibraryDocBuilder, ResourceDocBuilder
23 from .specbuilder import SpecDocBuilder
24 if JYTHON:
25  if JAVA_VERSION < (1, 9):
26  from .javabuilder import JavaDocBuilder
27  else:
28  from .java9builder import JavaDocBuilder
29 else:
31  raise DataError('Documenting Java test libraries requires Jython.')
32 
33 
34 RESOURCE_EXTENSIONS = (TEST_EXTENSIONS | {'resource'})
35 
36 
37 def DocumentationBuilder(library_or_resource):
38  extension = os.path.splitext(library_or_resource)[1][1:].lower()
39  if extension in RESOURCE_EXTENSIONS:
40  return ResourceDocBuilder()
41  if extension == 'xml':
42  return SpecDocBuilder()
43  if extension == 'java':
44  return JavaDocBuilder()
45  return LibraryDocBuilder()
Used when variable does not exist.
Definition: errors.py:67
def DocumentationBuilder(library_or_resource)
Definition: builder.py:37