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

{catkin,python} plugin: support cleaning #2171

Merged

Conversation

kyrofa
Copy link
Contributor

@kyrofa kyrofa commented Jun 26, 2018

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on bug reports?
  • If this is a new feature. Have you discussed the design on the forum?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh unit?

Both the Catkin and Python plugins utilize the Pip class in order to clean their pull steps (specifically, they tell the Pip class to clean its packages). However, when cleaning the pull step, Python has already been removed from the installdir, which means the Pip class cannot be instantiated, causing an error about being unable to find Python.

It's reasonable to ask Pip to clean any fetched packages, and doing so doesn't require Python. This PR fixes LP: #1778716 by lazily looking for Python only when it's required instead of upon class instantiation.

@@ -159,20 +171,20 @@ def _ensure_pip_installed(self):
if not self._is_pip_installed():
logger.info('Fetching and installing pip...')

real_python_home = self._python_home
real_python_home = self.__python_home
Copy link
Collaborator

Choose a reason for hiding this comment

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

doesn't this have an extra _?

Copy link
Collaborator

Choose a reason for hiding this comment

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

ah, this is weird :-P

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it looks a tad off, but it maintains current behavior: "Ignore whatever you think you know, use this one. Okay, now you can go back to normal."

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, it is made clear in the comments below, but not as I read line by line until I reached the end of it 😄

Both the Catkin and Python plugins utilize the Pip class in order to
clean their pull steps (specifically, they tell the Pip class to clean
its packages). However, when cleaning the pull step, Python has already
been removed from the installdir, which means the Pip class cannot be
instantiated, causing an error about being unable to find Python.

It's reasonable to ask Pip to clean any fetched packages, and doing so
doesn't require Python. Fix this issue by lazily looking for Python only
when it's required instead of upon class instantiation.

LP: #1778716

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
@kyrofa kyrofa force-pushed the bugfix/1778716/clean_python_plugin branch from 0149284 to b2a9dac Compare June 26, 2018 18:50
@codecov-io
Copy link

codecov-io commented Jun 26, 2018

Codecov Report

Merging #2171 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2171      +/-   ##
==========================================
+ Coverage   91.31%   91.32%   +<.01%     
==========================================
  Files         201      201              
  Lines       12610    12617       +7     
  Branches     1872     1874       +2     
==========================================
+ Hits        11515    11522       +7     
  Misses        741      741              
  Partials      354      354
Impacted Files Coverage Δ
snapcraft/plugins/python.py 89.56% <ø> (ø) ⬆️
snapcraft/plugins/_python/_pip.py 97.39% <100%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 208a767...b2a9dac. Read the comment docs.

@sergiusens sergiusens merged commit a54a7a4 into canonical:master Jun 27, 2018
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.

None yet

3 participants