-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Revert "use pkg_resources to check for distributions (#395)" This reverts commit 9b185f9. * use sp-grep for django detection * sp-grep * fix setuptools script
- Loading branch information
1 parent
5496c02
commit ff94908
Showing
6 changed files
with
88 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
"""Usage: | ||
sp-grep [-s] <package>... | ||
Options: | ||
-h --help Show this screen. | ||
""" | ||
from docopt import docopt | ||
from pkg_resources import DistributionNotFound, get_distribution | ||
|
||
|
||
def has_any_distribution(names, silent=False): | ||
for name in names: | ||
try: | ||
get_distribution(name) | ||
except DistributionNotFound: | ||
continue | ||
|
||
if not silent: | ||
print('Package {name} found!'.format(name=name)) | ||
|
||
exit(0) | ||
|
||
if not silent: | ||
print('Not found.') | ||
|
||
exit(1) | ||
|
||
|
||
def main(): | ||
args = docopt(__doc__, version='sp-grep') | ||
has_any_distribution(names=args['<package>'], silent=args['-s']) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |