Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Search for Python version also in /usr/lib/python #157

Merged
merged 3 commits into from
Dec 20, 2017

Conversation

fridex
Copy link
Contributor

@fridex fridex commented Dec 4, 2017

Path to Python is different on deb-based distributions and rpm-based
distributions (e.g. Fedora, CentOS).

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If your company signed a CLA, they designated a Point of Contact who decides which employees are authorized to participate. You may need to contact the Point of Contact for your company and ask to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the project maintainer to go/cla#troubleshoot.
  • In order to pass this check, please resolve this problem and have the pull request author add another comment and the bot will run again.

Path to Python is different on deb-based distributions and rpm-based
distributions (e.g. Fedora, CentOS).
@googlebot
Copy link

CLAs look good, thanks!

libPath := filepath.Join(pathToLayer, "usr/local/lib")
libContents, err := ioutil.ReadDir(libPath)
if err != nil {
return matches, err
logrus.Warnf("Could not find /usr/local/lib to determine Python version, trying /usr/lib: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

This might read a little bit cleaner if you move all of this into a for loop. Something like:

// First gather all entries from both search paths
libPaths := []string{"usr/local/lib", "usr/lib"}
libContents := []os.FileInfo{}
for _, lp := range libPaths {
  libPath := filepath.Join(pathToLayer, lp)
  entries, err := ioutil.ReadDir(libPath)
  if err != nil {
    logrus.Warnf(...)
    continue
  }
  libContents = append(libContents, entries)
}

// Then look through the appended contents
for _, file := range libContents {
  ...
}

What do you think?

@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this State. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@dlorenc dlorenc force-pushed the pip-fedora branch 2 times, most recently from ebbdff7 to 973d9af Compare December 20, 2017 17:02
Copy link
Contributor

@dlorenc dlorenc left a comment

Choose a reason for hiding this comment

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

Made the swap to a for loop. Now it should find all the different python versions from all locations.

@dlorenc dlorenc merged commit a2850bc into GoogleContainerTools:master Dec 20, 2017
@fridex fridex deleted the pip-fedora branch December 21, 2017 08:51
@fridex
Copy link
Contributor Author

fridex commented Dec 21, 2017

Made the swap to a for loop. Now it should find all the different python versions from all locations.

Thanks @dlorenc. This was on my TODO list, but I didn't find time to modify according to review comments. Thanks for refactoring!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants