forked from platformio/platformio-core
Revert back "Look firstly in built-in library storages"
This commit is contained in:
@@ -27,7 +27,6 @@ PlatformIO 4.0
|
|||||||
- Save libraries passed to `platformio lib install <http://docs.platformio.org/page/userguide/lib/cmd_install.html>`__ command into the project dependency list (`lib_deps <http://docs.platformio.org/page/projectconf/section_env_library.html#lib-deps>`__) with a new ``--save`` flag (`issue #1028 <https://github.com/platformio/platformio-core/issues/1028>`_)
|
- Save libraries passed to `platformio lib install <http://docs.platformio.org/page/userguide/lib/cmd_install.html>`__ command into the project dependency list (`lib_deps <http://docs.platformio.org/page/projectconf/section_env_library.html#lib-deps>`__) with a new ``--save`` flag (`issue #1028 <https://github.com/platformio/platformio-core/issues/1028>`_)
|
||||||
- Install all project dependencies declared via `lib_deps <http://docs.platformio.org/page/projectconf/section_env_library.html#lib-deps>`__ option using a simple `platformio lib install <http://docs.platformio.org/page/userguide/lib/cmd_install.html>`__ command (`issue #2147 <https://github.com/platformio/platformio-core/issues/2147>`_)
|
- Install all project dependencies declared via `lib_deps <http://docs.platformio.org/page/projectconf/section_env_library.html#lib-deps>`__ option using a simple `platformio lib install <http://docs.platformio.org/page/userguide/lib/cmd_install.html>`__ command (`issue #2147 <https://github.com/platformio/platformio-core/issues/2147>`_)
|
||||||
- Use isolated library dependency storage per project build environment (`issue #1696 <https://github.com/platformio/platformio-core/issues/1696>`_)
|
- Use isolated library dependency storage per project build environment (`issue #1696 <https://github.com/platformio/platformio-core/issues/1696>`_)
|
||||||
- Look firstly in built-in library storages for a missing dependency instead of PlatformIO Registry (`issue #1654 <https://github.com/platformio/platformio-core/issues/1654>`_)
|
|
||||||
- Override default source and include directories for a library via `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__ manifest using ``includeDir`` and ``srcDir`` fields
|
- Override default source and include directories for a library via `library.json <http://docs.platformio.org/page/librarymanager/config.html>`__ manifest using ``includeDir`` and ``srcDir`` fields
|
||||||
- Fixed an issue when library keeps reinstalling for non-latin path (`issue #1252 <https://github.com/platformio/platformio-core/issues/1252>`_)
|
- Fixed an issue when library keeps reinstalling for non-latin path (`issue #1252 <https://github.com/platformio/platformio-core/issues/1252>`_)
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ from traceback import format_exc
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from platformio import __version__, exception, maintenance, util
|
from platformio import __version__, exception, maintenance
|
||||||
from platformio.commands import PlatformioCLI
|
from platformio.commands import PlatformioCLI
|
||||||
from platformio.compat import CYGWIN
|
from platformio.compat import CYGWIN
|
||||||
|
|
||||||
@@ -42,7 +42,6 @@ def process_result(ctx, result, force, caller): # pylint: disable=W0613
|
|||||||
maintenance.on_platformio_end(ctx, result)
|
maintenance.on_platformio_end(ctx, result)
|
||||||
|
|
||||||
|
|
||||||
@util.memoized()
|
|
||||||
def configure():
|
def configure():
|
||||||
if CYGWIN:
|
if CYGWIN:
|
||||||
raise exception.CygwinEnvDetected()
|
raise exception.CygwinEnvDetected()
|
||||||
@@ -77,17 +76,10 @@ def configure():
|
|||||||
click.secho = lambda *args, **kwargs: _safe_echo(1, *args, **kwargs)
|
click.secho = lambda *args, **kwargs: _safe_echo(1, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
def main(argv=None):
|
def main():
|
||||||
exit_code = 0
|
|
||||||
prev_sys_argv = sys.argv[:]
|
|
||||||
if argv:
|
|
||||||
assert isinstance(argv, list)
|
|
||||||
sys.argv = argv
|
|
||||||
try:
|
try:
|
||||||
configure()
|
configure()
|
||||||
cli(None, None, None)
|
cli(None, None, None)
|
||||||
except SystemExit:
|
|
||||||
pass
|
|
||||||
except Exception as e: # pylint: disable=broad-except
|
except Exception as e: # pylint: disable=broad-except
|
||||||
if not isinstance(e, exception.ReturnErrorCode):
|
if not isinstance(e, exception.ReturnErrorCode):
|
||||||
maintenance.on_platformio_exception(e)
|
maintenance.on_platformio_exception(e)
|
||||||
@@ -113,9 +105,8 @@ An unexpected error occurred. Further steps:
|
|||||||
============================================================
|
============================================================
|
||||||
"""
|
"""
|
||||||
click.secho(error_str, fg="red", err=True)
|
click.secho(error_str, fg="red", err=True)
|
||||||
exit_code = int(str(e)) if str(e).isdigit() else 1
|
return int(str(e)) if str(e).isdigit() else 1
|
||||||
sys.argv = prev_sys_argv
|
return 0
|
||||||
return exit_code
|
|
||||||
|
|
||||||
|
|
||||||
def debug_gdb_main():
|
def debug_gdb_main():
|
||||||
|
@@ -16,7 +16,6 @@ from os import environ
|
|||||||
from os.path import join
|
from os.path import join
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
import click
|
|
||||||
from SCons.Script import ARGUMENTS # pylint: disable=import-error
|
from SCons.Script import ARGUMENTS # pylint: disable=import-error
|
||||||
from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error
|
from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error
|
||||||
from SCons.Script import DEFAULT_TARGETS # pylint: disable=import-error
|
from SCons.Script import DEFAULT_TARGETS # pylint: disable=import-error
|
||||||
@@ -96,10 +95,6 @@ env.Replace(
|
|||||||
for key in list(clivars.keys()) if key in env
|
for key in list(clivars.keys()) if key in env
|
||||||
})
|
})
|
||||||
|
|
||||||
if int(ARGUMENTS.get("ISATTY", 0)):
|
|
||||||
# pylint: disable=protected-access
|
|
||||||
click._compat.isatty = lambda stream: True
|
|
||||||
|
|
||||||
if env.GetOption('clean'):
|
if env.GetOption('clean'):
|
||||||
env.PioClean(env.subst("$BUILD_DIR"))
|
env.PioClean(env.subst("$BUILD_DIR"))
|
||||||
env.Exit(0)
|
env.Exit(0)
|
||||||
|
@@ -25,7 +25,6 @@ import sys
|
|||||||
from os.path import (basename, commonprefix, dirname, expanduser, isdir,
|
from os.path import (basename, commonprefix, dirname, expanduser, isdir,
|
||||||
isfile, join, realpath, sep)
|
isfile, join, realpath, sep)
|
||||||
|
|
||||||
import click
|
|
||||||
import SCons.Scanner # pylint: disable=import-error
|
import SCons.Scanner # pylint: disable=import-error
|
||||||
from SCons.Script import ARGUMENTS # pylint: disable=import-error
|
from SCons.Script import ARGUMENTS # pylint: disable=import-error
|
||||||
from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error
|
from SCons.Script import COMMAND_LINE_TARGETS # pylint: disable=import-error
|
||||||
@@ -863,15 +862,15 @@ class ProjectAsLibBuilder(LibBuilderBase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def process_dependencies(self): # pylint: disable=too-many-branches
|
def process_dependencies(self): # pylint: disable=too-many-branches
|
||||||
lib_deps = self.env.GetProjectOption("lib_deps")
|
uris = self.env.GetProjectOption("lib_deps", [])
|
||||||
if not lib_deps:
|
if not uris:
|
||||||
return
|
return
|
||||||
storage_dirs = []
|
storage_dirs = []
|
||||||
for lb in self.env.GetLibBuilders():
|
for lb in self.env.GetLibBuilders():
|
||||||
if dirname(lb.path) not in storage_dirs:
|
if dirname(lb.path) not in storage_dirs:
|
||||||
storage_dirs.append(dirname(lb.path))
|
storage_dirs.append(dirname(lb.path))
|
||||||
|
|
||||||
for uri in lib_deps:
|
for uri in uris:
|
||||||
found = False
|
found = False
|
||||||
for storage_dir in storage_dirs:
|
for storage_dir in storage_dirs:
|
||||||
if found:
|
if found:
|
||||||
@@ -889,26 +888,12 @@ class ProjectAsLibBuilder(LibBuilderBase):
|
|||||||
break
|
break
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
# look for built-in libraries by a name
|
|
||||||
# which don't have package manifest
|
|
||||||
for lb in self.env.GetLibBuilders():
|
for lb in self.env.GetLibBuilders():
|
||||||
if lb.name == uri:
|
if lb.name != uri:
|
||||||
if lb not in self.depbuilders:
|
continue
|
||||||
self.depend_recursive(lb)
|
if lb not in self.depbuilders:
|
||||||
found = True
|
self.depend_recursive(lb)
|
||||||
break
|
break
|
||||||
|
|
||||||
if not found:
|
|
||||||
lm = LibraryManager(
|
|
||||||
self.env.subst(join("$PROJECTLIBDEPS_DIR", "$PIOENV")))
|
|
||||||
try:
|
|
||||||
lm.install(uri)
|
|
||||||
# delete cached lib builders
|
|
||||||
if "__PIO_LIB_BUILDERS" in DefaultEnvironment():
|
|
||||||
del DefaultEnvironment()['__PIO_LIB_BUILDERS']
|
|
||||||
except (exception.LibNotFound,
|
|
||||||
exception.InternetIsOffline) as e:
|
|
||||||
click.secho("Warning! %s" % e, fg="yellow")
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
self._is_built = True # do not build Project now
|
self._is_built = True # do not build Project now
|
||||||
@@ -932,7 +917,8 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches
|
|||||||
key=lambda lb: 0 if lb.dependent else 1)
|
key=lambda lb: 0 if lb.dependent else 1)
|
||||||
|
|
||||||
items = []
|
items = []
|
||||||
verbose = int(ARGUMENTS.get("PIOVERBOSE", 0))
|
verbose = int(ARGUMENTS.get("PIOVERBOSE",
|
||||||
|
0)) and not env.GetOption('clean')
|
||||||
|
|
||||||
def _check_lib_builder(lb):
|
def _check_lib_builder(lb):
|
||||||
compat_mode = lb.lib_compat_mode
|
compat_mode = lb.lib_compat_mode
|
||||||
|
@@ -18,7 +18,10 @@ from time import time
|
|||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from platformio import util
|
from platformio import exception, util
|
||||||
|
from platformio.commands.lib import (CTX_META_STORAGE_DIRS_KEY,
|
||||||
|
CTX_META_STORAGE_LIBDEPS_KEY)
|
||||||
|
from platformio.commands.lib import lib_install as cmd_lib_install
|
||||||
from platformio.project.helpers import (calculate_project_hash,
|
from platformio.project.helpers import (calculate_project_hash,
|
||||||
get_project_dir,
|
get_project_dir,
|
||||||
get_project_libdeps_dir)
|
get_project_libdeps_dir)
|
||||||
@@ -43,6 +46,22 @@ def handle_legacy_libdeps(project_dir, config):
|
|||||||
fg="yellow")
|
fg="yellow")
|
||||||
|
|
||||||
|
|
||||||
|
def autoinstall_libdeps(ctx, envname, libraries, verbose=False):
|
||||||
|
if not libraries:
|
||||||
|
return
|
||||||
|
libdeps_dir = join(get_project_libdeps_dir(), envname)
|
||||||
|
ctx.meta.update({
|
||||||
|
CTX_META_STORAGE_DIRS_KEY: [libdeps_dir],
|
||||||
|
CTX_META_STORAGE_LIBDEPS_KEY: {
|
||||||
|
libdeps_dir: libraries
|
||||||
|
}
|
||||||
|
})
|
||||||
|
try:
|
||||||
|
ctx.invoke(cmd_lib_install, silent=not verbose)
|
||||||
|
except exception.InternetIsOffline as e:
|
||||||
|
click.secho(str(e), fg="yellow")
|
||||||
|
|
||||||
|
|
||||||
def clean_build_dir(build_dir):
|
def clean_build_dir(build_dir):
|
||||||
# remove legacy ".pioenvs" folder
|
# remove legacy ".pioenvs" folder
|
||||||
legacy_build_dir = join(get_project_dir(), ".pioenvs")
|
legacy_build_dir = join(get_project_dir(), ".pioenvs")
|
||||||
|
@@ -19,7 +19,7 @@ import click
|
|||||||
from platformio import exception, telemetry
|
from platformio import exception, telemetry
|
||||||
from platformio.commands.platform import \
|
from platformio.commands.platform import \
|
||||||
platform_install as cmd_platform_install
|
platform_install as cmd_platform_install
|
||||||
from platformio.commands.run.helpers import print_header
|
from platformio.commands.run.helpers import autoinstall_libdeps, print_header
|
||||||
from platformio.commands.test.processor import (CTX_META_TEST_IS_RUNNING,
|
from platformio.commands.test.processor import (CTX_META_TEST_IS_RUNNING,
|
||||||
CTX_META_TEST_RUNNING_NAME)
|
CTX_META_TEST_RUNNING_NAME)
|
||||||
from platformio.managers.platform import PlatformFactory
|
from platformio.managers.platform import PlatformFactory
|
||||||
@@ -103,6 +103,10 @@ class EnvironmentProcessor(object):
|
|||||||
# skip monitor target, we call it above
|
# skip monitor target, we call it above
|
||||||
if "monitor" in build_targets:
|
if "monitor" in build_targets:
|
||||||
build_targets.remove("monitor")
|
build_targets.remove("monitor")
|
||||||
|
if "nobuild" not in build_targets and "lib_deps" in self.options:
|
||||||
|
autoinstall_libdeps(
|
||||||
|
self.cmd_ctx, self.name,
|
||||||
|
self.config.get("env:" + self.name, "lib_deps"), self.verbose)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
p = PlatformFactory.newPlatform(self.options['platform'])
|
p = PlatformFactory.newPlatform(self.options['platform'])
|
||||||
|
@@ -171,7 +171,6 @@ class PkgInstallerMixin(object):
|
|||||||
if fname and isfile(cache_path):
|
if fname and isfile(cache_path):
|
||||||
dst_path = join(dest_dir, fname)
|
dst_path = join(dest_dir, fname)
|
||||||
shutil.copy(cache_path, dst_path)
|
shutil.copy(cache_path, dst_path)
|
||||||
click.echo("Using cache: %s" % cache_path)
|
|
||||||
return dst_path
|
return dst_path
|
||||||
|
|
||||||
with_progress = not app.is_disabled_progressbar()
|
with_progress = not app.is_disabled_progressbar()
|
||||||
|
@@ -407,9 +407,6 @@ class PlatformRunMixin(object):
|
|||||||
join(util.get_source_dir(), "builder", "main.py")
|
join(util.get_source_dir(), "builder", "main.py")
|
||||||
]
|
]
|
||||||
cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0))
|
cmd.append("PIOVERBOSE=%d" % (1 if self.verbose else 0))
|
||||||
# pylint: disable=protected-access
|
|
||||||
cmd.append("ISATTY=%d" %
|
|
||||||
(1 if click._compat.isatty(sys.stdout) else 0))
|
|
||||||
cmd += targets
|
cmd += targets
|
||||||
|
|
||||||
# encode and append variables
|
# encode and append variables
|
||||||
|
Reference in New Issue
Block a user