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

change build job for build_requirements.py #201

Merged
merged 1 commit into from
May 29, 2024

Conversation

ru-fu
Copy link
Contributor

@ru-fu ru-fu commented Mar 13, 2024

Changing the build job to pre_install for the build_requirements.py script means that the build machine will already be fully set up, so that you can use pip to install any packages that are required in custom_conf.py and will otherwise give errors.

This is required to work around #197.

Changing the build job to `pre_install` for the `build_requirements.py`
script means that the build machine will already be fully set up, so
that you can use pip to install any packages that are required in
`custom_conf.py` and will otherwise give errors.

This is required to work around canonical#197.

Signed-off-by: Ruth Fuchss <[email protected]>
@dviererbe
Copy link
Contributor

question: Can you explain how this solves #197?

note: My understanding of the problem is:

flowchart
  style dependency fill:red,color:white
  style requirements.txt stroke-dasharray: 2 2, fill: lightgrey
  style invisible stroke-width:0,fill:#00000000
  
  subgraph build_requirements.py
    direction TB
    invisible[" "] -->|"import"| custom_conf.py
    custom_conf.py -->|"import"| dependency["not yet installed module"]
  end

  build_requirements.py ---x|build fails| requirements.txt
  pip_install["pip install -r requirements.txt"] --x|"can not find"| requirements.txt
Loading

I do not understand how calling build_requirements.py at pre_install changes the situation.

@ru-fu
Copy link
Contributor Author

ru-fu commented Mar 13, 2024

It doesn't solve the problem, but it makes it possible to work around it.

See here for an example.
The workaround is to "manually" install the required modules before running build_requirements.py.
However, if I try to do that at post_checkout, pip isn't installed yet, so it fails. Also if I try to explicitly install pip (as a command or with apt_packages), it isn't available at that stage.
It took me a lot of experimenting to figure out that pip IS available at pre_install. So if we change when build_requirements.py runs, we can easily pip-install packages before it runs.

@AnneCYH AnneCYH self-requested a review May 29, 2024 01:04
Copy link
Contributor

@AnneCYH AnneCYH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@ru-fu ru-fu merged commit f6b30bb into canonical:main May 29, 2024
2 checks passed
@ru-fu ru-fu deleted the build_requirements_hook branch May 29, 2024 09:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants