#!/usr/bin/env python
"""PepVal ~ A combination of two PEP8 Validators."""
import sys
from multiprocessing import Process


try:
    import pip
except ImportError:
    print "pip not found. Please install pip by using 'sudo apt-get install python-pip -y'"
    sys.exit(1)
else:
    def install(package):
        pip.main(['install', package])


try:
    import setuptools

except ImportError:
    print "SetupTools not found. Installing..."
    if __name__ == '__main__':
        install('setuptools')


try:
    import flake8
except ImportError:
    try:
    print "Flake8 not found. Installing..."
    if __name__ == '__main__':
        install('flake8')


try:
    import pydocstyle
except ImportError:
    print "PyDocStyle not found. Installing..."
    if __name__ == '__main__':
        install('pydocstyle')


def pydocstylerun():
    """Run the PyDocStyle validator."""
    print execfile("pydocstyle")
def flake8run():
    """Run the Flake8 validator."""
    print execfile("flake8")
    


if __name__=='__main__':
    """Runs the functions simultaneously."""
    DocStyleRun = Process(target = pydocstylerun)
    DocStyleRun.start()
    Flake8Run = Process(target = flake8run)
    Flake8Run.start()
