#!/usr/bin/env python
"""
setuphelper.py
Copyright (C) 2008-2009 by Peter A. Donis

Released under the Python Software Foundation License.

This script uses the SetupHelper module to automatically download
and install packages you list on the command line. The only
option it recognizes is --use-setuptools (short form -s), which
causes SetupHelper to use setuptools' easy_install function to
do the download and installation. All other command line
arguments are assumed to be package names.
"""

import sys

# Munge sys.argv to pull out setuptools option and package names
__install_requires__ = []
removes = []
for arg in sys.argv[1:]:
    if arg in ('-s', '--use-setuptools'):
        __distutils_pkg__ = 'setuptools'
        removes.append(arg)
    elif not arg.startswith('-'):
        __install_requires__.append(arg)
        removes.append(arg)
for item in removes:
    sys.argv.remove(item)

del sys, removes, arg, item # prevents leakage into globals() below

if __name__ == '__main__':
    from SetupHelper import setup_main
    setup_main(globals())
