mirror of
https://github.com/kennethreitz/heroku-buildpack-python.git
synced 2026-06-05 06:56:13 +00:00
ff94908505
* Revert "use pkg_resources to check for distributions (#395)"
This reverts commit 9b185f99d5.
* use sp-grep for django detection
* sp-grep
* fix setuptools script
38 lines
733 B
Python
Executable File
38 lines
733 B
Python
Executable File
#!/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() |