🔨 Simplify scripts with pathlib (#24574)
This commit is contained in:
@ -10,12 +10,10 @@
|
||||
#
|
||||
import pioutil
|
||||
if pioutil.is_pio_build():
|
||||
import os,sys,marlin
|
||||
Import("env")
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
board = DefaultEnvironment().BoardConfig()
|
||||
import sys,marlin
|
||||
|
||||
env = marlin.env
|
||||
board = env.BoardConfig()
|
||||
board_keys = board.get("build").keys()
|
||||
|
||||
#
|
||||
@ -56,7 +54,7 @@ if pioutil.is_pio_build():
|
||||
if 'rename' in board_keys:
|
||||
|
||||
def rename_target(source, target, env):
|
||||
firmware = os.path.join(target[0].dir.path, board.get("build.rename"))
|
||||
os.replace(target[0].path, firmware)
|
||||
from pathlib import Path
|
||||
Path(target[0].path).replace(Path(target[0].dir.path, board.get("build.rename")))
|
||||
|
||||
marlin.add_post_action(rename_target)
|
||||
|
Reference in New Issue
Block a user