platformio / platformio/platformio-core

Add dynamic interpolation for package paths

Open
#5,233 13 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

config feature
Dominant language
Python
Stars
9.5k
Forks
905
Avg merge
2d 13h
Merged PRs (30d)
2

Description

It is extremely common and even recommended for Atmel AVR chips, when uploading via a programmer, to reference the path of a tool via e.g.

upload_flags =
    -C
    ; use "tool-avrdude-megaavr" for the atmelmegaavr platform
    ${platformio.packages_dir}/tool-avrdude/avrdude.conf

However, this is extremely fragile and non-reproducable, because sometimes the "tool-avrdude" that the project uses is actually in tool-avrdude@1.70100.0. Or there might be a case where platform_packages is used with a e.g. symlink:// so that the tool isn't even in ${platformio.packages_dir}.

See e.g. https://community.platformio.org/t/unable-to-upload-to-attiny814

This leads to frustration when users have to search for the errors in platformio.ini directives that the official documentation gives them. PlatformIO has no builtin way to reference the actual path used for a certain package.

Of course, one can write an extra script and use

Import("env")
platform = env.PioPlatform()
path = platform.get_package_dir("tool-avrdude")

to get the actual path, but that's very cumbersome. PlatformIO should have an interpolation syntax of maybe

${packages.tool-avrdude}

that fills in the actual path for the package.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the package lookup entry point env.PioPlatform().get_package_dir(...) and the platformio.ini interpolation use described in the issue. Done means configuration such as upload_flags can resolve the actual package path, including versioned or symlink:// platform_packages, without an extra script.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.