Skip to content

Commit 4c797ad

Browse files
The default type of a component option is now str.
1 parent 2831906 commit 4c797ad

File tree

14 files changed

+69
-27
lines changed

14 files changed

+69
-27
lines changed

doc/riverbank/static/riverbank.css

+8
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,11 @@ h2 a:visited {
1515
.classtable {
1616
width: 100%;
1717
}
18+
19+
th.field-name {
20+
background: none;
21+
}
22+
23+
th.head {
24+
background: lightgray;
25+
}

doc/sysroot.rst

+37-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ The full set of command line options is:
120120
configured.
121121

122122

123-
Writing A Component Plugin
123+
Writing a Component Plugin
124124
--------------------------
125125

126126
A component plugin is a Python module that defines a sub-class of
@@ -130,18 +130,52 @@ re-implement the :py:meth:`~pyqtdeploy.ComponentBase.configure` method. It
130130
should also include a class attribute called
131131
:py:attr:`~pyqtdeploy.ComponentBase.options` which is a sequence of
132132
:py:class:`pyqtdeploy.ComponentOption` instances that describe each of the
133-
component's configurable options.
133+
component's configurable options. It does not matter what the name of the
134+
class is.
134135

135136
.. py:module:: pyqtdeploy
136137
137138
.. py:class:: ComponentBase
138139
140+
This is the base class of all component plugins.
141+
139142
.. py:attribute:: options
140143
144+
This class attribute is a sequence of
145+
:py:class:`~pyqtdeploy.ComponentOption` instances describing the
146+
component's configurable options.
147+
141148
.. py:method:: build(sysroot)
142149
150+
This abstract method is re-implemented to build the component.
151+
152+
:param Sysroot sysroot: the sysroot being built.
153+
143154
.. py:method:: configure(sysroot)
144155
145-
.. py:class:: ComponentOption(name, type, required=False, default=None, values=None, help=None)
156+
This method is re-implemented to configure the component. A component
157+
will always be configured even if it does not get built.
158+
159+
:param Sysroot sysroot: the sysroot being configured.
160+
161+
.. py:class:: ComponentOption(name, type=str, required=False, default=None, values=None, help='')
162+
163+
This class implements an option used to configure the component. An option
164+
can be specified as an attribute of the component's object in the sysroot
165+
specification file. An instance of the component plugin will contain an
166+
attribute for each option whose value is that specified in the sysroot
167+
specification file (or an appropriate default if it was omitted).
168+
169+
:param str name: the name of the option.
170+
:param type type: the type of the option (either ``bool``, ``int``,
171+
``list`` or ``str``).
172+
:param bool required: ``True`` if a value for the option is required.
173+
:param default: the default value of the option.
174+
:param values: the possible values of the option.
175+
:param str help: the help text displayed by the
176+
:option:`--options <pyqtdeploy-sysroot --options>` option of
177+
:program:`pyqtdeploy-sysroot`.
146178

147179
.. py:class:: Sysroot
180+
181+
This class encapsulates a sysroot as seen by a component plugin.

pyqtdeploy/sysroot/component.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def configure(self, sysroot):
4646
class ComponentOption:
4747
""" Encapsulate an option for the component in the specification file. """
4848

49-
def __init__(self, name, type, required=False, default=None, values=None, help=None):
49+
def __init__(self, name, type=str, required=False, default=None, values=None, help=''):
5050
""" Initialise the object. """
5151

5252
self.name = name

pyqtdeploy/sysroot/plugins/openssl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ class OpenSSLComponent(ComponentBase):
3636

3737
# The component options.
3838
options = [
39-
ComponentOption('python_source', str,
39+
ComponentOption('python_source',
4040
help="The archive of the Python source code containing patches to build OpenSSL on macOS."),
41-
ComponentOption('source', str, required=True,
41+
ComponentOption('source', required=True,
4242
help="The archive containing the OpenSSL source code."),
4343
]
4444

pyqtdeploy/sysroot/plugins/pip.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class pipComponent(ComponentBase):
3232

3333
# The component options.
3434
options = [
35-
ComponentOption('packages', list, required=True,
35+
ComponentOption('packages', type=list, required=True,
3636
help="The packages to be installed by pip."),
3737
]
3838

pyqtdeploy/sysroot/plugins/pyqt3d.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PyQt3DComponent(ComponentBase):
3434

3535
# The component options.
3636
options = [
37-
ComponentOption('source', str, required=True,
37+
ComponentOption('source', required=True,
3838
help="The archive containing the PyQt3D source code."),
3939
]
4040

pyqtdeploy/sysroot/plugins/pyqt5.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,11 @@ class PyQt5Component(ComponentBase):
3434

3535
# The component options.
3636
options = [
37-
ComponentOption('disabled_features', list,
37+
ComponentOption('disabled_features', type=list,
3838
help="The features that are disabled."),
39-
ComponentOption('modules', list, required=True,
39+
ComponentOption('modules', type=list, required=True,
4040
help="The extension modules to be built."),
41-
ComponentOption('source', str, required=True,
41+
ComponentOption('source', required=True,
4242
help="The archive containing the PyQt5 source code."),
4343
]
4444

pyqtdeploy/sysroot/plugins/pyqtchart.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PyQtChartComponent(ComponentBase):
3434

3535
# The component options.
3636
options = [
37-
ComponentOption('source', str, required=True,
37+
ComponentOption('source', required=True,
3838
help="The archive containing the PyQtChart source code."),
3939
]
4040

pyqtdeploy/sysroot/plugins/pyqtdatavisualization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PyQtDataVisualizationComponent(ComponentBase):
3434

3535
# The component options.
3636
options = [
37-
ComponentOption('source', str, required=True,
37+
ComponentOption('source', required=True,
3838
help="The archive containing the PyQtDataVisualization source code."),
3939
]
4040

pyqtdeploy/sysroot/plugins/pyqtpurchasing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class PyQtPurchasingComponent(ComponentBase):
3434

3535
# The component options.
3636
options = [
37-
ComponentOption('source', str, required=True,
37+
ComponentOption('source', required=True,
3838
help="The archive containing the PyQtPurchasing source code."),
3939
]
4040

pyqtdeploy/sysroot/plugins/python/python.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,13 @@ class PythonComponent(ComponentBase):
3838

3939
# The component options.
4040
options = [
41-
ComponentOption('build_host_from_source', bool,
41+
ComponentOption('build_host_from_source', type=bool,
4242
help="Build the host Python from source code rather than use an existing installation."),
43-
ComponentOption('build_target_from_source', bool,
43+
ComponentOption('build_target_from_source', type=bool,
4444
help="Build the target Python from source code rather than use an existing installation."),
45-
ComponentOption('dynamic_loading', bool,
45+
ComponentOption('dynamic_loading', type=bool,
4646
help="Set to enable support for the dynamic loading of extension modules when building from source."),
47-
ComponentOption('source', str, required=True,
47+
ComponentOption('source', required=True,
4848
help="The archive containing the Python source code."),
4949
]
5050

pyqtdeploy/sysroot/plugins/qscintilla.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class QScintillaComponent(ComponentBase):
3434

3535
# The component options.
3636
options = [
37-
ComponentOption('source', str, required=True,
37+
ComponentOption('source', required=True,
3838
help="The archive containing the QScintilla source code."),
3939
]
4040

pyqtdeploy/sysroot/plugins/qt5.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,21 @@ class Qt5Component(ComponentBase):
3535

3636
# The component options.
3737
options = [
38-
ComponentOption('configure_options', list,
38+
ComponentOption('configure_options', type=list,
3939
help="The additional options to be passed to 'configure' when building from source."),
40-
ComponentOption('disabled_features', list,
40+
ComponentOption('disabled_features', type=list,
4141
help="The features that are disabled when building from source."),
42-
ComponentOption('qt_dir', str,
42+
ComponentOption('qt_dir',
4343
help="The pathname of the directory containing an existing Qt5 installation to use. If it is not specified then the installation will be built from source."),
44-
ComponentOption('ssl', str,
44+
ComponentOption('ssl',
4545
values=['openssl-linked', 'openssl-runtime',
4646
'securetransport'],
4747
help="Enable SSL support."),
48-
ComponentOption('skip', list,
48+
ComponentOption('skip', type=list,
4949
help="The Qt modules to skip when building from source."),
50-
ComponentOption('source', str,
50+
ComponentOption('source',
5151
help="The archive containing the Qt5 source code if an existing installation is not to be used."),
52-
ComponentOption('static_msvc_runtime', bool,
52+
ComponentOption('static_msvc_runtime', type=bool,
5353
help="Set if the MSVC runtime should be statically linked."),
5454
]
5555

pyqtdeploy/sysroot/plugins/sip.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class SIPComponent(ComponentBase):
3434

3535
# The component options.
3636
options = [
37-
ComponentOption('source', str, required=True,
37+
ComponentOption('source', required=True,
3838
help="The archive containing the SIP source code."),
3939
]
4040

0 commit comments

Comments
 (0)