Skip to content

Commit 2e2299c

Browse files
committed
Fix astyle for Windows
Signed-off-by: Frederic Pillon <[email protected]>
1 parent caa48d2 commit 2e2299c

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CI/astyle/.astyleignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
.git
22
BUILD
33
CI
4-
system/Drivers
5-
system/STM32*
4+
system

CI/astyle/astyle.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ def checkAstyle():
7272
sys.exit(1)
7373
else:
7474
raise subprocess.CalledProcessError(1, "No version found")
75+
except FileNotFoundError:
76+
print("Astyle binary not found.")
77+
print("Check if it is in the PATH environment or use '-p <path>'.")
78+
sys.exit(1)
7579
except subprocess.CalledProcessError as e:
7680
print(e.output)
7781
sys.exit(1)
@@ -128,7 +132,11 @@ def manage_exclude_list():
128132
exclude_list.append(line.rstrip())
129133
if exclude_list:
130134
for pattern in exclude_list:
131-
exclude_pattern = re.compile(os.path.join(src_path, pattern) + ".*")
135+
if sys.platform.startswith("win32"):
136+
winpattern = os.path.join(src_path, pattern.replace("/","\\")) .replace("\\","\\\\")
137+
exclude_pattern = re.compile(winpattern + ".*")
138+
else:
139+
exclude_pattern = re.compile(os.path.join(src_path, pattern) + ".*")
132140
for s in reversed(source_list):
133141
if exclude_pattern.search(s):
134142
source_list.remove(s)

0 commit comments

Comments
 (0)