saltstack/salt — pull request #16865 by sbworth (2014-10-24 03:25:17+00:00)
Title: Provide the ability to pass environment variables into pip build process

While attempting to pip install a scientific data handling package, pyhdf, it became apparent that a mechanism is required to pass environment variables into the child processes of pip in order to tweak the Makefile-based build process. For this specific package, it is the equivalent of:
```
export INCLUDE_DIRS=/usr/local/hdf-4.2r3/include
export LIBRARY_DIRS=/usr/local/hdf-4.2r3/lib
make
make install
```
where the environment variables are used inside the Makefile in this case, but could also affect a configure script or other build tools used in the creation of a Python C module.

The accompanying commit, implements this feature in a simple and straight-forward way that immediately resolved my own build problem. In fact, at the risk of bringing the wrath of the coding gods down on my head, I might dare to say that it is "obviously correct". :-/

The specific state file fragment with which I have used this patch and obtained a successful build is:
```
py27_sci_pkg_pyhdf-tweaked:
pip.installed:
- name: pyhdf
- no_index: True
- find_links: /var/lib/pip_cache/pyhdf-0.8.3.zip
- bin_env: {{venv_dir}}
- user: py27_sci
- env_vars:
INCLUDE_DIRS: /usr/include/hdf
LIBRARY_DIRS: '/usr/lib64/hdf:/usr/local/package/util/szip/2.1/lib'
```