File tree Expand file tree Collapse file tree 5 files changed +6
-8
lines changed Expand file tree Collapse file tree 5 files changed +6
-8
lines changed Original file line number Diff line number Diff line change 26
26
import typing
27
27
import os .path
28
28
29
- import ucl
30
-
31
29
import iocage .helpers
32
30
import iocage .helpers_object
33
31
import iocage .LaunchableResource
@@ -161,6 +159,7 @@ def _read_file(
161
159
self ._file_content_changed = False
162
160
163
161
def _read (self , silent : bool = False ) -> dict :
162
+ import ucl
164
163
data = dict (ucl .load (open (self .path ).read ()))
165
164
self .logger .spam (f"{ self ._file } was read from { self .path } " )
166
165
return data
@@ -174,7 +173,7 @@ def save(self) -> bool:
174
173
return False
175
174
176
175
with open (self .path , "w" ) as rcconf :
177
-
176
+ import ucl
178
177
output = ucl .dump (self , ucl .UCL_EMIT_CONFIG )
179
178
output = output .replace (" = \" " , "=\" " )
180
179
output = output .replace ("\" ;\n " , "\" \n " )
Original file line number Diff line number Diff line change 25
25
"""iocage configuration stored in an UCL file."""
26
26
import typing
27
27
28
- import ucl
29
-
30
28
import iocage .Config
31
29
import iocage .Config .Prototype
32
30
import iocage .Config .Dataset
@@ -40,6 +38,7 @@ class ConfigUCL(iocage.Config.Prototype.Prototype):
40
38
41
39
def map_input (self , data : typing .TextIO ) -> typing .Dict [str , typing .Any ]:
42
40
"""Normalize data read from the UCL file."""
41
+ import ucl
43
42
result = ucl .load (data .read ()) # type: typing.Dict[str, typing.Any]
44
43
result ["legacy" ] = True
45
44
return result
Original file line number Diff line number Diff line change 29
29
import re
30
30
31
31
import libzfs
32
- import ucl
33
32
34
33
import iocage .events
35
34
import iocage .helpers
@@ -369,6 +368,7 @@ def _update_pkg_conf(
369
368
reason = "Refusing to write to a symlink" ,
370
369
logger = self .logger
371
370
)
371
+ import ucl
372
372
with open (filename , "w" ) as f :
373
373
f .write (ucl .dump (data , ucl .UCL_EMIT_JSON ))
374
374
Original file line number Diff line number Diff line change 32
32
import re
33
33
34
34
import libzfs
35
- import ucl
36
35
37
36
import iocage .ZFS
38
37
import iocage .errors
@@ -621,6 +620,7 @@ def hbds_release_branch(self) -> str:
621
620
)
622
621
623
622
with open (source_file , "r" ) as f :
623
+ import ucl
624
624
hbsd_update_conf = ucl .load (f .read ())
625
625
self ._hbsd_release_branch = hbsd_update_conf ["branch" ]
626
626
return str (self ._hbsd_release_branch )
Original file line number Diff line number Diff line change 30
30
import re
31
31
import subprocess # nosec: B404
32
32
import sys
33
- import ucl
34
33
import pty
35
34
import select
36
35
@@ -326,6 +325,7 @@ def to_ucl(data: typing.Dict[str, typing.Any]) -> str:
326
325
false = "off" ,
327
326
none = "none"
328
327
)
328
+ import ucl
329
329
return str (ucl .dump (output_data ))
330
330
331
331
You can’t perform that action at this time.
0 commit comments