Skip to content
This repository has been archived by the owner on Oct 5, 2019. It is now read-only.

adds binaries in path to collection #158

Merged
merged 3 commits into from
Oct 13, 2017
Merged

Conversation

ytonui
Copy link
Contributor

@ytonui ytonui commented Sep 27, 2017

This change adds binaries in the PATH environment variable to the collection

Copy link
Contributor

@jjsendor jjsendor left a comment

Choose a reason for hiding this comment

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

Would be good to add some unit tests for this new functionality :)

@@ -913,6 +915,7 @@ def collect(self, section_list=None):
('safari', self._collect_safari),
('accounts', self._collect_accounts),
('mail', self._collect_mail),
('executables', self._collect_binary_names_in_path)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a missing , at the end of this line?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

++ I missed this copy pasting between different checkouts

return os.path.isfile(fpath) and os.path.exists(fpath) and os.access(fpath, os.X_OK)

if PATH_ENVIRONMENT_NAME in os.environ:
for bin_dir in os.environ[PATH_ENVIRONMENT_NAME].split(":"):
Copy link
Contributor

Choose a reason for hiding this comment

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

Super small nit and probably unnecessary since OS X uses colon as path separator by default, but maybe using os.pathsep for more readability?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense @leeren, I'll update it.

exe_files = []

def is_exe(fpath):
return os.path.isfile(fpath) and os.path.exists(fpath) and os.access(fpath, os.X_OK)
Copy link
Contributor

Choose a reason for hiding this comment

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

os.path.isfile always implies os.path.exists, so the latter seems redundant. You could also have a directory mislabelled as an executable which would probably further encourage just using os.path.isfile and os.access alone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ditto

Copy link
Contributor

@leeren leeren left a comment

Choose a reason for hiding this comment

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

Looks good to me besides missing comma on line 918

Copy link
Contributor

@jjsendor jjsendor left a comment

Choose a reason for hiding this comment

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

Ship it!

@ytonui ytonui merged commit 0fc767a into master Oct 13, 2017
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