nasa / fprime-tools

F´ Python tooling and helpers.
https://github.com/nasa/fprime
Apache License 2.0
21 stars 39 forks source link

Fix for forced purge on non existing directories #202

Closed JohanBertrand closed 6 months ago

JohanBertrand commented 6 months ago
Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

Change Description

Change the behavior of fprime-util purge -f when a build folder does not exists.

Rationale

The current fprime-util purge -f command fails if the build directory does not exist.

That leads to situations where the build-fprime-automatic-native-ut directory exists and could be deleted, but since the build-fprime-automatic-native directory does not exists, the command fails and the UT directory is not deleted.

Previous behavior when only the UT folder exists:

fprime-util purge -f
[WARNING] /home/fprime/settings.ini does not exist
[WARNING] /home/fprime/settings.ini does not exist
[WARNING] /home/fprime/settings.ini does not exist
[INFO] Purge build directory at: /home/fprime/build-fprime-automatic-native
[ERROR] [Errno 2] No such file or directory: '/home/fprime/build-fprime-automatic-native'

New behavior when only the UT folder exists:

fprime-util purge -f
[WARNING] /home/fprime/settings.ini does not exist
[WARNING] /home/fprime/settings.ini does not exist
[WARNING] /home/fprime/settings.ini does not exist
[INFO] Purge build directory at: /home/fprime/build-fprime-automatic-native
[WARNING] Skipping purge. The following directory does not exist: /home/fprime/build-fprime-automatic-native
[INFO] Purge build directory at: /home/fprime/build-fprime-automatic-native-ut

Note: I tried to implement it by changing the behavior of the build.load function, using the skip_validation parameter, without success, since it is also set as true in other places for the purge function where the function should not raise an error.