Skip to content

Commit 01ab0ea

Browse files
committed
check version first thing
1 parent 798e38e commit 01ab0ea

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

tools/board_stubs/circuitpython_setboard/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# SPDX-FileCopyrightText: 2024 Tim Cocks
22
#
33
# SPDX-License-Identifier: MIT
4-
import argparse
54
import sys
5+
6+
version_info = sys.version_info
7+
if version_info.major < 3 or (version_info.major == 3 and version_info.minor < 9):
8+
sys.stdout.write("Python 3.9 is the minimum supported version for board specific stubs.\n")
9+
sys.exit(0)
10+
11+
import argparse
612
import shutil
713
from collections import defaultdict
814
from importlib import resources
@@ -35,10 +41,6 @@ def header(txt: str) -> str:
3541

3642

3743
def set_board():
38-
version_info = sys.version_info
39-
if version_info.major < 3 or (version_info.major == 3 and version_info.minor < 9):
40-
sys.stdout.write("Python 3.9 is the minimum supported version for board specific stubs.\n")
41-
sys.exit(0)
4244
parser = argparse.ArgumentParser(
4345
prog=__name__,
4446
usage="Install CircuitPython board-specific stubs",

0 commit comments

Comments
 (0)