-
Notifications
You must be signed in to change notification settings - Fork 638
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- update file paths: .pioenvs -> .pio/build, .piolibdeps -> .pio/libdeps - modify envs to use common settings - enable shared libs in travis and ota scripts
- Loading branch information
Showing
10 changed files
with
380 additions
and
2,264 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,13 @@ | ||
.clang_complete | ||
core_version.h | ||
custom.h | ||
.DS_Store | ||
.gcc-flags.json | ||
.pioenvs | ||
.piolibdeps | ||
.python-version | ||
.travis.yml | ||
.vscode | ||
.vscode/.browse.c_cpp.db* | ||
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.pioenvs | ||
.piolibdeps | ||
.clang_complete | ||
core_version.h | ||
custom.h | ||
.DS_Store | ||
.gcc-flags.json | ||
.python-version | ||
.travis.yml | ||
.vscode | ||
.vscode/.browse.c_cpp.db* | ||
.vscode/c_cpp_properties.json | ||
.vscode/launch.json | ||
.pio | ||
libraries/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from __future__ import print_function | ||
|
||
Import("env") | ||
|
||
import os | ||
import sys | ||
|
||
|
||
TRAVIS = os.environ.get("TRAVIS") | ||
|
||
|
||
class ExtraScriptError(Exception): | ||
pass | ||
|
||
|
||
# Most portable way, without depending on platformio internals | ||
def subprocess_libdeps(lib_deps, storage=None, silent=True): | ||
import subprocess | ||
|
||
args = [env.subst("$PYTHONEXE"), "-mplatformio", "lib"] | ||
if not storage: | ||
args.append("-g") | ||
else: | ||
args.extend(["-d", storage]) | ||
args.append("install") | ||
if silent: | ||
args.append("-s") | ||
|
||
args.extend(lib_deps) | ||
|
||
subprocess.check_call(args) | ||
|
||
|
||
# Avoid spawning pio lib every time, hook into the LibraryManager API (sort-of internal) | ||
def library_manager_libdeps(lib_deps, storage=None): | ||
from platformio.managers.lib import LibraryManager | ||
from platformio.project.helpers import get_project_global_lib_dir | ||
|
||
if not storage: | ||
manager = LibraryManager(get_project_global_lib_dir()) | ||
else: | ||
manager = LibraryManager(storage) | ||
|
||
for lib in lib_deps: | ||
if manager.get_package_dir(*manager.parse_pkg_uri(lib)): | ||
continue | ||
print("installing: {}".format(lib), file=sys.stderr) | ||
manager.install(lib) | ||
|
||
|
||
def get_shared_libdeps_dir(section, name): | ||
cfg = env.GetProjectConfig() | ||
|
||
if not cfg.has_option(section, name): | ||
raise ExtraScriptError("{}.{} is required to be set".format(section, name)) | ||
|
||
opt = cfg.get(section, name) | ||
|
||
if not opt in env.GetProjectOption("lib_extra_dirs"): | ||
raise ExtraScriptError("lib_extra_dirs must contain {}.{}".format(section, name)) | ||
|
||
return os.path.join(env["PROJECT_DIR"], opt) | ||
|
||
|
||
if os.environ.get("ESPURNA_PIO_SHARED_LIBRARIES"): | ||
if TRAVIS: | ||
storage = None | ||
print("using global library storage", file=sys.stderr) | ||
else: | ||
storage = get_shared_libdeps_dir("common", "shared_libdeps_dir") | ||
print("using shared library storage: ", storage, file=sys.stderr) | ||
|
||
subprocess_libdeps(env.GetProjectOption("lib_deps"), storage) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Shared lib_deps storage, see code/extra_script_libdeps.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.