File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -106,6 +106,20 @@ def configuration(parent_package='', top_path=None):
106
106
if res != 0 :
107
107
raise Exception ('2to3 failed, exiting ...' )
108
108
109
+ # Ugly hack to make pip work with Python 3, see
110
+ # http://projects.scipy.org/numpy/ticket/1857.
111
+ # Explanation: pip messes with __file__ which interacts badly with the
112
+ # change in directory due to the 2to3 conversion. Therefore we restore
113
+ # __file__ to what it would have been otherwise.
114
+ global __file__
115
+ __file__ = os .path .join (os .curdir , os .path .basename (__file__ ))
116
+ if '--egg-base' in sys .argv :
117
+ # Change pip-egg-info entry to absolute path, so pip can find it
118
+ # after changing directory.
119
+ idx = sys .argv .index ('--egg-base' )
120
+ if sys .argv [idx + 1 ] == 'pip-egg-info' :
121
+ sys .argv [idx + 1 ] = os .path .join (old_path , 'pip-egg-info' )
122
+
109
123
os .chdir (local_path )
110
124
sys .path .insert (0 , local_path )
111
125
You can’t perform that action at this time.
0 commit comments