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

[Bug]: Module import conflicts due to basetool_tiano_python_path_env.yaml #110

Open
Javagedes opened this issue Nov 27, 2023 · 0 comments
Open
Labels
bug Something isn't working

Comments

@Javagedes
Copy link
Contributor

Javagedes commented Nov 27, 2023

Contact Details

[email protected]

Describe the Bug

basetool_tiano_python_path_env.yaml needs to be removed as it causes relative module import conflicts between in-tree basetools and pip basetools under the following situation:

  1. you are in a virtual environment where the folder is located (alphebetically) before Basetools/*
  2. edk2-basetools pip module is installed
  3. You are building using the In-Tree base tools.

Stuart recursively searches through the entire workspace searching for *_path_env.yaml files. Once the workspace has been searched, it does a reverse-order insertion of all paths into the PYTHONPATH. This results in any relative imports (which occur frequently in the in-tree basetools) searching, and incorrectly linking against the code inside the pypi-basetools. This is unexpected behavior when building with the in-tree basetools.

Note: This is not true in the reverse scenario because pypi-basetools does not use relative imports, all imports are edk2basetools.<something>

This issue can be seen in the mailing list here

Reproduction steps

From the root of the repository (edk2)

  1. python -m venv .venv (NOTE: The virtual environment being named .venv is critical
  2. pip install --upgrade -r pip-requirements.txt
  3. stuart_setup -c .pytool/CISettings.py
  4. stuart_update -c .pytool/CISettings.py
  5. stuart_ci_build -c .pytool/CISettings.py -no_piptools <any other flags>

You will see the same error as reported here

Expected behavior

Basetools should link against the expected code. That is to say, in-tree basetools should link against in-tree basetools source. and pypi basetools should link against pypi basetools source.

Execution Environment

  1. you are in a virtual environment where the folder is located (alphebetically) before Basetools/*
  2. edk2-basetools pip module is installed
  3. You are building using the In-Tree base tools.

Pip packages

No response

Additional context

The solution is to simply remove the file basetool_tiano_python_path_env.yaml from this repository. It does not serve a purpose here and only causes this conflict.

@Javagedes Javagedes added the bug Something isn't working label Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant