@@ -99,9 +99,9 @@ def get_python_inc(plat_specific=0, prefix=None):
9999 """
100100 if prefix is None :
101101 prefix = plat_specific and BASE_EXEC_PREFIX or BASE_PREFIX
102- if IS_PYPY :
103- return os . path . join ( prefix , 'include' )
104- elif os .name == "posix" :
102+ if os . name == "posix" :
103+ if IS_PYPY and sys . version_info < ( 3 , 8 ):
104+ return os .path . join ( prefix , 'include' )
105105 if python_build :
106106 # Assume the executable is in the build directory. The
107107 # pyconfig.h file should be in the same directory. Since
@@ -113,7 +113,8 @@ def get_python_inc(plat_specific=0, prefix=None):
113113 else :
114114 incdir = os .path .join (get_config_var ('srcdir' ), 'Include' )
115115 return os .path .normpath (incdir )
116- python_dir = 'python' + get_python_version () + build_flags
116+ implementation = 'pypy' if IS_PYPY else 'python'
117+ python_dir = implementation + get_python_version () + build_flags
117118 return os .path .join (prefix , "include" , python_dir )
118119 elif os .name == "nt" :
119120 if python_build :
@@ -142,7 +143,8 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
142143 If 'prefix' is supplied, use it instead of sys.base_prefix or
143144 sys.base_exec_prefix -- i.e., ignore 'plat_specific'.
144145 """
145- if IS_PYPY :
146+
147+ if IS_PYPY and sys .version_info < (3 , 8 ):
146148 # PyPy-specific schema
147149 if prefix is None :
148150 prefix = PREFIX
@@ -164,8 +166,9 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
164166 else :
165167 # Pure Python
166168 libdir = "lib"
169+ implementation = 'pypy' if IS_PYPY else 'python'
167170 libpython = os .path .join (prefix , libdir ,
168- "python" + get_python_version ())
171+ implementation + get_python_version ())
169172 if standard_lib :
170173 return libpython
171174 else :
@@ -211,10 +214,9 @@ def customize_compiler(compiler):
211214
212215 if 'CC' in os .environ :
213216 newcc = os .environ ['CC' ]
214- if (sys .platform == 'darwin'
215- and 'LDSHARED' not in os .environ
217+ if ('LDSHARED' not in os .environ
216218 and ldshared .startswith (cc )):
217- # On OS X, if CC is overridden, use that as the default
219+ # If CC is overridden, use that as the default
218220 # command for LDSHARED as well
219221 ldshared = newcc + ldshared [len (cc ):]
220222 cc = newcc
@@ -252,6 +254,9 @@ def customize_compiler(compiler):
252254 linker_exe = cc ,
253255 archiver = archiver )
254256
257+ if 'RANLIB' in os .environ and compiler .executables .get ('ranlib' , None ):
258+ compiler .set_executables (ranlib = os .environ ['RANLIB' ])
259+
255260 compiler .shared_lib_extension = shlib_suffix
256261
257262
0 commit comments