Hugoifier

fix(theme_finder): warn when multiple Hugo theme candidates are found Closes #6

lmata 2026-03-12 21:52 trunk
Commit d26598ffa0ad3ec7c1b5a5b273264fa79b3e087032ceecf498f1ac0fb9495ddf
--- src/utils/theme_finder.py
+++ src/utils/theme_finder.py
@@ -1,10 +1,11 @@
11
"""
22
Locates the actual Hugo theme and exampleSite within the messy zip-extracted structure.
33
Themes in themes/ are structured as: {name}/{name}/themes/{theme-name}/
44
"""
55
6
+import logging
67
import os
78
import glob as glob_module
89
910
1011
def find_hugo_theme(input_path):
@@ -32,10 +33,15 @@
3233
if not candidates:
3334
return None
3435
3536
# Pick the deepest match (most likely the actual theme dir)
3637
theme_dir = max(candidates, key=lambda p: p.count(os.sep))
38
+ if len(candidates) > 1:
39
+ logging.warning(
40
+ f"Multiple Hugo theme candidates found; using {theme_dir!r}. "
41
+ f"Others: {[c for c in candidates if c != theme_dir]}"
42
+ )
3743
3844
# Detect exampleSite
3945
example_site = None
4046
for candidate in [
4147
os.path.join(theme_dir, 'exampleSite'),
4248
--- src/utils/theme_finder.py
+++ src/utils/theme_finder.py
@@ -1,10 +1,11 @@
1 """
2 Locates the actual Hugo theme and exampleSite within the messy zip-extracted structure.
3 Themes in themes/ are structured as: {name}/{name}/themes/{theme-name}/
4 """
5
 
6 import os
7 import glob as glob_module
8
9
10 def find_hugo_theme(input_path):
@@ -32,10 +33,15 @@
32 if not candidates:
33 return None
34
35 # Pick the deepest match (most likely the actual theme dir)
36 theme_dir = max(candidates, key=lambda p: p.count(os.sep))
 
 
 
 
 
37
38 # Detect exampleSite
39 example_site = None
40 for candidate in [
41 os.path.join(theme_dir, 'exampleSite'),
42
--- src/utils/theme_finder.py
+++ src/utils/theme_finder.py
@@ -1,10 +1,11 @@
1 """
2 Locates the actual Hugo theme and exampleSite within the messy zip-extracted structure.
3 Themes in themes/ are structured as: {name}/{name}/themes/{theme-name}/
4 """
5
6 import logging
7 import os
8 import glob as glob_module
9
10
11 def find_hugo_theme(input_path):
@@ -32,10 +33,15 @@
33 if not candidates:
34 return None
35
36 # Pick the deepest match (most likely the actual theme dir)
37 theme_dir = max(candidates, key=lambda p: p.count(os.sep))
38 if len(candidates) > 1:
39 logging.warning(
40 f"Multiple Hugo theme candidates found; using {theme_dir!r}. "
41 f"Others: {[c for c in candidates if c != theme_dir]}"
42 )
43
44 # Detect exampleSite
45 example_site = None
46 for candidate in [
47 os.path.join(theme_dir, 'exampleSite'),
48

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button