Skip to content

Commit 47c8199

Browse files
endothermicdevcdecker
authored andcommitted
reckless: initialize repos with submodules and other cleanup
1 parent 61bbd70 commit 47c8199

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

tools/reckless

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ class InstInfo:
152152
def search_dir(self, sub: SourceDir, subdir: bool,
153153
recursion: int) -> Union[SourceDir, None]:
154154
assert isinstance(recursion, int)
155-
# carveout for archived plugins in lightningd/plugins
155+
# carveout for archived plugins in lightningd/plugins. Other repos
156+
# are only searched by API at the top level.
156157
if recursion == 0 and 'archive' in sub.name.lower():
157158
pass
158159
# If unable to search deeper, resort to matching directory name
@@ -791,10 +792,10 @@ def _git_clone(src: InstInfo, dest: Union[PosixPath, str]) -> bool:
791792
source = src.source_loc
792793
else:
793794
return False
794-
git = run(['git', 'clone', source, str(dest)], stdout=PIPE, stderr=PIPE,
795-
text=True, check=False, timeout=60)
795+
git = run(['git', 'clone', '--recurse-submodules', source, str(dest)],
796+
stdout=PIPE, stderr=PIPE, text=True, check=False, timeout=60)
796797
if git.returncode != 0:
797-
for line in git.stderr:
798+
for line in git.stderr.splitlines():
798799
logging.debug(line)
799800
if Path(dest).exists():
800801
remove_dir(str(dest))
@@ -1049,7 +1050,7 @@ def uninstall(plugin_name: str):
10491050

10501051
def search(plugin_name: str) -> Union[InstInfo, None]:
10511052
"""searches plugin index for plugin"""
1052-
ordered_sources = RECKLESS_SOURCES
1053+
ordered_sources = RECKLESS_SOURCES.copy()
10531054

10541055
for src in RECKLESS_SOURCES:
10551056
# Search repos named after the plugin before collections
@@ -1220,7 +1221,7 @@ def load_config(reckless_dir: Union[str, None] = None,
12201221

12211222

12221223
def get_sources_file() -> str:
1223-
return str(Path(RECKLESS_DIR) / '.sources')
1224+
return str(RECKLESS_DIR / '.sources')
12241225

12251226

12261227
def sources_from_file() -> list:
@@ -1369,11 +1370,11 @@ if __name__ == '__main__':
13691370
if LIGHTNING_DIR != Path.home().joinpath('.lightning'):
13701371
LIGHTNING_CLI_CALL.append(f'--lightning-dir={LIGHTNING_DIR}')
13711372
if args.reckless_dir:
1372-
RECKLESS_DIR = args.reckless_dir
1373+
RECKLESS_DIR = Path(args.reckless_dir)
13731374
else:
13741375
RECKLESS_DIR = Path(LIGHTNING_DIR) / 'reckless'
13751376
LIGHTNING_CONFIG = args.conf
1376-
RECKLESS_CONFIG = load_config(reckless_dir=RECKLESS_DIR,
1377+
RECKLESS_CONFIG = load_config(reckless_dir=str(RECKLESS_DIR),
13771378
network=NETWORK)
13781379
RECKLESS_SOURCES = load_sources()
13791380
API_GITHUB_COM = 'https://api.github.com'

0 commit comments

Comments
 (0)