Commit 75d73197 authored by Kevin Modzelewski's avatar Kevin Modzelewski Committed by GitHub

Merge pull request #1341 from kmod/directories

Undo all the places we changed installed paths
parents 0814d218 d3336158
...@@ -288,7 +288,7 @@ add_definitions(${LLVM_DEFINITIONS}) ...@@ -288,7 +288,7 @@ add_definitions(${LLVM_DEFINITIONS})
add_definitions(-DDEFAULT_PYTHON_MAJOR_VERSION=2 -DDEFAULT_PYTHON_MINOR_VERSION=7 -DDEFAULT_PYTHON_MICRO_VERSION=6) # Python 2.7.6 add_definitions(-DDEFAULT_PYTHON_MAJOR_VERSION=2 -DDEFAULT_PYTHON_MINOR_VERSION=7 -DDEFAULT_PYTHON_MICRO_VERSION=6) # Python 2.7.6
add_definitions(-DLLVMREV=${LLVMREV}) add_definitions(-DLLVMREV=${LLVMREV})
include_directories(${CMAKE_BINARY_DIR}/from_cpython/Include) include_directories(${CMAKE_BINARY_DIR}/include/python2.7)
include_directories(${LLVM_INCLUDE_DIRS}) include_directories(${LLVM_INCLUDE_DIRS})
find_package(LibLZMA REQUIRED) find_package(LibLZMA REQUIRED)
...@@ -299,7 +299,6 @@ ADD_PROFILE_FLAGS() ...@@ -299,7 +299,6 @@ ADD_PROFILE_FLAGS()
include(sysconfigdata) include(sysconfigdata)
add_subdirectory(lib_pyston)
add_subdirectory(from_cpython) add_subdirectory(from_cpython)
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(test/test_extension) add_subdirectory(test/test_extension)
...@@ -351,7 +350,7 @@ add_custom_target(check-format ${CMAKE_SOURCE_DIR}/tools/check_format.sh ${LLVM_ ...@@ -351,7 +350,7 @@ add_custom_target(check-format ${CMAKE_SOURCE_DIR}/tools/check_format.sh ${LLVM_
add_custom_target(lint ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/lint.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src) add_custom_target(lint ${PYTHON_EXE} ${CMAKE_SOURCE_DIR}/tools/lint.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src)
# check # check
add_custom_target(check-deps DEPENDS pyston copy_stdlib copy_libpyston clang-format ext_cpython ext_pyston unittests sharedmods) add_custom_target(check-deps DEPENDS pyston copy_stdlib clang-format ext_cpython ext_pyston unittests sharedmods)
add_custom_target(check-pyston COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure DEPENDS check-deps) add_custom_target(check-pyston COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure DEPENDS check-deps)
# {run,dbg,perf,memcheck,memleaks,cachegrind}_TESTNAME # {run,dbg,perf,memcheck,memleaks,cachegrind}_TESTNAME
......
...@@ -654,10 +654,10 @@ CMAKE_SHAREDMODS := sharedmods ext_pyston ...@@ -654,10 +654,10 @@ CMAKE_SHAREDMODS := sharedmods ext_pyston
.PHONY: pyston_dbg pyston_release .PHONY: pyston_dbg pyston_release
pyston_dbg: $(CMAKE_SETUP_DBG) pyston_dbg: $(CMAKE_SETUP_DBG)
$(NINJA) -C $(CMAKE_DIR_DBG) pyston copy_stdlib copy_libpyston $(CMAKE_SHAREDMODS) $(NINJAFLAGS) $(NINJA) -C $(CMAKE_DIR_DBG) pyston copy_stdlib $(CMAKE_SHAREDMODS) $(NINJAFLAGS)
ln -sf $(CMAKE_DIR_DBG)/pyston $@ ln -sf $(CMAKE_DIR_DBG)/pyston $@
pyston_release: $(CMAKE_SETUP_RELEASE) pyston_release: $(CMAKE_SETUP_RELEASE)
$(NINJA) -C $(CMAKE_DIR_RELEASE) pyston copy_stdlib copy_libpyston $(CMAKE_SHAREDMODS) $(NINJAFLAGS) $(NINJA) -C $(CMAKE_DIR_RELEASE) pyston copy_stdlib $(CMAKE_SHAREDMODS) $(NINJAFLAGS)
ln -sf $(CMAKE_DIR_RELEASE)/pyston $@ ln -sf $(CMAKE_DIR_RELEASE)/pyston $@
CMAKE_SETUP_GCC := $(CMAKE_DIR_GCC)/build.ninja CMAKE_SETUP_GCC := $(CMAKE_DIR_GCC)/build.ninja
...@@ -667,7 +667,7 @@ $(CMAKE_SETUP_GCC): ...@@ -667,7 +667,7 @@ $(CMAKE_SETUP_GCC):
cd $(CMAKE_DIR_GCC); CC='$(GCC)' CXX='$(GPP)' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug cd $(CMAKE_DIR_GCC); CC='$(GCC)' CXX='$(GPP)' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug
.PHONY: pyston_gcc .PHONY: pyston_gcc
pyston_gcc: $(CMAKE_SETUP_GCC) pyston_gcc: $(CMAKE_SETUP_GCC)
$(NINJA) -C $(CMAKE_DIR_GCC) pyston copy_stdlib copy_libpyston $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS) $(NINJA) -C $(CMAKE_DIR_GCC) pyston copy_stdlib $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS)
ln -sf $(CMAKE_DIR_GCC)/pyston $@ ln -sf $(CMAKE_DIR_GCC)/pyston $@
CMAKE_SETUP_RELEASE_GCC := $(CMAKE_DIR_RELEASE_GCC)/build.ninja CMAKE_SETUP_RELEASE_GCC := $(CMAKE_DIR_RELEASE_GCC)/build.ninja
...@@ -677,7 +677,7 @@ $(CMAKE_SETUP_RELEASE_GCC): ...@@ -677,7 +677,7 @@ $(CMAKE_SETUP_RELEASE_GCC):
cd $(CMAKE_DIR_RELEASE_GCC); CC='$(GCC)' CXX='$(GPP)' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Release cd $(CMAKE_DIR_RELEASE_GCC); CC='$(GCC)' CXX='$(GPP)' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Release
.PHONY: pyston_release_gcc .PHONY: pyston_release_gcc
pyston_release_gcc: $(CMAKE_SETUP_RELEASE_GCC) pyston_release_gcc: $(CMAKE_SETUP_RELEASE_GCC)
$(NINJA) -C $(CMAKE_DIR_RELEASE_GCC) pyston copy_stdlib copy_libpyston $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS) $(NINJA) -C $(CMAKE_DIR_RELEASE_GCC) pyston copy_stdlib $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS)
ln -sf $(CMAKE_DIR_RELEASE_GCC)/pyston $@ ln -sf $(CMAKE_DIR_RELEASE_GCC)/pyston $@
...@@ -689,7 +689,7 @@ $(CMAKE_SETUP_RELEASE_GCC_PGO): ...@@ -689,7 +689,7 @@ $(CMAKE_SETUP_RELEASE_GCC_PGO):
cd $(CMAKE_DIR_RELEASE_GCC_PGO); CC='$(GCC)' CXX='$(GPP)' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Release -DENABLE_PGO=ON -DPROFILE_STATE=use cd $(CMAKE_DIR_RELEASE_GCC_PGO); CC='$(GCC)' CXX='$(GPP)' cmake $(COMMON_CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Release -DENABLE_PGO=ON -DPROFILE_STATE=use
.PHONY: pyston_release_gcc_pgo .PHONY: pyston_release_gcc_pgo
pyston_release_gcc_pgo: $(CMAKE_SETUP_RELEASE_GCC_PGO) $(CMAKE_DIR_RELEASE_GCC_PGO)/.trained pyston_release_gcc_pgo: $(CMAKE_SETUP_RELEASE_GCC_PGO) $(CMAKE_DIR_RELEASE_GCC_PGO)/.trained
$(NINJA) -C $(CMAKE_DIR_RELEASE_GCC_PGO) pyston copy_stdlib copy_libpyston $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS) $(NINJA) -C $(CMAKE_DIR_RELEASE_GCC_PGO) pyston copy_stdlib $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS)
ln -sf $(CMAKE_DIR_RELEASE_GCC_PGO)/pyston $@ ln -sf $(CMAKE_DIR_RELEASE_GCC_PGO)/pyston $@
CMAKE_SETUP_RELEASE_GCC_PGO_INSTRUMENTED := $(CMAKE_DIR_RELEASE_GCC_PGO_INSTRUMENTED)/build.ninja CMAKE_SETUP_RELEASE_GCC_PGO_INSTRUMENTED := $(CMAKE_DIR_RELEASE_GCC_PGO_INSTRUMENTED)/build.ninja
...@@ -700,7 +700,7 @@ $(CMAKE_SETUP_RELEASE_GCC_PGO_INSTRUMENTED): ...@@ -700,7 +700,7 @@ $(CMAKE_SETUP_RELEASE_GCC_PGO_INSTRUMENTED):
.PHONY: pyston_release_gcc_pgo_instrumented .PHONY: pyston_release_gcc_pgo_instrumented
pyston_release_gcc_pgo_instrumented: $(CMAKE_SETUP_RELEASE_GCC_PGO_INSTRUMENTED) pyston_release_gcc_pgo_instrumented: $(CMAKE_SETUP_RELEASE_GCC_PGO_INSTRUMENTED)
$(NINJA) -C $(CMAKE_DIR_RELEASE_GCC_PGO_INSTRUMENTED) pyston copy_stdlib copy_libpyston $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS) $(NINJA) -C $(CMAKE_DIR_RELEASE_GCC_PGO_INSTRUMENTED) pyston copy_stdlib $(CMAKE_SHAREDMODS) ext_cpython $(NINJAFLAGS)
ln -sf $(CMAKE_DIR_RELEASE_GCC_PGO_INSTRUMENTED)/pyston $@ ln -sf $(CMAKE_DIR_RELEASE_GCC_PGO_INSTRUMENTED)/pyston $@
PROFILE_TARGET := ./pyston $(SRC_DIR)/minibenchmarks/combined.py PROFILE_TARGET := ./pyston $(SRC_DIR)/minibenchmarks/combined.py
......
...@@ -63,9 +63,9 @@ set(CMAKE_REQUIRED_LIBRARIES util) ...@@ -63,9 +63,9 @@ set(CMAKE_REQUIRED_LIBRARIES util)
check_symbol_exists(openpty "pty.h" HAVE_OPENPTY) check_symbol_exists(openpty "pty.h" HAVE_OPENPTY)
configure_file(from_cpython/Include/pyconfig.h.in from_cpython/Include/pyconfig.h) configure_file(from_cpython/Include/pyconfig.h.in include/python2.7/pyconfig.h)
# CMake sucks: it has no idea that pyconfig.h is something that can be installed. # CMake sucks: it has no idea that pyconfig.h is something that can be installed.
# Just tell it to install whatever file is at that particular location, and rely on # Just tell it to install whatever file is at that particular location, and rely on
# the rest of the build rules to ensure that it's made in time. # the rest of the build rules to ensure that it's made in time.
install(FILES ${CMAKE_BINARY_DIR}/from_cpython/Include/pyconfig.h DESTINATION from_cpython/Include) install(FILES ${CMAKE_BINARY_DIR}/from_cpython/Include/pyconfig.h DESTINATION include/python2.7)
...@@ -8,9 +8,9 @@ if (${ENABLE_REF_DEBUG}) ...@@ -8,9 +8,9 @@ if (${ENABLE_REF_DEBUG})
set(EXT_BUILD_FLAGS "-DPy_REF_DEBUG -DPYMALLOC_DEBUG -DPy_TRACE_REFS ${EXT_BUILD_FLAGS}") set(EXT_BUILD_FLAGS "-DPy_REF_DEBUG -DPYMALLOC_DEBUG -DPy_TRACE_REFS ${EXT_BUILD_FLAGS}")
endif() endif()
configure_file(lib_pyston/_sysconfigdata.py.in lib_pyston/_sysconfigdata.py) configure_file(cmake/_sysconfigdata.py.in lib/python2.7/_sysconfigdata.py)
# CMake sucks: it has no idea that configure-generated files can be installed. # CMake sucks: it has no idea that configure-generated files can be installed.
# Just tell it to install whatever file is at that particular location, and rely on # Just tell it to install whatever file is at that particular location, and rely on
# the rest of the build rules to ensure that it's made in time. # the rest of the build rules to ensure that it's made in time.
install(FILES ${CMAKE_BINARY_DIR}/lib_pyston/_sysconfigdata.py DESTINATION lib_pyston) install(FILES ${CMAKE_BINARY_DIR}/lib/python2.7/_sysconfigdata.py DESTINATION lib/python2.7)
# Copy any changed stdlib files to the destination: # Copy any changed stdlib files to the destination:
file(GLOB_RECURSE STDLIB_SRCS Lib/ "*.py") file(GLOB_RECURSE STDLIB_SRCS Lib/*.py)
file(GLOB_RECURSE STD_INCLUDES Include/ "*.h") file(GLOB_RECURSE STD_INCLUDES Include/*.h)
set(STDLIB_TARGETS "") set(STDLIB_TARGETS "")
foreach(STDLIB_FILE ${STDLIB_SRCS} ${STD_INCLUDES}) foreach(STDLIB_FILE ${STDLIB_SRCS})
file(RELATIVE_PATH FN_REL ${CMAKE_SOURCE_DIR} ${STDLIB_FILE}) file(RELATIVE_PATH FN_REL ${CMAKE_SOURCE_DIR}/from_cpython/Lib ${STDLIB_FILE})
set(TARGET ${CMAKE_BINARY_DIR}/${FN_REL}) set(TARGET ${CMAKE_BINARY_DIR}/lib/python2.7/${FN_REL})
add_custom_command(OUTPUT ${TARGET} COMMAND add_custom_command(OUTPUT ${TARGET} COMMAND
${CMAKE_COMMAND} -E copy_if_different ${STDLIB_FILE} ${TARGET} ${CMAKE_COMMAND} -E copy_if_different ${STDLIB_FILE} ${TARGET}
DEPENDS ${STDLIB_FILE} DEPENDS ${STDLIB_FILE}
COMMENT "Copying ${FN_REL}" COMMENT "Copying Python stdlib ${FN_REL}"
) )
set(STDLIB_TARGETS ${STDLIB_TARGETS} ${TARGET}) set(STDLIB_TARGETS ${STDLIB_TARGETS} ${TARGET})
get_filename_component(DIR ${FN_REL} DIRECTORY) get_filename_component(DIR ${FN_REL} DIRECTORY)
install(FILES ${STDLIB_FILE} DESTINATION ${DIR}) install(FILES ${STDLIB_FILE} DESTINATION lib/python2.7/${DIR})
endforeach(STDLIB_FILE)
foreach(STDLIB_FILE ${STD_INCLUDES})
file(RELATIVE_PATH FN_REL ${CMAKE_SOURCE_DIR}/from_cpython/Include ${STDLIB_FILE})
set(TARGET ${CMAKE_BINARY_DIR}/include/python2.7/${FN_REL})
add_custom_command(OUTPUT ${TARGET} COMMAND
${CMAKE_COMMAND} -E copy_if_different ${STDLIB_FILE} ${TARGET}
DEPENDS ${STDLIB_FILE}
COMMENT "Copying Python header ${FN_REL}"
)
set(STDLIB_TARGETS ${STDLIB_TARGETS} ${TARGET})
get_filename_component(DIR ${FN_REL} DIRECTORY)
install(FILES ${STDLIB_FILE} DESTINATION include/python2.7/${DIR})
endforeach(STDLIB_FILE) endforeach(STDLIB_FILE)
add_custom_target(copy_stdlib ALL DEPENDS ${STDLIB_TARGETS}) add_custom_target(copy_stdlib ALL DEPENDS ${STDLIB_TARGETS})
...@@ -128,7 +142,7 @@ file(GLOB_RECURSE STDPYTHON_SRCS Python ...@@ -128,7 +142,7 @@ file(GLOB_RECURSE STDPYTHON_SRCS Python
_warnings.c _warnings.c
) )
# compile specified files in from_cpython/Python # compile specified files in from_cpython/Parser
file(GLOB_RECURSE STDPARSER_SRCS Parser file(GLOB_RECURSE STDPARSER_SRCS Parser
acceler.c acceler.c
grammar1.c grammar1.c
...@@ -144,29 +158,28 @@ add_library(FROM_CPYTHON OBJECT ${STDMODULE_SRCS} ${STDOBJECT_SRCS} ${STDPYTHON_ ...@@ -144,29 +158,28 @@ add_library(FROM_CPYTHON OBJECT ${STDMODULE_SRCS} ${STDOBJECT_SRCS} ${STDPYTHON_
add_dependencies(FROM_CPYTHON copy_stdlib) add_dependencies(FROM_CPYTHON copy_stdlib)
set(STDMODULES set(STDMODULES
${CMAKE_BINARY_DIR}/from_cpython/Lib/bz2.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/bz2.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/cmath.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/cmath.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/cPickle.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/cPickle.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/_ctypes.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/_ctypes.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/_curses.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/_curses.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/_elementtree.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/_elementtree.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/future_builtins.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/future_builtins.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/grp.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/grp.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/_locale.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/_locale.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/mmap.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/mmap.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/_multiprocessing.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/_multiprocessing.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/parser.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/parser.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/pyexpat.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/pyexpat.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/readline.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/readline.pyston.so
${CMAKE_BINARY_DIR}/from_cpython/Lib/termios.pyston.so ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/termios.pyston.so
) )
add_custom_command(OUTPUT ${STDMODULES} add_custom_command(OUTPUT ${STDMODULES}
COMMAND ${CMAKE_BINARY_DIR}/pyston setup.py build --build-lib ${CMAKE_BINARY_DIR}/from_cpython/Lib COMMAND ${CMAKE_BINARY_DIR}/pyston setup.py build --build-lib ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload
DEPENDS DEPENDS
pyston pyston
copy_stdlib copy_stdlib
copy_libpyston
Modules/_multiprocessing/multiprocessing.c Modules/_multiprocessing/multiprocessing.c
Modules/_multiprocessing/semaphore.c Modules/_multiprocessing/semaphore.c
Modules/_multiprocessing/socket_connection.c Modules/_multiprocessing/socket_connection.c
...@@ -193,6 +206,6 @@ add_custom_command(OUTPUT ${STDMODULES} ...@@ -193,6 +206,6 @@ add_custom_command(OUTPUT ${STDMODULES}
Modules/cPickle.c Modules/cPickle.c
Modules/parsermodule.c Modules/parsermodule.c
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_target(sharedmods ALL DEPENDS ${CMAKE_BINARY_DIR}/from_cpython/Lib/_multiprocessing.pyston.so) add_custom_target(sharedmods ALL DEPENDS ${CMAKE_BINARY_DIR}/lib/python2.7/lib-dynload/_multiprocessing.pyston.so)
install(FILES ${STDMODULES} DESTINATION from_cpython/Lib) install(FILES ${STDMODULES} DESTINATION lib/python2.7/lib-dynload)
...@@ -41,11 +41,8 @@ else: ...@@ -41,11 +41,8 @@ else:
INSTALL_SCHEMES = { INSTALL_SCHEMES = {
'unix_prefix': { 'unix_prefix': {
# Pyston change 'purelib': '$base/lib/python$py_version_short/site-packages',
# 'purelib': '$base/lib/python$py_version_short/site-packages', 'platlib': '$platbase/lib/python$py_version_short/site-packages',
# 'platlib': '$platbase/lib/python$py_version_short/site-packages',
'purelib': '$base/site-packages',
'platlib': '$base/site-packages',
'headers': '$base/include/python$py_version_short/$dist_name', 'headers': '$base/include/python$py_version_short/$dist_name',
'scripts': '$base/bin', 'scripts': '$base/bin',
'data' : '$base', 'data' : '$base',
......
# This file is originally from CPython 2.7, with modifications for Pyston
# We should probably create a pyston-specific version instead of modifying the
# CPython one.
"""Provide access to Python's configuration information. The specific """Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using configuration. The values may be retrieved using
...@@ -68,9 +64,6 @@ def get_python_version(): ...@@ -68,9 +64,6 @@ def get_python_version():
def get_python_inc(plat_specific=0, prefix=None): def get_python_inc(plat_specific=0, prefix=None):
# Pyston change: this is the way we layout things internally:
return os.path.join(sys.prefix, "from_cpython/Include")
"""Return the directory containing installed Python header files. """Return the directory containing installed Python header files.
If 'plat_specific' is false (the default), this is the path to the If 'plat_specific' is false (the default), this is the path to the
...@@ -126,17 +119,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): ...@@ -126,17 +119,12 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
prefix = plat_specific and EXEC_PREFIX or PREFIX prefix = plat_specific and EXEC_PREFIX or PREFIX
if os.name == "posix": if os.name == "posix":
# Pyston change
# libpython = os.path.join(prefix,
# "lib", "python" + get_python_version())
libpython = os.path.join(prefix, libpython = os.path.join(prefix,
"from_cpython", "Lib") "lib", "python" + get_python_version())
if standard_lib: if standard_lib:
return libpython return libpython
else: else:
# Pyston change return os.path.join(libpython, "site-packages")
# return os.path.join(libpython, "site-packages")
return os.path.join(prefix, "site-packages")
elif os.name == "nt": elif os.name == "nt":
if standard_lib: if standard_lib:
......
...@@ -7,19 +7,12 @@ from os.path import pardir, realpath ...@@ -7,19 +7,12 @@ from os.path import pardir, realpath
_INSTALL_SCHEMES = { _INSTALL_SCHEMES = {
'posix_prefix': { 'posix_prefix': {
# Pyston changes: changed paths 'stdlib': '{base}/lib/python{py_version_short}',
# 'stdlib': '{base}/lib/python{py_version_short}', 'platstdlib': '{platbase}/lib/python{py_version_short}',
# 'platstdlib': '{platbase}/lib/python{py_version_short}', 'purelib': '{base}/lib/python{py_version_short}/site-packages',
# 'purelib': '{base}/lib/python{py_version_short}/site-packages', 'platlib': '{platbase}/lib/python{py_version_short}/site-packages',
# 'platlib': '{platbase}/lib/python{py_version_short}/site-packages', 'include': '{base}/include/python{py_version_short}',
# 'include': '{base}/include/python{py_version_short}', 'platinclude': '{platbase}/include/python{py_version_short}',
# 'platinclude': '{platbase}/include/python{py_version_short}',
'stdlib': '{base}/from_cpython/Lib',
'platstdlib': '{platbase}/from_cpython/Lib',
'purelib': '{base}/site-packages',
'platlib': '{platbase}/site-packages',
'include': '{base}/from_cpython/Include',
'platinclude': '{platbase}/from_cpython/Include',
'scripts': '{base}/bin', 'scripts': '{base}/bin',
'data': '{base}', 'data': '{base}',
}, },
......
...@@ -91,6 +91,14 @@ ...@@ -91,6 +91,14 @@
* process to find the installed Python tree. * process to find the installed Python tree.
*/ */
// Pyston change:
// In CPython, these are passed via commandline flags:
#define VERSION "2.7"
#define PREFIX ""
#define EXEC_PREFIX ""
#define VPATH ""
#define PYTHONPATH ":lib-dynload"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -117,9 +125,8 @@ ...@@ -117,9 +125,8 @@
#endif #endif
#ifndef PYTHONPATH #ifndef PYTHONPATH
// Pyston change #define PYTHONPATH PREFIX "/lib/python" VERSION ":" \
#define PYTHONPATH PREFIX "/from_cpython/Lib:" \ EXEC_PREFIX "/lib/python" VERSION "/lib-dynload"
EXEC_PREFIX "/from_cpython/Lib/lib-dynload"
#endif #endif
#ifndef LANDMARK #ifndef LANDMARK
...@@ -130,7 +137,7 @@ static char prefix[MAXPATHLEN+1]; ...@@ -130,7 +137,7 @@ static char prefix[MAXPATHLEN+1];
static char exec_prefix[MAXPATHLEN+1]; static char exec_prefix[MAXPATHLEN+1];
static char progpath[MAXPATHLEN+1]; static char progpath[MAXPATHLEN+1];
static char *module_search_path = NULL; static char *module_search_path = NULL;
static char lib_python[] = "from_cpython/Lib"; // Pyston change static char lib_python[] = "lib/python" VERSION;
static void static void
reduce(char *dir) reduce(char *dir)
...@@ -397,7 +404,6 @@ calculate_path(void) ...@@ -397,7 +404,6 @@ calculate_path(void)
const char *prog = Py_GetProgramName(); const char *prog = Py_GetProgramName();
char argv0_path[MAXPATHLEN+1]; char argv0_path[MAXPATHLEN+1];
char zip_path[MAXPATHLEN+1]; char zip_path[MAXPATHLEN+1];
char lib_pyston_path[MAXPATHLEN+1]; // Pyston change
int pfound, efound; /* 1 if found; -1 if found build directory */ int pfound, efound; /* 1 if found; -1 if found build directory */
char *buf; char *buf;
size_t bufsz; size_t bufsz;
...@@ -591,16 +597,6 @@ calculate_path(void) ...@@ -591,16 +597,6 @@ calculate_path(void)
bufsz += strlen(zip_path) + 1; bufsz += strlen(zip_path) + 1;
bufsz += strlen(exec_prefix) + 1; bufsz += strlen(exec_prefix) + 1;
// Pyston change: add from_cpython/Lib and lib_pyston
// Prefix contains at this point the full path to 'from_cpython/Lib'
strcpy(lib_pyston_path, prefix);
// go from ./from_cpython/Lib to ./lib_pyston
reduce(lib_pyston_path);
reduce(lib_pyston_path);
joinpath(lib_pyston_path, "lib_pyston");
bufsz += strlen(lib_pyston_path) + 1;
bufsz += strlen(prefix) + 1;
/* This is the only malloc call in this file */ /* This is the only malloc call in this file */
buf = (char *)PyMem_Malloc(bufsz); buf = (char *)PyMem_Malloc(bufsz);
...@@ -621,17 +617,7 @@ calculate_path(void) ...@@ -621,17 +617,7 @@ calculate_path(void)
/* Next is the default zip path */ /* Next is the default zip path */
strcat(buf, zip_path); strcat(buf, zip_path);
// Pyston change
// add from_cpython/Lib
strcat(buf, delimiter); strcat(buf, delimiter);
strcat(buf, prefix);
// add lib_pyston
strcat(buf, delimiter);
strcat(buf, lib_pyston_path);
strcat(buf, delimiter);
/* Next goes merge of compile-time $PYTHONPATH with /* Next goes merge of compile-time $PYTHONPATH with
* dynamically located prefix. * dynamically located prefix.
......
# Copy any changed lib_pyston sources:
file(GLOB_RECURSE LIBPYSTON_SRCS . "*.py")
set(LIBPYSTON_TARGETS "")
foreach(STDLIB_FILE ${LIBPYSTON_SRCS})
file(RELATIVE_PATH FN_REL ${CMAKE_SOURCE_DIR} ${STDLIB_FILE})
set(TARGET ${CMAKE_BINARY_DIR}/${FN_REL})
add_custom_command(OUTPUT ${TARGET} COMMAND
${CMAKE_COMMAND} -E copy_if_different ${STDLIB_FILE} ${TARGET}
DEPENDS ${STDLIB_FILE}
COMMENT "Copying ${FN_REL}"
)
set(LIBPYSTON_TARGETS ${LIBPYSTON_TARGETS} ${TARGET})
endforeach(STDLIB_FILE)
add_custom_target(copy_libpyston ALL DEPENDS ${LIBPYSTON_TARGETS})
install(FILES ${LIBPYSTON_SRCS} DESTINATION lib_pyston)
# Very simple stub for the marshal module.
# - pickle imports marshal
def loads(*args, **kw):
raise NotImplementedError()
...@@ -16,7 +16,7 @@ subprocess.check_call(["wget", url], cwd=ENV_NAME) ...@@ -16,7 +16,7 @@ subprocess.check_call(["wget", url], cwd=ENV_NAME)
subprocess.check_call(["tar", "-zxf", "avro-1.7.7.tar.gz"], cwd=ENV_NAME) subprocess.check_call(["tar", "-zxf", "avro-1.7.7.tar.gz"], cwd=ENV_NAME)
env = os.environ env = os.environ
env["PYTHONPATH"] = os.path.abspath(os.path.join(ENV_NAME, "site-packages")) env["PYTHONPATH"] = os.path.abspath(os.path.join(ENV_NAME, "lib/python2.7/site-packages"))
# this tests also fail when run in cpython with nose. # this tests also fail when run in cpython with nose.
# pytest makes two of this work but we can't currently run pytest... # pytest makes two of this work but we can't currently run pytest...
......
...@@ -17,7 +17,7 @@ create_virtenv(ENV_NAME, ...@@ -17,7 +17,7 @@ create_virtenv(ENV_NAME,
"markupsafe == 0.23"] "markupsafe == 0.23"]
, force_create = True) , force_create = True)
sys.path.append(ENV_NAME + "/site-packages") sys.path.append(ENV_NAME + "/lib/python2.7/site-packages")
from flask import Flask, Markup from flask import Flask, Markup
from jinja2 import Template from jinja2 import Template
......
...@@ -5,7 +5,7 @@ from test_helper import create_virtenv, run_test ...@@ -5,7 +5,7 @@ from test_helper import create_virtenv, run_test
ENV_NAME = os.path.abspath("pyopenssl_test_env_" + os.path.basename(sys.executable)) ENV_NAME = os.path.abspath("pyopenssl_test_env_" + os.path.basename(sys.executable))
NOSETESTS_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "nosetests")) NOSETESTS_EXE = os.path.abspath(os.path.join(ENV_NAME, "bin", "nosetests"))
PYOPENSSL_DIR = os.path.abspath(os.path.join(ENV_NAME, "site-packages", "OpenSSL")) PYOPENSSL_DIR = os.path.abspath(os.path.join(ENV_NAME, "lib", "python2.7", "site-packages", "OpenSSL"))
packages = ["nose==1.3.7", "pycparser==2.13", "cryptography==1.0.1", "pyopenssl==0.15.1", "pyasn1==0.1.7", "idna==2.0", "six==1.9.0", "enum34==1.0.4", "ipaddress==1.0.14", "cffi==1.1.0"] packages = ["nose==1.3.7", "pycparser==2.13", "cryptography==1.0.1", "pyopenssl==0.15.1", "pyasn1==0.1.7", "idna==2.0", "six==1.9.0", "enum34==1.0.4", "ipaddress==1.0.14", "cffi==1.1.0"]
create_virtenv(ENV_NAME, packages, force_create = True) create_virtenv(ENV_NAME, packages, force_create = True)
......
...@@ -34,7 +34,6 @@ python_exe = os.path.abspath(ENV_NAME + "/bin/python") ...@@ -34,7 +34,6 @@ python_exe = os.path.abspath(ENV_NAME + "/bin/python")
sys.path.append(SQLALCHEMY_DIR + "/lib") sys.path.append(SQLALCHEMY_DIR + "/lib")
sys.path.insert(0, SQLALCHEMY_DIR) sys.path.insert(0, SQLALCHEMY_DIR)
sys.path.append(ENV_NAME + "/site-packages")
sys.path.append(ENV_NAME + "/lib/python2.7/site-packages") sys.path.append(ENV_NAME + "/lib/python2.7/site-packages")
os.chdir(SQLALCHEMY_DIR) os.chdir(SQLALCHEMY_DIR)
......
...@@ -33,7 +33,7 @@ print "-- Installing pycrypto" ...@@ -33,7 +33,7 @@ print "-- Installing pycrypto"
subprocess.check_call([sys.executable, "setup.py", "install", "--prefix=install"], stdout=devnull) subprocess.check_call([sys.executable, "setup.py", "install", "--prefix=install"], stdout=devnull)
print "-- Testing pycrypto" print "-- Testing pycrypto"
sys.path.append("install/site-packages") sys.path.append("install/lib/python2.7/site-packages")
test_string = "test string".ljust(16) test_string = "test string".ljust(16)
......
...@@ -33,7 +33,6 @@ python_exe = os.path.abspath(ENV_NAME + "/bin/python") ...@@ -33,7 +33,6 @@ python_exe = os.path.abspath(ENV_NAME + "/bin/python")
sys.path.append(SQLALCHEMY_DIR + "/lib") sys.path.append(SQLALCHEMY_DIR + "/lib")
sys.path.insert(0, SQLALCHEMY_DIR) sys.path.insert(0, SQLALCHEMY_DIR)
sys.path.append(ENV_NAME + "/site-packages")
sys.path.append(ENV_NAME + "/lib/python2.7/site-packages") sys.path.append(ENV_NAME + "/lib/python2.7/site-packages")
os.chdir(SQLALCHEMY_DIR) os.chdir(SQLALCHEMY_DIR)
......
Subproject commit c48a89b5c43cbb19d87c6f8467fdfa7fbc3438a9 Subproject commit db70fc5084483b636b4bbf05519f4d69a2c741fa
...@@ -5,7 +5,7 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/build/lib.linux-x86_64-2.7 ...@@ -5,7 +5,7 @@ add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/build/lib.linux-x86_64-2.7
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/basic_test.pyston.so add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/basic_test.pyston.so
COMMAND ${CMAKE_BINARY_DIR}/pyston setup.py build --build-lib ${CMAKE_CURRENT_BINARY_DIR} COMMAND ${CMAKE_BINARY_DIR}/pyston setup.py build --build-lib ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS pyston copy_stdlib copy_libpyston basic_test.c descr_test.c slots_test.c type_test.c api_test.c DEPENDS pyston copy_stdlib basic_test.c descr_test.c slots_test.c type_test.c api_test.c
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_target(ext_cpython DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/build/lib.linux-x86_64-2.7/basic_test.so) add_custom_target(ext_cpython DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/build/lib.linux-x86_64-2.7/basic_test.so)
......
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