Skip to content

Dependencies of private libraries should not be re-installed #4987

Closed

Description

@SRGDamia1

What kind of issue is this?

  • PlatformIO Core.
    If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system:

WIndows 11

PlatformIO Version (platformio --version):

PlatformIO Core, version 6.1.16

Description of problem

Dependencies of private libraries should not be re-installed in env lib deps folder if they already exist in the private library folder.

Steps to Reproduce

  1. Install library with dependencies and those dependencies to private library folder (lib)
  • ie, install Adafruit BME280 Library, Adafruit Unified Sensor, and Adafruit BusIO all to the lib folder
  1. Build

Actual Results

The dependencies are re-installed in the environment folder

  • ie, Adafruit Unified Sensor and Adafruit BusIO are reinstalled in .pio\lib_deps(env_name} although they are already in the private lib folder

Expected Results

The dependencies should not be reinstalled

Additional info

I this should be fixed in by changing:

def _install_project_private_library_deps(private_pkg, private_lm, env_lm, options):
for dependency in private_lm.get_pkg_dependencies(private_pkg) or []:
spec = private_lm.dependency_to_spec(dependency)
# skip built-in dependencies
if not spec.external and not spec.owner:
continue
pkg = private_lm.get_package(spec)
if not pkg and not env_lm.get_package(spec):
pkg = env_lm.install(
spec,
skip_dependencies=True,
force=options.get("force"),
)
if not pkg:
continue
_install_project_private_library_deps(pkg, private_lm, env_lm, options)

to

def _install_project_private_library_deps(private_pkg, private_lm, env_lm, options):
    for dependency in private_lm.get_pkg_dependencies(private_pkg) or []:
        spec = private_lm.dependency_to_spec(dependency)
        # skip built-in dependencies
        if not spec.external and not spec.owner:
            continue
        pkg = private_lm.get_package(spec)
        if not pkg and not private_lm.get_package(spec) and not env_lm.get_package(spec):
            #          ^^^ add this                 ^^^
            pkg = env_lm.install(
                spec,
                skip_dependencies=True,
                force=options.get("force"),
            )
        if not pkg:
            continue
        _install_project_private_library_deps(pkg, private_lm, env_lm, options)

There should be a check if the library is installed in the private_lm.

Activity

  1. added this to the 6.1.17 milestone on Oct 5, 2024
  2. ivankravets commented on Dec 12, 2024

    @ivankravets
    Member

    Thanks for the report! Please re-test with pio upgrade --dev.

  3. added a commit that references this issue on Dec 12, 2024
    ec2d01f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    LDFbugpackage management

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions