-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Place all program objects under a single hierarchy #15277
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
base: master
Are you sure you want to change the base?
Conversation
Free the name for a class. Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
7388a93 to
6ad6658
Compare
Signed-off-by: Paolo Bonzini <[email protected]>
OverrideProgram is a subclass of ExternalProgram, so you do not need to have both. Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
Add a separate object that is like OverrideExecutable but isn't duck-typing with Program. [Paolo: remove depends/depend_files, as they are not supported yet by find_program()] Signed-off-by: Paolo Bonzini <[email protected]>
override_find_program() until now returned an OverrideExecutable, which is a kind of BuildTarget, or an OverrideProgram, which is a kind of ExternalProgram. In preparation for making it return a LocalProgram, teach custom_target() and run_target() that it is okay to receive any Program. Signed-off-by: Paolo Bonzini <[email protected]>
override_find_program() until now returned an OverrideExecutable, which is a kind of BuildTarget, or an OverrideProgram, which is a kind of ExternalProgram. In preparation for making it return a LocalProgram, teach configure_file() and run_command() that it is okay to receive any Program. If it is not runnable, Meson will test and complain. Signed-off-by: Paolo Bonzini <[email protected]>
override_find_program() until now returned an OverrideExecutable, which is a kind of Executable, or an OverrideProgram, which is a kind of ExternalProgram. In preparation for making it return a LocalProgram, teach test() and benchmark() that it is okay to receive any Program. Signed-off-by: Paolo Bonzini <[email protected]>
override_find_program() until now returned an OverrideExecutable, which is a kind of Executable, or an OverrideProgram, which is a kind of ExternalProgram. In preparation for making it return a LocalProgram, teach generator() that it is okay to receive any Program. Signed-off-by: Paolo Bonzini <[email protected]>
override_find_program() until now returned an OverrideExecutable, which is a kind of Executable, or an OverrideProgram, which is a kind of ExternalProgram. In preparation for making it return a LocalProgram, teach find_program() that it is okay to return any Program, and propagate the new type to all the users. Signed-off-by: Paolo Bonzini <[email protected]>
override_find_program() until now returned an OverrideExecutable, which is a kind of Executable, or an OverrideProgram, which is a kind of ExternalProgram. In preparation for making it return a LocalProgram, teach add_*_script() that it is okay to receive any Program. Signed-off-by: Paolo Bonzini <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
This is not needed anymore now that there is a proper LocalProgram object that find_program() returns. Signed-off-by: Paolo Bonzini <[email protected]>
Fixes: mesonbuild#15080 Signed-off-by: Paolo Bonzini <[email protected]>
This matches the Python class name, which shows up in errors, and is simpler. Signed-off-by: Paolo Bonzini <[email protected]>
These are useful for the many cases of creating lists of commands that are mixtures of strings and programs
6ad6658 to
5c51412
Compare
| class Generator(HoldableObject): | ||
| def __init__(self, env: Environment, | ||
| exe: T.Union['Executable', programs.ExternalProgram], | ||
| exe: T.Union[Executable, programs.Program, CustomTarget, CustomTargetIndex], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does adding CustomTarget and CustomTargetIndex to the union belong to this commit? I don't understand why it is necessary in the context of the commit.
| return repr_str.format(self.__class__.__name__, self.exe) | ||
|
|
||
| def get_exe(self) -> T.Union['Executable', programs.ExternalProgram]: | ||
| def get_exe(self) -> T.Union[Executable, programs.ExternalProgram, CustomTarget, CustomTargetIndex]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
This cleans up OverrideProgram and OverrideExecutable, replacing them with a single class that is a sibling of ExternalProgram. The two classes are a mess and complicate type annotations noticeably; this change removes the complication and even removes the need for a type alias, because you can almost always just use
Programinstead ofExternalProgram | Executable | OverrideProgram.Extracted from #15107, removing support for
depends/depend_files(not yet supported byfind_program()) and for the ill-fatedlocal_program()function.Fixes: #15080