Fix setup.py that can't deal with symlink when setup environment variables
Refactor setup.py reuse some of the code
Merge pull request #7421 from darkdukey/fix_setup_script

Fix setup.py can't resolve symlink