Skip to content

Commit 06aec54

Browse files
committed
generate_dependabot.py: Fix path and add default crossenv def.
1 parent 9c429f1 commit 06aec54

File tree

1 file changed

+43
-37
lines changed

1 file changed

+43
-37
lines changed

.github/actions/generate_dependabot.py

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -41,57 +41,63 @@ def find_repo_root(start_path):
4141
spksrc_root = repo_root
4242

4343
# Debug information
44-
print(f"🔍 Script location: {script_dir}")
45-
print(f"🔍 Repository root: {repo_root}")
46-
print(f"🔍 spksrc root: {spksrc_root}")
44+
# print(f"🔍 Script location: {script_dir}")
45+
# print(f"🔍 Repository root: {repo_root}")
46+
# print(f"🔍 spksrc root: {spksrc_root}")
4747

4848
# Verify key directories exist
49-
test_dirs = ["spk", "native"]
50-
for test_dir in test_dirs:
51-
test_path = os.path.join(spksrc_root, test_dir)
52-
if os.path.isdir(test_path):
53-
print(f"✅ Found directory: {test_path}")
54-
else:
55-
print(f"❌ Missing directory: {test_path}")
49+
# test_dirs = ["spk", "native"]
50+
# for test_dir in test_dirs:
51+
# test_path = os.path.join(spksrc_root, test_dir)
52+
# if os.path.isdir(test_path):
53+
# print(f"✅ Found directory: {test_path}")
54+
# else:
55+
# print(f"❌ Missing directory: {test_path}")
5656

5757
globs = [
58+
"spk/python*/crossenv/requirements-default.txt",
5859
"spk/python*/src/requirements-abi3.txt",
5960
"spk/python*/src/requirements-crossenv.txt",
6061
"spk/python*/src/requirements-pure.txt",
6162
"native/python*/src/requirements.txt"
6263
]
6364

6465
# Test glob patterns to see what they find
65-
print(f"\n🔍 Testing glob patterns:")
66-
for pattern in globs:
67-
full_pattern = os.path.join(spksrc_root, pattern)
68-
matches = glob.glob(full_pattern)
69-
print(f" Pattern: {pattern}")
70-
print(f" Full path: {full_pattern}")
71-
print(f" Matches: {len(matches)}")
72-
if matches:
73-
for match in matches[:3]: # Show first 3 matches
74-
print(f" - {match}")
75-
if len(matches) > 3:
76-
print(f" ... and {len(matches) - 3} more")
77-
print()
66+
# print(f"\n🔍 Testing glob patterns:")
67+
# for pattern in globs:
68+
# full_pattern = os.path.join(spksrc_root, pattern)
69+
# matches = glob.glob(full_pattern)
70+
# print(f" Pattern: {pattern}")
71+
# print(f" Full path: {full_pattern}")
72+
# print(f" Matches: {len(matches)}")
73+
# if matches:
74+
# for match in matches[:3]: # Show first 3 matches
75+
# print(f" - {match}")
76+
# if len(matches) > 3:
77+
# print(f" ... and {len(matches) - 3} more")
78+
# print()
7879

7980
# Iterate on each glob patterns based on spksrc_root
8081
paths = itertools.chain.from_iterable(
8182
glob.glob(os.path.join(spksrc_root, pattern)) for pattern in globs
8283
)
8384

8485
updates = []
85-
found_files = [] # For debugging
86+
# found_files = [] # For debugging
8687

8788
for req_file in paths:
88-
found_files.append(req_file)
89-
rel_dir = os.path.dirname(os.path.relpath(req_file, repo_root)).replace(os.sep, "/")
89+
# found_files.append(req_file)
9090
filename = os.path.basename(req_file)
9191

92+
# Debug: show path calculation
93+
# print(f"🔍 Processing: {req_file}")
94+
# print(f" Relative to repo_root: {os.path.relpath(req_file, repo_root)}")
95+
# print(f" Directory (absolute): {os.path.dirname(req_file)}")
96+
# print(f" Filename: {filename}")
97+
9298
updates.append({
9399
"package-ecosystem": "pip",
94-
"directory": f"/{rel_dir}",
100+
"directory": os.path.dirname(req_file),
95101
"requirements-file": filename,
96102
"schedule": {
97103
"interval": "weekly"
@@ -104,11 +110,11 @@ def find_repo_root(start_path):
104110
})
105111

106112
# Debug information
107-
print(f"🔍 Found {len(found_files)} requirements files:")
108-
for file in found_files:
109-
print(f" - {file}")
113+
# print(f"🔍 Found {len(found_files)} requirements files:")
114+
# for file in found_files:
115+
# print(f" - {file}")
110116

111-
print(f"🔍 Generated {len(updates)} dependabot updates")
117+
# print(f"🔍 Generated {len(updates)} dependabot updates")
112118

113119
dependabot_config = {
114120
"version": 2,
@@ -126,9 +132,9 @@ def find_repo_root(start_path):
126132
print(f"✅ dependabot.yml generated at: {output_path}")
127133

128134
# Show a preview of the generated content
129-
print("\n📋 Generated content preview:")
130-
print("=" * 50)
131-
with open(output_path, "r") as f:
132-
content = f.read()
133-
print(content[:500] + ("..." if len(content) > 500 else ""))
134-
print("=" * 50)
135+
# print("\n📋 Generated content preview:")
136+
# print("=" * 50)
137+
# with open(output_path, "r") as f:
138+
# content = f.read()
139+
# print(content[:500] + ("..." if len(content) > 500 else ""))
140+
# print("=" * 50)

0 commit comments

Comments
 (0)