Commit b60caa9f authored by Boxiang Sun's avatar Boxiang Sun

Let Pyston can build in SlapOS without manual modification

parent 106533f9
......@@ -24,9 +24,6 @@ CPYTHON := python
ENABLE_VALGRIND := 0
GDB := gdb
# If you followed the old install instructions:
# GCC_DIR := $(DEPS_DIR)/gcc-4.8.2-install
GCC_DIR := /usr
GTEST_DIR := $(DEPS_DIR)/gtest-1.7.0
USE_DEBUG_LIBUNWIND := 0
......@@ -76,8 +73,8 @@ TOOLS_DIR := ./tools
TEST_DIR := $(abspath ./test)
TESTS_DIR := $(abspath ./test/tests)
GPP := $(GCC_DIR)/bin/g++
GCC := $(GCC_DIR)/bin/gcc
GPP := g++
GCC := gcc
ifeq ($(V),1)
VERBOSE := 1
......@@ -155,11 +152,6 @@ COMMON_LDFLAGS += `pkg-config tinfo 2>/dev/null && pkg-config tinfo --libs || ec
# TODO should probably do the linking before MCJIT
COMMON_LDFLAGS += -Wl,-E
# We get multiple shared libraries (libstdc++, libgcc_s) from the gcc installation:
ifneq ($(GCC_DIR),/usr)
COMMON_LDFLAGS += -Wl,-rpath $(GCC_DIR)/lib64
endif
ifneq ($(USE_DEBUG_LIBUNWIND),0)
COMMON_LDFLAGS += -L$(DEPS_DIR)/libunwind-trunk-debug-install/lib
......
......@@ -50,7 +50,7 @@
#include <curses.h>
#ifdef HAVE_TERM_H
/* for tigetstr, which is not declared in SysV curses */
#include <term.h>
// #include <term.h>
#endif
#endif
......
......@@ -246,6 +246,7 @@ class UnixCCompiler(CCompiler):
shared_f = self.library_filename(lib, lib_type='shared')
dylib_f = self.library_filename(lib, lib_type='dylib')
static_f = self.library_filename(lib, lib_type='static')
non_pyston_shared_f = '.'.join(shared_f.split('.')[:-2] + ['so'])
if sys.platform == 'darwin':
# On OSX users can specify an alternate SDK using
......@@ -262,6 +263,7 @@ class UnixCCompiler(CCompiler):
for dir in dirs:
shared = os.path.join(dir, shared_f)
non_pyston_shared = os.path.join(dir, non_pyston_shared_f)
dylib = os.path.join(dir, dylib_f)
static = os.path.join(dir, static_f)
......@@ -281,6 +283,8 @@ class UnixCCompiler(CCompiler):
return dylib
elif os.path.exists(shared):
return shared
elif os.path.exists(non_pyston_shared):
return non_pyston_shared
elif os.path.exists(static):
return static
......
# expected: fail
import array
import unittest
from test.test_support import run_unittest, import_module, get_attribute
......
# expected: fail
import unittest
from test import test_support
from test.test_urllib2 import sanepathname2url
......
......@@ -743,6 +743,8 @@ class PyBuildExt(build_ext):
missing.extend(['imageop'])
# readline
lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
do_readline = self.compiler.find_library_file(lib_dirs, 'readline')
readline_termcap_library = ""
curses_library = ""
......@@ -1402,17 +1404,19 @@ class PyBuildExt(build_ext):
# provided by the ncurses library.
panel_library = 'panel'
curses_incs = None
inc_dirs += os.getenv('CPATH', '').split(os.pathsep)
if curses_library.startswith('ncurses'):
if curses_library == 'ncursesw':
# Bug 1464056: If _curses.so links with ncursesw,
# _curses_panel.so must link with panelw.
panel_library = 'panelw'
curses_libs = [curses_library]
curses_incs = find_file('curses.h', inc_dirs,
curses_incs = find_file('curses.h', [],
[os.path.join(d, 'ncursesw') for d in inc_dirs])
exts.append( Extension('_curses',
sources = map(relpath,
[ "Modules/_cursesmodule.c", ]),
exts.append( Extension('_curses', sources = map(relpath,
[ "Modules/_cursesmodule.c", ]),
include_dirs = curses_incs,
libraries = curses_libs) )
elif curses_library == 'curses' and host_platform != 'darwin':
......@@ -2075,8 +2079,7 @@ class PyBuildExt(build_ext):
srcdir = sysconfig.get_config_var('srcdir')
ffi_builddir = os.path.join(self.build_temp, 'libffi')
ffi_srcdir = os.path.abspath(os.path.join(srcdir, 'Modules',
'_ctypes', 'libffi'))
ffi_srcdir = os.path.abspath(os.path.join(srcdir, relpath("../../from_cpython/Modules/_ctypes/libffi")))
ffi_configfile = os.path.join(ffi_builddir, 'fficonfig.py')
from distutils.dep_util import newer_group
......@@ -2088,8 +2091,10 @@ class PyBuildExt(build_ext):
ffi_configfile):
from distutils.dir_util import mkpath
mkpath(ffi_builddir)
config_args = [arg for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
if (('--host=' in arg) or ('--build=' in arg))]
# Pyston change: we don't support config var yet
# config_args = [arg for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
# if (('--host=' in arg) or ('--build=' in arg))]
config_args = []
if not self.verbose:
config_args.append("-q")
......@@ -2176,11 +2181,8 @@ class PyBuildExt(build_ext):
# in /usr/include/ffi
inc_dirs.append('/usr/include/ffi')
# Pyston change: still hard code the ffi include dir
# because we don't support this variable configuration in get_config_var yet
ffi_inc = ['/usr/include/x86_64-linux-gnu']
# ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
if not ffi_inc or ffi_inc[0] == '':
ffi_inc = [sysconfig.get_config_var("LIBFFI_INCLUDEDIR")]
if not ffi_inc[0] or ffi_inc[0] == '':
ffi_inc = find_file('ffi.h', [], inc_dirs)
if ffi_inc is not None:
ffi_h = ffi_inc[0] + '/ffi.h'
......
# skip-if: True
import subprocess, sys, os, shutil, StringIO
sys.path.append(os.path.dirname(__file__) + "/../lib")
import test_helper
......
# skip-if: True
import os
import sys
import subprocess
......
# skip-if: True
import os, sys, subprocess, shutil
sys.path.append(os.path.dirname(__file__) + "/../lib")
......
# skip-if: True
import os
import sys
import subprocess
......
# skip-if: True
import gc
import os
import sys
......
# expected: fail
import os
import sys
import subprocess
......
# expected: fail
# this tests are from cpythons test_compile.py
import unittest
from test import test_support
......
......@@ -20,11 +20,8 @@ def test(s, expected_code=0):
print
r = os.read(fd, 10240)
lines = r.split('\n')
while not (lines[0].startswith('Python') or lines[0].startswith('Pyston')):
while not (lines[0].startswith('>>>') or lines[0].startswith('>>')):
lines.pop(0)
if lines[0].startswith('Python'):
lines.pop(0)
lines.pop(0)
# Filter out syntax error location lines and make carets consistent:
lines = [l.replace('>>> ', '>> ') for l in lines if l.strip() != '^']
......
# expected: fail
# This is a copy of cpythons test with the recursive repr test disabled
# remove this test when we can pass cpythons test
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment