Add dynamic interpolation for package paths

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

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

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.

Description

config feature

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 [email protected]. 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.

Dominant language
Python
Stars
9.6k
Forks
916
PR merge metrics
No merged PRs in 30d

Getting set up

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.

More from platformio/platformio-core

All issues in platformio/platformio-core

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.