Re: [edk2-devel] Basetools as a pip module
Matthew Carlson <matthewfcarlson@...>
Hey Andrew,
toggle quoted messageShow quoted text
Your comments were helpful and valid đ Part of the appeal of making it into a pip module is that it doesnât have a specific file system path. Python itself take cares of it and it can be addressed by the module name rather than adding it to the path. So you hit the nail on the head, EDK_TOOL_PATH doesnât really make sense in an all pip module world. It will probably be deprecated. You can see here: https://github.com/matthewfcarlson/edk2/blob/feature/pip-basetools/BaseTools/BinWrappers/WindowsLike/build.bat that we call directly into the module without having to setup the python path. The file here doesnât use the BaseTools inside EDK2, that still need to built. You have some great questions and Iâll do my best to answer with what has been discussed on the original RFC. * if I run build from the command line how did my path get set? * The pip system adds it to the python patch for you where ever you have it installed (locally, user, system, etc). In addition, pip module offers console scripts, which are small hooks that basically do what the build.bat script does: start the python interpreter and call the build module. So in the current pip module there are a few new commands, one of them being edk2_build which is available anywhere (within the scope of your pip environment). Alternatively, you could use the BinWrappers and let the edksetup do the heavy lifting for you. It should all just work out of the box (fingers crossed). * How do I configure different versions of BaseTools? * So Lazlo pointed out that you could use virtual environments, one for each edk2 clone on your system. It has the added benefit of making your system state much simpler and more reproducible since the pip module are for that repo rather than your whole system. Another option is just to install a local copy of the pip module using pip install -e . which will stay in sync with whatever you have checked out. This does mean an extra step of making sure you have the right commit checked out and probably isnât advisable since itâs easy to forget. But since I only am ever have one clone open at a time, itâs not bad for me personally. * I guess my repo could have a yml file that points to the version of the tools that I use, but that seems like a per user, not per repo config * Thereâs a pip requirement file that keeps track of the exact version of the pip module you need (EDK2 already has one for CI). For a given commit in EDK2, youâd have the exact version of basetools that you know works. * It seems to me we could have developers that want to contribute to edk2 and work on their own code base and that could rehire (require?) two different Basetool versions installed on the system, and I think we need a story for that? * Yeah- I agree that story isnât as fleshed out. In some way itâs better than EDK2âs current story as the basetools can be consumed separately from EDK2 itself. You could setup your own codebase to leverage the basetools as is or you could point it at your own fork of the BaseTools. But I can see folks who have forked EDK2 and have tweaks in BaseTools having to push those changes back into BaseTools. I believe that moving it into itâs own project will make it easier for fixes and other projects to be built off the BaseTools as it makes it easy to include without needing the rest of EDK2 with it. For example, easy to use and easy to install capsule generation tools for FMP devices. * For the macOS Xcode compiler you can install as many versions as you want and there is a command line tool to let you set the current version of Xcode, and to show you the currently select versions. Basically the tools in the magic location in your path are just redirectors to the currently selected tools. * I think thatâs possible inside pip to have sort of the functionality you describe but generally it would be through virtual environments and perhaps installing it in different places (system vs user for example). With pip, you can also do a pip freeze to see the state of your pip system in the given environment. Itâs likely not as robust/fully-featured as the XCode system, though itâs been a few years since I was a serious XCode user and my recollection of exactly the experience is a little fuzzy. Thanks again for your feedback and hopefully that addresses your questions. *From:* Andrew Fish ( afish@... ) *Sent:* Wednesday, September 2, 2020 7:14 PM *To:* Matthew Carlson ( matthewfcarlson@... ) *Cc:* Laszlo Ersek ( lersek@... ) ; edk2-devel-groups-io ( devel@edk2.groups.io ) ; rfc@edk2.groups.io *Subject:* Re: [edk2-devel] Basetools as a pip module Matthew, I did not meant to imply we should optimize for the current installed base, I just think it is useful to think about them. I think Lazlo is pointing out what is best for the project and that should have more weight than the installed base, but it is always good to think how things impact different groups. In terms of the UI I was thinking of pointing to the pip install location vs. your git repo not so much a boolean. I actually donât quite understand what EDK_TOOL_PATH actually means if BaseTools is a pip module. If that is an obsolete concept then we should remove it, and replace with some kind of statement that the pip installed BaseTools are being used. Another question if I run build from the command line how did my path get set? For example my user account has 5 different versions of edk2 in it how do I configure different versions of BaseTools? How do I pip multiple versions on to my system? I guess my repo could have a yml file that points to the version of the tools that I use, but that seems like a per user, not per repo config? It seems to me we could have developers that want to contribute to edk2 and work on their own code base and that could rehire two different Basetool versions installed on the system, and I think we need a story for that. For the macOS Xcode compiler you can install as many versions as you want and there is a command line tool to let you set the current version of Xcode, and to show you the currently select versions. Basically the tools in the magic location in your path are just redirectors to the currently selected tools. Thanks, Andrew Fish
|
|