Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid "Can not remove temporary directory" error message #4480

Closed
nomis opened this issue Nov 28, 2022 · 7 comments
Closed

Invalid "Can not remove temporary directory" error message #4480

nomis opened this issue Nov 28, 2022 · 7 comments
Labels
bug config platformio.ini
Milestone

Comments

@nomis
Copy link
Contributor

nomis commented Nov 28, 2022

Configuration

Operating system: Ubuntu 18.04

PlatformIO Version (platformio --version): 6.1.4

Description of problem

I get the following error message on every build:

Can not remove temporary directory `/.../aurora-coriolis/.pio/build`. Please remove it manually to avoid build issues

This code in platformio/run/cli.py completely ignores the exception that is generated, which has nothing to do with a build directory:

        # clean obsolete build dir
        if not disable_auto_clean:
            build_dir = config.get("platformio", "build_dir")
            try:
                clean_build_dir(build_dir, config)
            except:  # pylint: disable=bare-except
                click.secho(
                    "Can not remove temporary directory `%s`. Please remove "
                    "it manually to avoid build issues" % build_dir,
                    fg="yellow",
                )

The actual exception is:

  File "/home/simon/.local/lib/python3.7/site-packages/platformio/project/config.py", line 322, in _re_interpolation_handler
    assert parent_section.startswith("env:")

Steps to Reproduce

  1. git clone https://github.com/nomis/aurora-coriolis/
  2. cd aurora-coriolis
  3. git checkout 2a1cc02d63c7bca1eb8329e1d6f3e1f1cdd69ef8
  4. git submodule sync
  5. git submodule update --init --depth 1
  6. platformio run -e native
  7. platformio run -e native

Actual Results

Can not remove temporary directory `/.../aurora-coriolis/.pio/build`. Please remove it manually to avoid build issues

Expected Results

No request to delete the .pio/build directory.

Error message about the "invalid" configuration?

Additional info

The configuration in /platformio.ini and /src/app/pio/config.ini is complicated but it's not invalid.

The test_testing_command in the app:native_test section works correctly when used for testing environments native_test and native_test_coverage.

@ivankravets ivankravets added bug config platformio.ini labels Nov 28, 2022
@ivankravets ivankravets added this to the 6.1.6 milestone Jan 4, 2023
@ivankravets
Copy link
Member

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

@nomis
Copy link
Contributor Author

nomis commented Jan 25, 2023

Yes that fixes the warning... but now I'll need to raise an issue for the invalid error that completely stops my build:

Error: `${this.__env__}` is called from the `app:native_test` section that is not valid PlatformIO environment, see for option `__env__` in section [app:native_test]

@ivankravets
Copy link
Member

app:native_test

The app:native_test is not a PlatformIO env. It must start with env: prefix.

@nomis
Copy link
Contributor Author

nomis commented Jan 25, 2023

No it doesn't. It must be evaluated in the context of an environment but it can be defined in a section that an environment later extends.

@ivankravets
Copy link
Member

${this} points to the current INI section where it was declared. Could you provide an example of using this.__env__ and what do you expect?

@nomis
Copy link
Contributor Author

nomis commented Jan 25, 2023

(The structure of the repo is a bit unusual because I'm using source from a submodule and only one src_dir is allowed. I need to put reusable environment config in the submodule src/app/pio/config.ini without those being defined as environments. The platformio.ini in the repo itself defines one or more environments.)

https://github.com/nomis/aurora-coriolis/blob/main/platformio.ini

[platformio]
extra_configs = src/app/pio/config.ini

[env:native_test]
extends = app:native_test

https://github.com/nomis/mcu-app/blob/63bff2e018c6f1c4433ba830693bde7b6105a839/pio/config.ini

[app:common]

[app:native]
extends = app:common

[app:native_test]
extends = app:native
test_testing_command =
	${platformio.src_dir}/app/pio/testing-command.sh
	${platformio.build_dir}/${this.__env__}/test
	${platformio.build_dir}/${this.__env__}/program

Running platformio test -e native_test executes testing-command.sh with the correct values (otherwise it wouldn't be able to execute the tests).

@ivankravets
Copy link
Member

Thanks, now I understand what you mean. Please [file a feature request] for ${this.__name__}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug config platformio.ini
Projects
None yet
Development

No branches or pull requests

2 participants