@@ -743,6 +743,10 @@ def detect_modules(self):
743743 missing .extend (['imageop' ])
744744
745745 # readline
746+ # Pyston change: in some container system, the dependencies are provided by
747+ # LIBRARY_PATH env variable
748+ lib_dirs += os .getenv ('LIBRARY_PATH' , '' ).split (os .pathsep )
749+
746750 do_readline = self .compiler .find_library_file (lib_dirs , 'readline' )
747751 readline_termcap_library = ""
748752 curses_library = ""
@@ -1402,6 +1406,9 @@ class db_found(Exception): pass
14021406 # provided by the ncurses library.
14031407 panel_library = 'panel'
14041408 curses_incs = None
1409+ # Pyston change: in some container system. The headfile are provided
1410+ # by CPATH env variable
1411+ inc_dirs += os .getenv ('CPATH' , '' ).split (os .pathsep )
14051412 if curses_library .startswith ('ncurses' ):
14061413 if curses_library == 'ncursesw' :
14071414 # Bug 1464056: If _curses.so links with ncursesw,
@@ -2075,8 +2082,8 @@ def configure_ctypes(self, ext):
20752082
20762083 srcdir = sysconfig .get_config_var ('srcdir' )
20772084 ffi_builddir = os .path .join (self .build_temp , 'libffi' )
2078- ffi_srcdir = os . path . abspath ( os . path . join ( srcdir , 'Modules' ,
2079- ' _ctypes' , ' libffi' ))
2085+ # Pyston change: adjust the source directory path
2086+ ffi_srcdir = os . path . abspath ( relpath ( 'Modules/ _ctypes/ libffi' ))
20802087 ffi_configfile = os .path .join (ffi_builddir , 'fficonfig.py' )
20812088
20822089 from distutils .dep_util import newer_group
@@ -2088,8 +2095,10 @@ def configure_ctypes(self, ext):
20882095 ffi_configfile ):
20892096 from distutils .dir_util import mkpath
20902097 mkpath (ffi_builddir )
2091- config_args = [arg for arg in sysconfig .get_config_var ("CONFIG_ARGS" ).split ()
2092- if (('--host=' in arg ) or ('--build=' in arg ))]
2098+ # Pyston change: we don't support config var yet
2099+ # config_args = [arg for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
2100+ # if (('--host=' in arg) or ('--build=' in arg))]
2101+ config_args = []
20932102 if not self .verbose :
20942103 config_args .append ("-q" )
20952104
@@ -2176,12 +2185,9 @@ def detect_ctypes(self, inc_dirs, lib_dirs):
21762185 # in /usr/include/ffi
21772186 inc_dirs .append ('/usr/include/ffi' )
21782187
2179- # Pyston change: still hard code the ffi include dir
2180- # because we don't support this variable configuration in get_config_var yet
2181- ffi_inc = ['/usr/include/x86_64-linux-gnu' ]
2182- # ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
2183- if not ffi_inc or ffi_inc [0 ] == '' :
2184- ffi_inc = find_file ('ffi.h' , [], inc_dirs )
2188+ ffi_inc = [sysconfig .get_config_var ("LIBFFI_INCLUDEDIR" )]
2189+ if not ffi_inc [0 ] or ffi_inc [0 ] == '' :
2190+ ffi_inc = find_file ('ffi.h' , inc_dirs , inc_dirs )
21852191 if ffi_inc is not None :
21862192 ffi_h = ffi_inc [0 ] + '/ffi.h'
21872193 fp = open (ffi_h )
0 commit comments