forked from platformio/platformio-core
Merge branch 'develop' of https://github.com/ivankravets/platformio into develop
This commit is contained in:
commit
a9b98afa42
14 files changed
+188
-59
No files matched your search
@@ -537,4 +537,4 @@
|
||||
"wait_for_upload_port": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ from os.path import join
|
||||
from time import sleep
|
||||
|
||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||
DefaultEnvironment, Exit)
|
||||
DefaultEnvironment)
|
||||
|
||||
from platformio.util import get_serialports
|
||||
|
||||
@@ -52,8 +52,9 @@ env.Replace(
|
||||
|
||||
LINKFLAGS=[
|
||||
"-Os",
|
||||
"-mmcu=$BOARD_MCU",
|
||||
"-Wl,--gc-sections",
|
||||
"-mmcu=$BOARD_MCU"
|
||||
"-Wl,--start-group"
|
||||
],
|
||||
|
||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-avrdude", "avrdude"),
|
||||
@@ -189,8 +190,8 @@ if is_uptarget:
|
||||
break
|
||||
|
||||
if "UPLOAD_PORT" not in env:
|
||||
Exit("Please specify environment 'upload_port' or use global "
|
||||
"--upload-port option.")
|
||||
print("WARNING!!! Please specify environment 'upload_port' or use "
|
||||
"global --upload-port option.\n")
|
||||
|
||||
#
|
||||
# Setup default targets
|
||||
|
||||
@@ -56,14 +56,16 @@ def GlobCXXFiles(env, path):
|
||||
return files
|
||||
|
||||
|
||||
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
|
||||
ignore_pattern = (".git", ".svn", "examples")
|
||||
def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True,
|
||||
ignore_pattern=None):
|
||||
if not ignore_pattern:
|
||||
ignore_pattern = (".git", ".svn")
|
||||
variants = []
|
||||
src_dir = env.subst(src_dir)
|
||||
for root, _, _ in walk(src_dir):
|
||||
_src_dir = root
|
||||
_var_dir = variant_dir + root.replace(src_dir, "")
|
||||
if any([s in _src_dir.lower() for s in ignore_pattern]):
|
||||
if any([s in _var_dir.lower() for s in ignore_pattern]):
|
||||
continue
|
||||
env.VariantDir(_var_dir, _src_dir, duplicate)
|
||||
variants.append(_var_dir)
|
||||
@@ -72,7 +74,8 @@ def VariantDirRecursive(env, variant_dir, src_dir, duplicate=True):
|
||||
|
||||
def BuildLibrary(env, variant_dir, library_dir):
|
||||
lib = env.Clone()
|
||||
vdirs = lib.VariantDirRecursive(variant_dir, library_dir)
|
||||
vdirs = lib.VariantDirRecursive(
|
||||
variant_dir, library_dir, ignore_pattern=(".git", ".svn", "examples"))
|
||||
return lib.Library(
|
||||
lib.subst(variant_dir),
|
||||
[lib.GlobCXXFiles(vdir) for vdir in vdirs]
|
||||
@@ -208,7 +211,7 @@ def BuildDependentLibraries(env, src_dir): # pylint: disable=R0914
|
||||
if isdir(join(ld, "utility"))])
|
||||
|
||||
libs = []
|
||||
for (libname, inc_dir) in deplibs:
|
||||
for (libname, inc_dir) in reversed(deplibs):
|
||||
lib = env.BuildLibrary(
|
||||
join("$BUILD_DIR", libname), inc_dir)
|
||||
env.Clean(libname, lib)
|
||||
|
||||
@@ -30,8 +30,17 @@ def cli(project_dir, board, disable_auto_uploading):
|
||||
if board and not set(board).issubset(builtin_boards):
|
||||
raise UnknownBoard(", ".join(set(board).difference(builtin_boards)))
|
||||
|
||||
# ask about auto-uploading
|
||||
if board and app.get_setting("enable_prompts"):
|
||||
disable_auto_uploading = not click.confirm(
|
||||
"\nWould you like to enable firmware auto-uploading when project "
|
||||
"is successfully built using `platformio run` command? \n"
|
||||
"Don't forget that you can upload firmware manually using "
|
||||
"`platformio run --target upload` command."
|
||||
)
|
||||
|
||||
if project_dir == getcwd():
|
||||
click.secho("The current working directory", fg="yellow", nl=False)
|
||||
click.secho("\nThe current working directory", fg="yellow", nl=False)
|
||||
click.secho(" %s " % project_dir, fg="cyan", nl=False)
|
||||
click.secho(
|
||||
"will be used for the new project.\n"
|
||||
@@ -42,15 +51,16 @@ def cli(project_dir, board, disable_auto_uploading):
|
||||
|
||||
click.echo("The next files/directories will be created in %s" %
|
||||
click.style(project_dir, fg="cyan"))
|
||||
click.echo("%s - Project Configuration File" %
|
||||
click.echo("%s - Project Configuration File. |-> PLEASE EDIT ME <-|" %
|
||||
click.style("platformio.ini", fg="cyan"))
|
||||
click.echo("%s - a source directory. Put your source code here" %
|
||||
click.echo("%s - Put your source code here" %
|
||||
click.style("src", fg="cyan"))
|
||||
click.echo("%s - a directory for the project specific libraries" %
|
||||
click.echo("%s - Put here project specific or 3-rd party libraries" %
|
||||
click.style("lib", fg="cyan"))
|
||||
|
||||
if (not app.get_setting("enable_prompts") or
|
||||
click.confirm("Do you want to continue?")):
|
||||
|
||||
for d in (src_dir, lib_dir):
|
||||
if not isdir(d):
|
||||
makedirs(d)
|
||||
@@ -60,8 +70,13 @@ def cli(project_dir, board, disable_auto_uploading):
|
||||
if board:
|
||||
fill_project_envs(project_file, board, disable_auto_uploading)
|
||||
click.secho(
|
||||
"Project has been successfully initialized!\n"
|
||||
"Now you can process it with `platformio run` command.",
|
||||
"Project has been successfully initialized!\nUseful commands:\n"
|
||||
"`platformio run` - process/build project from the current "
|
||||
"directory\n"
|
||||
"`platformio run --target upload` or `platformio run -t upload` "
|
||||
"- upload firmware to embedded board\n"
|
||||
"`platformio run --target clean` - clean project (remove compiled "
|
||||
"files)",
|
||||
fg="green"
|
||||
)
|
||||
else:
|
||||
|
||||
+7
-4
@@ -37,7 +37,7 @@ def get_home_dir():
|
||||
pass
|
||||
|
||||
if not home_dir:
|
||||
home_dir = expanduser("~/.platformio")
|
||||
home_dir = join(expanduser("~"), ".platformio")
|
||||
|
||||
if not isdir(home_dir):
|
||||
makedirs(home_dir)
|
||||
@@ -85,9 +85,12 @@ def change_filemtime(path, time):
|
||||
utime(path, (time, time))
|
||||
|
||||
|
||||
def exec_command(args):
|
||||
use_shell = system() == "Windows"
|
||||
p = Popen(args, stdout=PIPE, stderr=PIPE, shell=use_shell)
|
||||
def exec_command(*args, **kwargs):
|
||||
kwargs['stdout'] = PIPE
|
||||
kwargs['stderr'] = PIPE
|
||||
kwargs['shell'] = system() == "Windows"
|
||||
|
||||
p = Popen(*args, **kwargs)
|
||||
out, err = p.communicate()
|
||||
return dict(out=out.strip(), err=err.strip())
|
||||
|
||||
|
||||
Reference in new issue
Block a user