mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-07-14 10:17:49 -06:00
🔨 Simplify scripts with pathlib (#24574)
This commit is contained in:
parent
6fe317e385
commit
7f72e78520
14 changed files with 182 additions and 196 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue