Browse Source

Update some py scripts

Scott Lahteine 3 years ago
parent
commit
0b7e857614

+ 4
- 0
buildroot/share/PlatformIO/scripts/fysetc_cheetah_v20.py View File

@@ -1,3 +1,7 @@
1
+#
2
+# STM32F401VE_STEVAL.py
3
+# Customizations for env:STM32F401VE_STEVAL
4
+#
1 5
 import os
2 6
 Import("env")
3 7
 

+ 34
- 34
buildroot/share/PlatformIO/scripts/preflight-checks.py View File

@@ -6,41 +6,41 @@ import os,re
6 6
 Import("env")
7 7
 
8 8
 def get_envs_for_board(board):
9
-    if board.startswith("BOARD_"):
10
-        board = board[6:]
11
-    with open(os.path.join("Marlin", "src", "pins", "pins.h"),"r") as f:
12
-        board_found = ""
13
-        r=re.compile(r"if\s+MB\((.+)\)")
14
-        for line in f.readlines():
15
-            mbs = r.findall(line)
16
-            if mbs:
17
-                board_found = board if board in re.split(r",\s*", mbs[0]) else ""
18
-            if board_found and "#include " in line and "env:" in line:
19
-                return re.findall(r"env:\w+", line)
20
-    return []
9
+	if board.startswith("BOARD_"):
10
+		board = board[6:]
11
+	with open(os.path.join("Marlin", "src", "pins", "pins.h"),"r") as f:
12
+		board_found = ""
13
+		r=re.compile(r"if\s+MB\((.+)\)")
14
+		for line in f.readlines():
15
+			mbs = r.findall(line)
16
+			if mbs:
17
+				board_found = board if board in re.split(r",\s*", mbs[0]) else ""
18
+			if board_found and "#include " in line and "env:" in line:
19
+				return re.findall(r"env:\w+", line)
20
+	return []
21 21
 
22 22
 def check_envs(build_env, base_envs, config):
23
-    if build_env in base_envs:
24
-        return True
25
-    ext = config.get(build_env, 'extends', default=None)
26
-    if ext:
27
-        if isinstance(ext, str):
28
-            return check_envs(ext, base_envs, config)
29
-        elif isinstance(ext, list):
30
-            for ext_env in ext:
31
-                if check_envs(ext_env, base_envs, config):
32
-                    return True
33
-    return False
23
+	if build_env in base_envs:
24
+		return True
25
+	ext = config.get(build_env, 'extends', default=None)
26
+	if ext:
27
+		if isinstance(ext, str):
28
+			return check_envs(ext, base_envs, config)
29
+		elif isinstance(ext, list):
30
+			for ext_env in ext:
31
+				if check_envs(ext_env, base_envs, config):
32
+					return True
33
+	return False
34 34
 
35 35
 # Sanity checks:
36 36
 if 'PIOENV' not in env:
37
-    raise SystemExit("Error: PIOENV is not defined. This script is intended to be used with PlatformIO")
37
+	raise SystemExit("Error: PIOENV is not defined. This script is intended to be used with PlatformIO")
38 38
 
39 39
 if 'MARLIN_FEATURES' not in env:
40
-    raise SystemExit("Error: this script should be used after common Marlin scripts")
40
+	raise SystemExit("Error: this script should be used after common Marlin scripts")
41 41
 
42 42
 if 'MOTHERBOARD' not in env['MARLIN_FEATURES']:
43
-    raise SystemExit("Error: MOTHERBOARD is not defined in Configuration.h")
43
+	raise SystemExit("Error: MOTHERBOARD is not defined in Configuration.h")
44 44
 
45 45
 build_env = env['PIOENV']
46 46
 motherboard = env['MARLIN_FEATURES']['MOTHERBOARD']
@@ -49,16 +49,16 @@ config = env.GetProjectConfig()
49 49
 result = check_envs("env:"+build_env, base_envs, config)
50 50
 
51 51
 if not result:
52
-    err = "Error: your selected build environment '%s' is not compatible with MOTHERBOARD=%s in Configuration.h. " \
53
-          "Please use one of compatible build environments for this board: %s" % \
54
-          (build_env, motherboard, ",".join([e[4:] for e in base_envs if e.startswith("env:")]))
55
-    raise SystemExit(err)
52
+	err = "Error: your selected build environment '%s' is not compatible with MOTHERBOARD=%s in Configuration.h. " \
53
+		  "Please use one of compatible build environments for this board: %s" % \
54
+		  (build_env, motherboard, ",".join([e[4:] for e in base_envs if e.startswith("env:")]))
55
+	raise SystemExit(err)
56 56
 
57 57
 #
58 58
 # Check for Config files in two common incorrect places
59 59
 #
60 60
 for p in [ env['PROJECT_DIR'], os.path.join(env['PROJECT_DIR'], "config") ]:
61
-    for f in [ "Configuration.h", "Configuration_adv.h" ]:
62
-        if os.path.isfile(os.path.join(p, f)):
63
-            err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p
64
-            raise SystemExit(err)
61
+	for f in [ "Configuration.h", "Configuration_adv.h" ]:
62
+		if os.path.isfile(os.path.join(p, f)):
63
+			err = "ERROR: Config files found in directory %s. Please move them into the Marlin subfolder." % p
64
+			raise SystemExit(err)

Loading…
Cancel
Save