So, I'm developing a project, and I'm writing setup.py script for it, using distutils. I'm using CPython3.3.
I use some libraries that have invalid distributions in PyPI, so they have to be installed by cloning repo and running setup.py manually (I've tried many things, both libraries help said I just need to use git instead of PyPI, so why I need to do that this way is not a question here).
So, I've used some subprocess magic, and created script that clones repos and runs "setup.py install" in them. It also runs apps setup.py, after ensuring that broken libs are already installed other way. It is easy to convert to several methods, and will be enhanced in few moments. At the moment my app may be installed by running this script (I called it build.py).
How do I create a hook in my setup.py script (for my app) that will run methods installing things from github when (and ONLY when) "install" argument was passed to apps setup.py?
What I've tried
I tried googling phrases like "how do I hook setup.py" - more or less general, I tried several queries. Nothing has been found.
Also, I tried to analyze distutils source, to find some way, but that also got me nowhere.
Haven't tried it yet, but I know it is doable - at the beginning of setup.py script checking whether conditions like "it is ran as main script" and "'install' keyword is in sys.argv" are true, and if so - running my git-related methods, but this is ugly as hell.