forked from platformio/platformio-core
Print platform package details, such as version, VSC source and commit // Resolve #2155
This commit is contained in:
12
HISTORY.rst
12
HISTORY.rst
@ -29,6 +29,14 @@ PlatformIO 4.0
|
|||||||
- 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
|
||||||
- Switched to workspace ``.pio/libdeps`` folder for project dependencies instead of ``.piolibdeps``
|
- Switched to workspace ``.pio/libdeps`` folder for project dependencies instead of ``.piolibdeps``
|
||||||
|
|
||||||
|
* **Build System**
|
||||||
|
|
||||||
|
- Print platform package details, such as version, VSC source and commit (`issue #2155 <https://github.com/platformio/platformio-core/issues/2155>`_)
|
||||||
|
|
||||||
|
* **PIO Remote**
|
||||||
|
|
||||||
|
- Added support for `shared_dir <http://docs.platformio.org/page/projectconf/section_platformio.html#shared-dir>`__ where you can place an extra files (extra scripts, LD scripts, etc.) which should be transferred to a remote machine
|
||||||
|
|
||||||
* **Infrastructure**
|
* **Infrastructure**
|
||||||
|
|
||||||
- Python 3 support (`issue #895 <https://github.com/platformio/platformio-core/issues/895>`_)
|
- Python 3 support (`issue #895 <https://github.com/platformio/platformio-core/issues/895>`_)
|
||||||
@ -42,10 +50,6 @@ PlatformIO 4.0
|
|||||||
- Fixed an issue with hardcoded C standard version when generating project for CLion IDE (`issue #2527 <https://github.com/platformio/platformio-core/issues/2527>`_)
|
- Fixed an issue with hardcoded C standard version when generating project for CLion IDE (`issue #2527 <https://github.com/platformio/platformio-core/issues/2527>`_)
|
||||||
- Fixed an issue with Project Generator when include path search order is inconsistent to what passed to the compiler (`issue #2509 <https://github.com/platformio/platformio-core/issues/2509>`_)
|
- Fixed an issue with Project Generator when include path search order is inconsistent to what passed to the compiler (`issue #2509 <https://github.com/platformio/platformio-core/issues/2509>`_)
|
||||||
|
|
||||||
* **PIO Remote**
|
|
||||||
|
|
||||||
- Added support for `shared_dir <http://docs.platformio.org/page/projectconf/section_platformio.html#shared-dir>`__ where you can place an extra files (extra scripts, LD scripts, etc.) which should be transferred to a remote machine
|
|
||||||
|
|
||||||
* **Miscellaneous**
|
* **Miscellaneous**
|
||||||
|
|
||||||
- Deprecated ``--only-check`` PlatformIO Core CLI option for "update" sub-commands, please use ``--dry-run`` instead
|
- Deprecated ``--only-check`` PlatformIO Core CLI option for "update" sub-commands, please use ``--dry-run`` instead
|
||||||
|
@ -22,7 +22,6 @@ import hashlib
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
from glob import glob
|
|
||||||
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)
|
||||||
|
|
||||||
@ -35,7 +34,6 @@ from platformio import exception, util
|
|||||||
from platformio.builder.tools import platformio as piotool
|
from platformio.builder.tools import platformio as piotool
|
||||||
from platformio.compat import PY2, WINDOWS, get_file_contents, string_types
|
from platformio.compat import PY2, WINDOWS, get_file_contents, string_types
|
||||||
from platformio.managers.lib import LibraryManager
|
from platformio.managers.lib import LibraryManager
|
||||||
from platformio.managers.package import PackageManager
|
|
||||||
|
|
||||||
|
|
||||||
class LibBuilderFactory(object):
|
class LibBuilderFactory(object):
|
||||||
@ -148,13 +146,6 @@ class LibBuilderBase(object):
|
|||||||
def version(self):
|
def version(self):
|
||||||
return self._manifest.get("version")
|
return self._manifest.get("version")
|
||||||
|
|
||||||
@property
|
|
||||||
def vcs_info(self):
|
|
||||||
items = glob(join(self.path, ".*", PackageManager.SRC_MANIFEST_NAME))
|
|
||||||
if not items:
|
|
||||||
return None
|
|
||||||
return util.load_json(items[0])
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def dependencies(self):
|
def dependencies(self):
|
||||||
return LibraryManager.normalize_dependencies(
|
return LibraryManager.normalize_dependencies(
|
||||||
@ -990,7 +981,11 @@ def GetLibBuilders(env): # pylint: disable=too-many-branches
|
|||||||
|
|
||||||
def ConfigureProjectLibBuilder(env):
|
def ConfigureProjectLibBuilder(env):
|
||||||
|
|
||||||
def correct_found_libs(lib_builders):
|
def _get_vcs_info(lb):
|
||||||
|
path = LibraryManager.get_src_manifest_path(lb.path)
|
||||||
|
return util.load_json(path) if path else None
|
||||||
|
|
||||||
|
def _correct_found_libs(lib_builders):
|
||||||
# build full dependency graph
|
# build full dependency graph
|
||||||
found_lbs = [lb for lb in lib_builders if lb.dependent]
|
found_lbs = [lb for lb in lib_builders if lb.dependent]
|
||||||
for lb in lib_builders:
|
for lb in lib_builders:
|
||||||
@ -1001,11 +996,11 @@ def ConfigureProjectLibBuilder(env):
|
|||||||
if deplb not in found_lbs:
|
if deplb not in found_lbs:
|
||||||
lb.depbuilders.remove(deplb)
|
lb.depbuilders.remove(deplb)
|
||||||
|
|
||||||
def print_deps_tree(root, level=0):
|
def _print_deps_tree(root, level=0):
|
||||||
margin = "| " * (level)
|
margin = "| " * (level)
|
||||||
for lb in root.depbuilders:
|
for lb in root.depbuilders:
|
||||||
title = "<%s>" % lb.name
|
title = "<%s>" % lb.name
|
||||||
vcs_info = lb.vcs_info
|
vcs_info = _get_vcs_info(lb)
|
||||||
if lb.version:
|
if lb.version:
|
||||||
title += " %s" % lb.version
|
title += " %s" % lb.version
|
||||||
if vcs_info and vcs_info.get("version"):
|
if vcs_info and vcs_info.get("version"):
|
||||||
@ -1019,13 +1014,13 @@ def ConfigureProjectLibBuilder(env):
|
|||||||
sys.stdout.write(")")
|
sys.stdout.write(")")
|
||||||
sys.stdout.write("\n")
|
sys.stdout.write("\n")
|
||||||
if lb.depbuilders:
|
if lb.depbuilders:
|
||||||
print_deps_tree(lb, level + 1)
|
_print_deps_tree(lb, level + 1)
|
||||||
|
|
||||||
project = ProjectAsLibBuilder(env, "$PROJECT_DIR")
|
project = ProjectAsLibBuilder(env, "$PROJECT_DIR")
|
||||||
ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project)
|
ldf_mode = LibBuilderBase.lib_ldf_mode.fget(project)
|
||||||
|
|
||||||
print("Library Dependency Finder -> http://bit.ly/configure-pio-ldf")
|
print("LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf")
|
||||||
print("LDF MODES: FINDER(%s) COMPATIBILITY(%s)" %
|
print("LDF Modes: Finder [%s] Compatibility [%s]" %
|
||||||
(ldf_mode, project.lib_compat_mode))
|
(ldf_mode, project.lib_compat_mode))
|
||||||
|
|
||||||
lib_builders = env.GetLibBuilders()
|
lib_builders = env.GetLibBuilders()
|
||||||
@ -1035,11 +1030,11 @@ def ConfigureProjectLibBuilder(env):
|
|||||||
project.search_deps_recursive()
|
project.search_deps_recursive()
|
||||||
|
|
||||||
if ldf_mode.startswith("chain") and project.depbuilders:
|
if ldf_mode.startswith("chain") and project.depbuilders:
|
||||||
correct_found_libs(lib_builders)
|
_correct_found_libs(lib_builders)
|
||||||
|
|
||||||
if project.depbuilders:
|
if project.depbuilders:
|
||||||
print("Dependency Graph")
|
print("Dependency Graph")
|
||||||
print_deps_tree(project)
|
_print_deps_tree(project)
|
||||||
else:
|
else:
|
||||||
print("No dependencies")
|
print("No dependencies")
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ from __future__ import absolute_import
|
|||||||
import sys
|
import sys
|
||||||
from os.path import isdir, isfile, join
|
from os.path import isdir, isfile, join
|
||||||
|
|
||||||
|
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 platformio import exception, util
|
from platformio import exception, util
|
||||||
@ -118,58 +119,98 @@ def LoadPioPlatform(env):
|
|||||||
|
|
||||||
def PrintConfiguration(env):
|
def PrintConfiguration(env):
|
||||||
platform = env.PioPlatform()
|
platform = env.PioPlatform()
|
||||||
platform_data = ["PLATFORM: %s >" % platform.title]
|
board_config = env.BoardConfig() if "BOARD" in env else None
|
||||||
hardware_data = ["HARDWARE:"]
|
|
||||||
configuration_data = ["CONFIGURATION:"]
|
|
||||||
mcu = env.subst("$BOARD_MCU")
|
|
||||||
f_cpu = env.subst("$BOARD_F_CPU")
|
|
||||||
if mcu:
|
|
||||||
hardware_data.append(mcu.upper())
|
|
||||||
if f_cpu:
|
|
||||||
f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()]))
|
|
||||||
hardware_data.append("%dMHz" % (f_cpu / 1000000))
|
|
||||||
|
|
||||||
debug_tools = None
|
def _get_configuration_data():
|
||||||
if "BOARD" in env:
|
return None if not board_config else [
|
||||||
board_config = env.BoardConfig()
|
"CONFIGURATION:",
|
||||||
platform_data.append(board_config.get("name"))
|
"https://docs.platformio.org/page/boards/%s/%s.html" %
|
||||||
|
(platform.name, board_config.id)
|
||||||
|
]
|
||||||
|
|
||||||
debug_tools = board_config.get("debug", {}).get("tools")
|
def _get_plaform_data():
|
||||||
|
data = ["PLATFORM: %s @ %s" % (platform.title, platform.version)]
|
||||||
|
src_manifest_path = platform.pm.get_src_manifest_path(
|
||||||
|
platform.get_dir())
|
||||||
|
if src_manifest_path:
|
||||||
|
src_manifest = util.load_json(src_manifest_path)
|
||||||
|
if "version" in src_manifest:
|
||||||
|
data.append("#" + src_manifest['version'])
|
||||||
|
if int(ARGUMENTS.get("PIOVERBOSE", 0)):
|
||||||
|
data.append("(%s)" % src_manifest['url'])
|
||||||
|
if board_config:
|
||||||
|
data.extend([">", board_config.get("name")])
|
||||||
|
return data
|
||||||
|
|
||||||
|
def _get_hardware_data():
|
||||||
|
data = ["HARDWARE:"]
|
||||||
|
mcu = env.subst("$BOARD_MCU")
|
||||||
|
f_cpu = env.subst("$BOARD_F_CPU")
|
||||||
|
if mcu:
|
||||||
|
data.append(mcu.upper())
|
||||||
|
if f_cpu:
|
||||||
|
f_cpu = int("".join([c for c in str(f_cpu) if c.isdigit()]))
|
||||||
|
data.append("%dMHz" % (f_cpu / 1000000))
|
||||||
|
if not board_config:
|
||||||
|
return data
|
||||||
ram = board_config.get("upload", {}).get("maximum_ram_size")
|
ram = board_config.get("upload", {}).get("maximum_ram_size")
|
||||||
flash = board_config.get("upload", {}).get("maximum_size")
|
flash = board_config.get("upload", {}).get("maximum_size")
|
||||||
hardware_data.append(
|
data.append("%s RAM [%s Flash]" %
|
||||||
"%s RAM (%s Flash)" %
|
(util.format_filesize(ram), util.format_filesize(flash)))
|
||||||
(util.format_filesize(ram), util.format_filesize(flash)))
|
return data
|
||||||
configuration_data.append(
|
|
||||||
"https://docs.platformio.org/page/boards/%s/%s.html" %
|
|
||||||
(platform.name, board_config.id))
|
|
||||||
|
|
||||||
for data in (configuration_data, platform_data, hardware_data):
|
def _get_debug_data():
|
||||||
if len(data) > 1:
|
debug_tools = board_config.get(
|
||||||
|
"debug", {}).get("tools") if board_config else None
|
||||||
|
if not debug_tools:
|
||||||
|
return None
|
||||||
|
data = [
|
||||||
|
"DEBUG:",
|
||||||
|
"CURRENT(%s)" % board_config.get_debug_tool_name(
|
||||||
|
env.GetProjectOption("debug_tool"))
|
||||||
|
]
|
||||||
|
onboard = []
|
||||||
|
external = []
|
||||||
|
for key, value in debug_tools.items():
|
||||||
|
if value.get("onboard"):
|
||||||
|
onboard.append(key)
|
||||||
|
else:
|
||||||
|
external.append(key)
|
||||||
|
if onboard:
|
||||||
|
data.append("ON-BOARD(%s)" % ", ".join(sorted(onboard)))
|
||||||
|
if external:
|
||||||
|
data.append("EXTERNAL(%s)" % ", ".join(sorted(external)))
|
||||||
|
return data
|
||||||
|
|
||||||
|
def _get_packages_data():
|
||||||
|
data = []
|
||||||
|
for name, options in platform.packages.items():
|
||||||
|
if options.get("optional"):
|
||||||
|
continue
|
||||||
|
pkg_dir = platform.get_package_dir(name)
|
||||||
|
if not pkg_dir:
|
||||||
|
continue
|
||||||
|
manifest = platform.pm.load_manifest(pkg_dir)
|
||||||
|
original_version = util.get_original_version(manifest['version'])
|
||||||
|
info = "%s %s %s" % (manifest['name'],
|
||||||
|
"#" if "__src_url" in manifest else "@",
|
||||||
|
manifest['version'])
|
||||||
|
extra = []
|
||||||
|
if original_version:
|
||||||
|
extra.append(original_version)
|
||||||
|
if "__src_url" in manifest and int(ARGUMENTS.get("PIOVERBOSE", 0)):
|
||||||
|
extra.append(manifest['__src_url'])
|
||||||
|
if extra:
|
||||||
|
info += "(%s)" % ", ".join(extra)
|
||||||
|
data.append(info)
|
||||||
|
return ["PACKAGES:", ", ".join(data)]
|
||||||
|
|
||||||
|
for data in (_get_configuration_data(), _get_plaform_data(),
|
||||||
|
_get_hardware_data(), _get_debug_data(),
|
||||||
|
_get_packages_data()):
|
||||||
|
if data and len(data) > 1:
|
||||||
print(" ".join(data))
|
print(" ".join(data))
|
||||||
|
|
||||||
# Debugging
|
|
||||||
if not debug_tools:
|
|
||||||
return
|
|
||||||
|
|
||||||
data = [
|
|
||||||
"CURRENT(%s)" %
|
|
||||||
board_config.get_debug_tool_name(env.GetProjectOption("debug_tool"))
|
|
||||||
]
|
|
||||||
onboard = []
|
|
||||||
external = []
|
|
||||||
for key, value in debug_tools.items():
|
|
||||||
if value.get("onboard"):
|
|
||||||
onboard.append(key)
|
|
||||||
else:
|
|
||||||
external.append(key)
|
|
||||||
if onboard:
|
|
||||||
data.append("ON-BOARD(%s)" % ", ".join(sorted(onboard)))
|
|
||||||
if external:
|
|
||||||
data.append("EXTERNAL(%s)" % ", ".join(sorted(external)))
|
|
||||||
|
|
||||||
print("DEBUG: %s" % " ".join(data))
|
|
||||||
|
|
||||||
|
|
||||||
def exists(_):
|
def exists(_):
|
||||||
return True
|
return True
|
||||||
|
@ -318,9 +318,11 @@ class CygwinEnvDetected(PlatformioException):
|
|||||||
|
|
||||||
class DebugSupportError(PlatformioException):
|
class DebugSupportError(PlatformioException):
|
||||||
|
|
||||||
MESSAGE = ("Currently, PlatformIO does not support debugging for `{0}`.\n"
|
MESSAGE = (
|
||||||
"Please contact support@pioplus.com or visit "
|
"Currently, PlatformIO does not support debugging for `{0}`.\n"
|
||||||
"< https://docs.platformio.org/page/plus/debugging.html >")
|
"Please request support at https://github.com/platformio/"
|
||||||
|
"platformio-core/issues \nor visit -> https://docs.platformio.org"
|
||||||
|
"/page/plus/debugging.html")
|
||||||
|
|
||||||
|
|
||||||
class DebugInvalidOptions(PlatformioException):
|
class DebugInvalidOptions(PlatformioException):
|
||||||
|
@ -330,14 +330,15 @@ class PkgInstallerMixin(object):
|
|||||||
name += "_ID%d" % manifest['id']
|
name += "_ID%d" % manifest['id']
|
||||||
return str(name)
|
return str(name)
|
||||||
|
|
||||||
def get_src_manifest_path(self, pkg_dir):
|
@classmethod
|
||||||
|
def get_src_manifest_path(cls, pkg_dir):
|
||||||
if not isdir(pkg_dir):
|
if not isdir(pkg_dir):
|
||||||
return None
|
return None
|
||||||
for item in os.listdir(pkg_dir):
|
for item in os.listdir(pkg_dir):
|
||||||
if not isdir(join(pkg_dir, item)):
|
if not isdir(join(pkg_dir, item)):
|
||||||
continue
|
continue
|
||||||
if isfile(join(pkg_dir, item, self.SRC_MANIFEST_NAME)):
|
if isfile(join(pkg_dir, item, cls.SRC_MANIFEST_NAME)):
|
||||||
return join(pkg_dir, item, self.SRC_MANIFEST_NAME)
|
return join(pkg_dir, item, cls.SRC_MANIFEST_NAME)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_manifest_path(self, pkg_dir):
|
def get_manifest_path(self, pkg_dir):
|
||||||
|
Reference in New Issue
Block a user