mirror of
https://github.com/platformio/platformio-core.git
synced 2025-08-01 19:04:29 +02:00
Cleaned code
This commit is contained in:
@@ -1,12 +1,11 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
import click
|
|
||||||
from sys import exit
|
from sys import exit
|
||||||
|
|
||||||
|
import click
|
||||||
from clint.textui import colored, indent, puts
|
from clint.textui import colored, indent, puts
|
||||||
|
|
||||||
|
|
||||||
from platformio.util import get_project_config, run_builder
|
from platformio.util import get_project_config, run_builder
|
||||||
|
|
||||||
|
|
||||||
|
@@ -8,7 +8,6 @@ from SCons.Script import (DefaultEnvironment, Exit, SConscript,
|
|||||||
|
|
||||||
from platformio.util import get_home_dir, get_project_dir, get_source_dir
|
from platformio.util import get_home_dir, get_project_dir, get_source_dir
|
||||||
|
|
||||||
|
|
||||||
# AllowSubstExceptions()
|
# AllowSubstExceptions()
|
||||||
|
|
||||||
# allow common variables from INI file
|
# allow common variables from INI file
|
||||||
|
@@ -11,7 +11,6 @@ from SCons.Script import (AlwaysBuild, Builder, COMMAND_LINE_TARGETS, Default,
|
|||||||
DefaultEnvironment, Exit, SConscript,
|
DefaultEnvironment, Exit, SConscript,
|
||||||
SConscriptChdir)
|
SConscriptChdir)
|
||||||
|
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
|
||||||
env.Replace(
|
env.Replace(
|
||||||
@@ -100,10 +99,8 @@ env.PrependENVPath(
|
|||||||
join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin")
|
join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
BUILT_LIBS = []
|
BUILT_LIBS = []
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Process framework script
|
# Process framework script
|
||||||
#
|
#
|
||||||
@@ -115,28 +112,24 @@ if "FRAMEWORK" in env:
|
|||||||
exports="env")
|
exports="env")
|
||||||
BUILT_LIBS += flibs
|
BUILT_LIBS += flibs
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Build executable and linkable firmware
|
# Target: Build executable and linkable firmware
|
||||||
#
|
#
|
||||||
|
|
||||||
target_elf = env.BuildFirmware(BUILT_LIBS + ["m"])
|
target_elf = env.BuildFirmware(BUILT_LIBS + ["m"])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Extract EEPROM data (from EEMEM directive) to .eep file
|
# Target: Extract EEPROM data (from EEMEM directive) to .eep file
|
||||||
#
|
#
|
||||||
|
|
||||||
target_eep = env.ElfToEep(join("$BUILD_DIR", "firmware"), target_elf)
|
target_eep = env.ElfToEep(join("$BUILD_DIR", "firmware"), target_elf)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Build the .hex file
|
# Target: Build the .hex file
|
||||||
#
|
#
|
||||||
|
|
||||||
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Upload .eep file
|
# Target: Upload .eep file
|
||||||
#
|
#
|
||||||
@@ -145,7 +138,6 @@ eep = env.Alias("eep", target_eep, [
|
|||||||
lambda target, source, env: env.ResetDevice(), "$UPLOADEEPCMD"])
|
lambda target, source, env: env.ResetDevice(), "$UPLOADEEPCMD"])
|
||||||
AlwaysBuild(eep)
|
AlwaysBuild(eep)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Upload .hex file
|
# Target: Upload .hex file
|
||||||
#
|
#
|
||||||
@@ -154,7 +146,6 @@ upload = env.Alias("upload", target_hex, [
|
|||||||
lambda target, source, env: env.ResetDevice(), "$UPLOADHEXCMD"])
|
lambda target, source, env: env.ResetDevice(), "$UPLOADHEXCMD"])
|
||||||
AlwaysBuild(upload)
|
AlwaysBuild(upload)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Define targets
|
# Target: Define targets
|
||||||
#
|
#
|
||||||
|
@@ -9,7 +9,6 @@ from os.path import join
|
|||||||
|
|
||||||
from SCons.Script import Import, Return
|
from SCons.Script import Import, Return
|
||||||
|
|
||||||
|
|
||||||
env = None
|
env = None
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
|
@@ -9,7 +9,6 @@ from os.path import join
|
|||||||
|
|
||||||
from SCons.Script import Import, Return
|
from SCons.Script import Import, Return
|
||||||
|
|
||||||
|
|
||||||
env = None
|
env = None
|
||||||
Import("env")
|
Import("env")
|
||||||
|
|
||||||
|
@@ -11,7 +11,6 @@ from os.path import join
|
|||||||
from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment,
|
from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment,
|
||||||
SConscript, SConscriptChdir)
|
SConscript, SConscriptChdir)
|
||||||
|
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
|
||||||
env.Replace(
|
env.Replace(
|
||||||
@@ -77,10 +76,8 @@ env.PrependENVPath(
|
|||||||
join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin")
|
join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
BUILT_LIBS = []
|
BUILT_LIBS = []
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Process framework script
|
# Process framework script
|
||||||
#
|
#
|
||||||
@@ -99,14 +96,12 @@ if "FRAMEWORK" in env:
|
|||||||
|
|
||||||
target_elf = env.BuildFirmware(BUILT_LIBS + ["m"])
|
target_elf = env.BuildFirmware(BUILT_LIBS + ["m"])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Build the .hex
|
# Target: Build the .hex
|
||||||
#
|
#
|
||||||
|
|
||||||
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Upload firmware
|
# Target: Upload firmware
|
||||||
#
|
#
|
||||||
@@ -114,7 +109,6 @@ target_hex = env.ElfToHex(join("$BUILD_DIR", "firmware"), target_elf)
|
|||||||
upload = env.Alias("upload", target_hex, ["$UPLOADCMD"])
|
upload = env.Alias("upload", target_hex, ["$UPLOADCMD"])
|
||||||
AlwaysBuild(upload)
|
AlwaysBuild(upload)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Define targets
|
# Target: Define targets
|
||||||
#
|
#
|
||||||
|
@@ -11,7 +11,6 @@ from os.path import join
|
|||||||
from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment,
|
from SCons.Script import (AlwaysBuild, Builder, Default, DefaultEnvironment,
|
||||||
SConscript, SConscriptChdir)
|
SConscript, SConscriptChdir)
|
||||||
|
|
||||||
|
|
||||||
env = DefaultEnvironment()
|
env = DefaultEnvironment()
|
||||||
|
|
||||||
env.Replace(
|
env.Replace(
|
||||||
@@ -93,10 +92,8 @@ env.PrependENVPath(
|
|||||||
join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin")
|
join(env.subst("$PLATFORMTOOLS_DIR"), "toolchain", "bin")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
BUILT_LIBS = []
|
BUILT_LIBS = []
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Process framework script
|
# Process framework script
|
||||||
#
|
#
|
||||||
@@ -108,21 +105,18 @@ if "FRAMEWORK" in env:
|
|||||||
exports="env")
|
exports="env")
|
||||||
BUILT_LIBS += flibs
|
BUILT_LIBS += flibs
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Build executable and linkable firmware
|
# Target: Build executable and linkable firmware
|
||||||
#
|
#
|
||||||
|
|
||||||
target_elf = env.BuildFirmware(BUILT_LIBS + ["c", "gcc", "m"])
|
target_elf = env.BuildFirmware(BUILT_LIBS + ["c", "gcc", "m"])
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Build the .bin file
|
# Target: Build the .bin file
|
||||||
#
|
#
|
||||||
|
|
||||||
target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Upload firmware
|
# Target: Upload firmware
|
||||||
#
|
#
|
||||||
@@ -130,7 +124,6 @@ target_bin = env.ElfToBin(join("$BUILD_DIR", "firmware"), target_elf)
|
|||||||
upload = env.Alias("upload", target_bin, ["$UPLOADCMD"])
|
upload = env.Alias("upload", target_bin, ["$UPLOADCMD"])
|
||||||
AlwaysBuild(upload)
|
AlwaysBuild(upload)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Define targets
|
# Target: Define targets
|
||||||
#
|
#
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
# Copyright (C) Ivan Kravets <me@ikravets.com>
|
||||||
# See LICENSE for details.
|
# See LICENSE for details.
|
||||||
|
|
||||||
from sys import exit
|
|
||||||
from os import getcwd
|
from os import getcwd
|
||||||
from os.path import dirname, expanduser, join, realpath, isfile
|
from os.path import dirname, expanduser, isfile, join, realpath
|
||||||
from subprocess import Popen, PIPE
|
from subprocess import PIPE, Popen
|
||||||
|
from sys import exit
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
Reference in New Issue
Block a user