Commits

Brandon Rhodes  committed afe98ad

After thinking more about the danger of making any assumptions about
where site.py lives, I have fallen back to an even earlier idea that I
had while rewriting the virtualenv site.py: having it just look through
the system site.py for a "site.py" file, like Python itself would. The
only thing that I think could foil this code is if "site.py" were inside
of a zipfile.

  • Participants
  • Parent commits 4f06d90

Comments (0)

Files changed (2)

File virtualenv.py

 
 ##file site.py
 SITE_PY = """
-eJx9WE2P2zYQvftXsM7BMmK7DXrbIof0UKSXNmhTpMEiMGiJstmlSIGk7PW/7xt+SJTj3Ry8sUwO
-5+PNm0e9YZ9Pgp2l9QNXQp/Z0kkvdv11uVjIrjfWM+M2zF3dYvGGfRGqNp1g3hRbfqBfCisMz6Q1
-uhPaM2WOsmbSManPwnnR4D/MY3FrlDIXqY+sHXTtpdEbmLEcv1ks4Jr9NzjP7KA1LUq7jsoccIKr
-TS+YafEMpjvTDEps2EHUfHACZrpBedmruy5hvTyePFYz53n9BJcMjJue7Alen5ghH8gbrht2OQkd
-H5dh1Vwpx5biWdStVKJaL8mIhPGeWyxYuSKRZOiaXT9zK/lBCRdDGt1n2MfMWdiLld4LvVssGtEW
-ad5LLX21flgw/Asfb9hv0jq/YRfBGuGF7aQW5DAsBcu9FY68LcqLp8rUHIXYUHjJjjaeNnIfQtDc
-y7Ogmu9goZXP2AV3aKmSh/7qT4j1PXCx61GuXSOt5p2o9ntKxX6/DivTzveFmfCcUraf/Vg8WSR/
-/hDPMSwreBMKX6MCqFThU6i+YJ+iO1KjmEpxAlIy4imeC3cMmGgIsjWs+ZSaO8BIIbYUWi90leP7
-z0hdjYFv2MpYedxGL3b+2a/WMWLyDSeoKbqWvjfVeue8lX0Vl7W7WhkHyORgP2jUopUa7l9D0Afy
-E6Fx5uRRU6BWKCnaHxj7p6dAYnHhFpKEhcnOnZAAw5SfE/JwEIBybigTG8pLQNMJdHmbzEQ4OoTT
-KamfQsfiTALGEln4Mabh393XJUPlRe2Nve4Y+3XwgNEF/ic7NVrYCkJzghJiIueD3wyloeN7NC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HUsvgd7zM+Eoj8hwhz3QtWZ8xUOFpFsiaTlQaZgbjuib3owknnoxf1tD
+/fjsi5o4B8I7pXQMOwrv6G2S2GZfOJwOJYob2wTCuepMw49O7K2pBc3c32EnKIZwDzPem64zzj9x
+2w7HSZ+YoPQJZkA7Z3kO47L6EiTBOPcSf3fce4ponPuachMVA/w6oq3ovRTBGd+dwGBvSGaiUuQA
+jknvymqOLSBokqHBBIlYK2NGG+oW6AN6T5Tfxg0Y3WKH8v/0wmnxH43XtjI=
 """.decode("base64").decode("zlib")
 
 ##file ez_setup.py

File virtualenv_support/site.py

     # sys.exec_prefix to the value that the parent environment expects,
     # then set them back when "site.py" is done working.
 
-    real_site_py = os.path.join(
-        sys.real_prefix, 'lib', 'python' + sys.version[:3], 'site.py',
-        )
+    for i in range(pythonpath_len, len(sys.path)):
+        real_site_py = os.path.join(sys.path[i], 'site.py')
+        if os.path.exists(real_site_py):
+            break
 
     sys.prefix = sys.real_prefix
     sys.exec_prefix = sys.real_prefix