lockss-turtles 0.6.0.dev18__py3-none-any.whl → 0.6.0.dev19__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ Library and command line tool to manage LOCKSS plugin sets and LOCKSS plugin
5
5
  registries.
6
6
  """
7
7
 
8
- __version__ = '0.6.0-dev18'
8
+ __version__ = '0.6.0-dev19'
9
9
 
10
10
  __copyright__ = '''
11
11
  Copyright (c) 2000-2025, Board of Trustees of Leland Stanford Jr. University
lockss/turtles/cli.py CHANGED
@@ -33,6 +33,7 @@ Tool for managing LOCKSS plugin sets and LOCKSS plugin registries
33
33
  """
34
34
 
35
35
  from getpass import getpass
36
+ from itertools import chain
36
37
  from pathlib import Path
37
38
 
38
39
  from exceptiongroup import ExceptionGroup
@@ -97,9 +98,9 @@ class PluginDeploymentOptions(BaseModel):
97
98
  raise FileNotFoundError(file_or(TurtlesApp.default_plugin_set_catalog_choices()))
98
99
 
99
100
  def get_plugin_registry_layers(self) -> list[PluginRegistryLayerIdentifier]:
100
- ret = [*(self.plugin_registry_layer or []), *[file_lines(file_path) for file_path in self.plugin_registry_layers or []]]
101
+ ret = [*(self.plugin_registry_layer or []), *chain.from_iterable(file_lines(file_path) for file_path in self.plugin_registry_layers or [])]
101
102
  for layer in reversed(['testing', 'production']):
102
- if getattr(self, layer, False):
103
+ if getattr(self, layer, False) and layer not in ret:
103
104
  ret.insert(0, layer)
104
105
  if ret:
105
106
  return ret
@@ -67,6 +67,7 @@ class PluginSetCatalog(BaseModelWithRoot):
67
67
  """
68
68
  Return this plugin set catalog's list of plugin set definition file
69
69
  paths (relative to the root if not absolute).
70
+
70
71
  :return: A list of plugin set definition file paths.
71
72
  :rtype: list[Path]
72
73
  """
@@ -80,7 +81,8 @@ PluginSetBuilderType = Literal['ant', 'maven']
80
81
  class BasePluginSetBuilder(BaseModelWithRoot, ABC):
81
82
  """
82
83
  An abstract Pydantic model (``lockss.turtles.util.BaseModelWithRoot``) to
83
- represent a plugin set builder.
84
+ represent a plugin set builder, with concrete implementations
85
+ ``AntPluginSetBuilder`` and ``MavenPluginSetBuilder``.
84
86
  """
85
87
 
86
88
  #: Pydantic definition of the ``type`` field.
@@ -112,10 +114,10 @@ class BasePluginSetBuilder(BaseModelWithRoot, ABC):
112
114
 
113
115
  def get_main(self) -> Path:
114
116
  """
115
- Returns the plugin set's main code path (relative to the root if not
116
- absolute).
117
+ Returns this plugin set builder's main code path (relative to the root
118
+ if not absolute).
117
119
 
118
- :return: The plugin set's main code path.
120
+ :return: This plugin set's main code path.
119
121
  :rtype: Path
120
122
  :raises ValueError: If this object is not properly initialized.
121
123
  """
@@ -123,10 +125,10 @@ class BasePluginSetBuilder(BaseModelWithRoot, ABC):
123
125
 
124
126
  def get_test(self) -> Path:
125
127
  """
126
- Returns the plugin set's unit test path (relative to the root if not
127
- absolute).
128
+ Returns this plugin set builder's unit test path (relative to the root
129
+ if not absolute).
128
130
 
129
- :return: The plugin set's unit test path.
131
+ :return: This plugin set's unit test path.
130
132
  :rtype: Path
131
133
  :raises ValueError: If this object is not properly initialized.
132
134
  """
@@ -166,7 +168,7 @@ class BasePluginSetBuilder(BaseModelWithRoot, ABC):
166
168
 
167
169
  def _get_main(self) -> str:
168
170
  """
169
- Return the concrete implementation's ``main`` field.
171
+ Returns the concrete implementation's ``main`` field.
170
172
 
171
173
  :return: The ``main`` field.
172
174
  :rtype: str
@@ -175,7 +177,7 @@ class BasePluginSetBuilder(BaseModelWithRoot, ABC):
175
177
 
176
178
  def _get_test(self) -> str:
177
179
  """
178
- Return the concrete implementation's ``test`` field.
180
+ Returns the concrete implementation's ``test`` field.
179
181
 
180
182
  :return: The ``test`` field.
181
183
  :rtype: str
@@ -196,13 +198,19 @@ class BasePluginSetBuilder(BaseModelWithRoot, ABC):
196
198
 
197
199
 
198
200
  class AntPluginSetBuilder(BasePluginSetBuilder):
201
+ #: Default value for the ``main`` field.
199
202
  DEFAULT_MAIN: ClassVar[str] = 'plugins/src'
203
+ #: Default value for the ``test`` field.
200
204
  DEFAULT_TEST: ClassVar[str] = 'plugins/test/src'
201
205
 
206
+ #: This plugin set builder's type.
202
207
  type: Literal['ant'] = Field(**BasePluginSetBuilder.TYPE_FIELD)
208
+ #: This plugin set builder's main code path.
203
209
  main: Optional[str] = Field(DEFAULT_MAIN, **BasePluginSetBuilder.MAIN_FIELD)
210
+ #: This plugin set builder's unit test path.
204
211
  test: Optional[str] = Field(DEFAULT_TEST, **BasePluginSetBuilder.TEST_FIELD)
205
212
 
213
+ #: An internal flag to remember if a build has occurred.
206
214
  _built: bool
207
215
 
208
216
  def build_plugin(self, plugin_id: PluginIdentifier, keystore_path: Path, keystore_alias: str, keystore_password=None) -> tuple[Path, Plugin]:
@@ -219,6 +227,9 @@ class AntPluginSetBuilder(BasePluginSetBuilder):
219
227
  self._built = False
220
228
 
221
229
  def _big_build(self) -> None:
230
+ """
231
+ Optionally performs the "big build".
232
+ """
222
233
  if not self._built:
223
234
  # Do build
224
235
  subprocess.run('ant load-plugins',
@@ -226,10 +237,26 @@ class AntPluginSetBuilder(BasePluginSetBuilder):
226
237
  self._built = True
227
238
 
228
239
  def _little_build(self, plugin_id: PluginIdentifier, keystore_path: Path, keystore_alias: str, keystore_password: str=None) -> tuple[Path, Plugin]:
240
+ """
241
+ Performs the "little build" of the given plugin.
242
+
243
+ :param plugin_id: A plugin identifier.
244
+ :type plugin_id: PluginIdentifier
245
+ :param keystore_path: The path to the plugin signing keystore.
246
+ :type keystore_path: Path
247
+ :param keystore_alias: The signing alias to use from the plugin signing
248
+ keystore.
249
+ :type keystore_alias: str
250
+ :param keystore_password: The signing password.
251
+ :type keystore_password: str
252
+ :return: A tuple of the plugin JAR path and the corresponding ``Plugin``
253
+ object.
254
+ :rtype: tuple[Path, Plugin]
255
+ """
229
256
  orig_plugin = None
230
257
  cur_id = plugin_id
231
258
  # Get all directories for jarplugin -d
232
- dirs = list()
259
+ dirs = []
233
260
  while cur_id is not None:
234
261
  cur_plugin = self.make_plugin(cur_id)
235
262
  orig_plugin = orig_plugin or cur_plugin
@@ -312,7 +339,7 @@ class MavenPluginSetBuilder(BasePluginSetBuilder):
312
339
  def _little_build(self, plugin_id: PluginIdentifier) -> tuple[Path, Plugin]:
313
340
  jar_path = self.get_root().joinpath('target', 'pluginjars', f'{plugin_id}.jar')
314
341
  if not jar_path.is_file():
315
- raise Exception(f'{plugin_id}: built JAR not found: {jar_path!s}')
342
+ raise FileNotFoundError(str(jar_path))
316
343
  return jar_path, Plugin.from_jar(jar_path)
317
344
 
318
345
  def _sanitize(self, called_process_error: subprocess.CalledProcessError) -> subprocess.CalledProcessError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lockss-turtles
3
- Version: 0.6.0.dev18
3
+ Version: 0.6.0.dev19
4
4
  Summary: Library and command line tool to manage LOCKSS plugin sets and LOCKSS plugin registries
5
5
  License: BSD-3-Clause
6
6
  Author: Thib Guicherd-Callin
@@ -34,7 +34,7 @@ Description-Content-Type: text/x-rst
34
34
  Turtles
35
35
  =======
36
36
 
37
- .. |RELEASE| replace:: 0.6.0-dev18
37
+ .. |RELEASE| replace:: 0.6.0-dev19
38
38
  .. |RELEASE_DATE| replace:: ?
39
39
 
40
40
  .. |HELP| replace:: ``--help/-h``
@@ -1,15 +1,15 @@
1
- lockss/turtles/__init__.py,sha256=l85NQRMGYRq2ptQpR3ssp7sKSXMW-vfL_EZI-mZbjl4,1744
1
+ lockss/turtles/__init__.py,sha256=cBj5LqZHvI7BaYdTG5wtlImMX8zdhImZFc0uXc_CIq0,1744
2
2
  lockss/turtles/__main__.py,sha256=BqRTG3dejCgLh87UJ1Os9DD9unxnQkOdUQM6eqWS3Sg,1680
3
3
  lockss/turtles/app.py,sha256=SAmd_k_2viX_SY2aiXNgQq0k1oPYMUwNBicsnzAo9e4,16689
4
- lockss/turtles/cli.py,sha256=ZB1H7egHWjG2IkPxwW0NvlLTBQ99bpN5wuzOO7_xa30,20681
4
+ lockss/turtles/cli.py,sha256=lNdRVP8RkY80lRNZny9v2VXL8lPt0jNOhOEdzCUd-XU,20749
5
5
  lockss/turtles/plugin.py,sha256=re44YVlzXVU8azDshxn7oHw1GdTQLLQgYwkvZlur-60,5384
6
6
  lockss/turtles/plugin_registry.py,sha256=G_CwTFgDV4om1W0-QY7Ww_7mneCbckXuEWMk7ZFOPW4,11916
7
- lockss/turtles/plugin_set.py,sha256=OCQjRnb4FeIRsuwJpJ63UoXYNeENm39V-iQL47xXZ0M,14711
7
+ lockss/turtles/plugin_set.py,sha256=XCIGmSKHZlSk-L0hhvzE38OU3JmWYgWFTI3V8Uaq1x0,15814
8
8
  lockss/turtles/util.py,sha256=8EyWvzTLNycQM_ZKCtWm8FpKJSrwaCSWh8006UYq6vU,2498
9
9
  unittest/lockss/turtles/__init__.py,sha256=hrgWx4GaP-hhPBuRlbLndJnOQmZicKCLaP-dQTCu1sQ,3162
10
10
  unittest/lockss/turtles/test_plugin_set.py,sha256=q6JmooDR-wijAQ8x9DWKTNB6Of4EOr3Dgq8oaX0LTpQ,4179
11
- lockss_turtles-0.6.0.dev18.dist-info/LICENSE,sha256=O9ONND4uDxY_jucI4jZDf2liAk05ScEJaYu-Al7EOdQ,1506
12
- lockss_turtles-0.6.0.dev18.dist-info/METADATA,sha256=iyywFL8UvcuqBz6M-T3Vv4AVn8FhtO81nOJCw9biIYU,39692
13
- lockss_turtles-0.6.0.dev18.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
- lockss_turtles-0.6.0.dev18.dist-info/entry_points.txt,sha256=25BAVFSBRKWAWiXIGZgcr1ypt2mV7nj31Jl8WcNZZOk,51
15
- lockss_turtles-0.6.0.dev18.dist-info/RECORD,,
11
+ lockss_turtles-0.6.0.dev19.dist-info/LICENSE,sha256=O9ONND4uDxY_jucI4jZDf2liAk05ScEJaYu-Al7EOdQ,1506
12
+ lockss_turtles-0.6.0.dev19.dist-info/METADATA,sha256=LAGhBiXHtJ_Ure1XKjdlVN8DOrFQvbSKjLXFym4CtG4,39692
13
+ lockss_turtles-0.6.0.dev19.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
14
+ lockss_turtles-0.6.0.dev19.dist-info/entry_points.txt,sha256=25BAVFSBRKWAWiXIGZgcr1ypt2mV7nj31Jl8WcNZZOk,51
15
+ lockss_turtles-0.6.0.dev19.dist-info/RECORD,,