Commit 2c5d6923 authored by Boxiang Sun's avatar Boxiang Sun

Temp

parent b60caa9f
...@@ -273,7 +273,7 @@ if(ENABLE_OPROFILE) ...@@ -273,7 +273,7 @@ if(ENABLE_OPROFILE)
endif() endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wreturn-type -Wno-sign-compare -Wno-unused -Wno-unused-parameter -fno-omit-frame-pointer -g") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wreturn-type -Wno-sign-compare -Wno-unused -Wno-unused-parameter -fno-omit-frame-pointer -g")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -std=c++11 -fno-rtti -fexceptions -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -Woverloaded-virtual -Wno-invalid-offsetof -Wcast-qual -Wno-sign-conversion -Wnon-virtual-dtor -Winit-self -Wmissing-include-dirs -Wstrict-overflow=5 -Wpointer-arith -Wtype-limits -Wwrite-strings -Wempty-body -Waggregate-return -Wmissing-field-initializers -Wredundant-decls -Winline -Wint-to-pointer-cast -Wlong-long -Wvla -Wno-attributes -g") set(CMAKE_CXX_FLAGS "$ENV{CPPFLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -std=c++11 -fno-rtti -fexceptions -fvisibility-inlines-hidden -ffunction-sections -fdata-sections -Woverloaded-virtual -Wno-invalid-offsetof -Wcast-qual -Wno-sign-conversion -Wnon-virtual-dtor -Winit-self -Wmissing-include-dirs -Wstrict-overflow=5 -Wpointer-arith -Wtype-limits -Wwrite-strings -Wempty-body -Waggregate-return -Wmissing-field-initializers -Wredundant-decls -Winline -Wint-to-pointer-cast -Wlong-long -Wvla -Wno-attributes -g")
set(CLANG_FLAGS "${CLANG_FLAGS} -Wimplicit-int -Wstrict-prototypes -Wold-style-definition -Wnested-externs -Wpointer-to-int-cast -Wno-mismatched-tags -Wno-extern-c-compat") set(CLANG_FLAGS "${CLANG_FLAGS} -Wimplicit-int -Wstrict-prototypes -Wold-style-definition -Wnested-externs -Wpointer-to-int-cast -Wno-mismatched-tags -Wno-extern-c-compat")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
......
...@@ -161,7 +161,7 @@ file(GLOB_RECURSE STDPARSER_SRCS Parser ...@@ -161,7 +161,7 @@ file(GLOB_RECURSE STDPARSER_SRCS Parser
tokenizer.c tokenizer.c
) )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-field-initializers -Wno-tautological-compare -Wno-type-limits -Wno-unused-result -Wno-strict-aliasing -DPy_BUILD_CORE") set(CMAKE_C_FLAGS "$ENV{CPPFLAGS} ${CMAKE_C_FLAGS} -Wno-missing-field-initializers -Wno-tautological-compare -Wno-type-limits -Wno-unused-result -Wno-strict-aliasing -DPy_BUILD_CORE")
add_library(FROM_CPYTHON OBJECT ${STDMODULE_SRCS} ${STDOBJECT_SRCS} ${STDPYTHON_SRCS} ${STDPARSER_SRCS}) add_library(FROM_CPYTHON OBJECT ${STDMODULE_SRCS} ${STDOBJECT_SRCS} ${STDPYTHON_SRCS} ${STDPARSER_SRCS})
add_dependencies(FROM_CPYTHON copy_stdlib) add_dependencies(FROM_CPYTHON copy_stdlib)
......
...@@ -433,7 +433,7 @@ typedef PyObject *(*allocfunc)(PyTypeObject *, Py_ssize_t); ...@@ -433,7 +433,7 @@ typedef PyObject *(*allocfunc)(PyTypeObject *, Py_ssize_t);
/* Type attribute cache version tag. Added in version 2.6 */\ /* Type attribute cache version tag. Added in version 2.6 */\
/* Pyston change: change uint to 64bit uint /* Pyston change: change uint to 64bit uint
unsigned int tp_version_tag; */ \ unsigned int tp_version_tag; */ \
PY_UINT64_T tp_version_tag; \ uint64_t tp_version_tag; \
\ \
/* Pyston changes: added these fields */ \ /* Pyston changes: added these fields */ \
...@@ -539,6 +539,9 @@ PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT; ...@@ -539,6 +539,9 @@ PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT; PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT; PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *) PYSTON_NOEXCEPT; PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_GetDict(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyObject_ClearDict(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(void) PyObject_SetDict(PyObject *, PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *) PYSTON_NOEXCEPT; PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *) PYSTON_NOEXCEPT; PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *) PYSTON_NOEXCEPT;
PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT; PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *) PYSTON_NOEXCEPT;
......
...@@ -2116,8 +2116,10 @@ class PyBuildExt(build_ext): ...@@ -2116,8 +2116,10 @@ class PyBuildExt(build_ext):
self.compiler.src_extensions.append('.S') self.compiler.src_extensions.append('.S')
include_dirs = [os.path.join(ffi_builddir, 'include'), include_dirs = [os.path.join(ffi_builddir, 'include'),
ffi_builddir, [],
os.path.join(ffi_srcdir, 'src')] os.path.join(ffi_srcdir, 'src')]
print("In configuration!!!!!!!!!!")
print(include_dirs)
extra_compile_args = fficonfig['ffi_cflags'].split() extra_compile_args = fficonfig['ffi_cflags'].split()
ext.sources.extend(os.path.join(ffi_srcdir, f) for f in ext.sources.extend(os.path.join(ffi_srcdir, f) for f in
...@@ -2161,6 +2163,11 @@ class PyBuildExt(build_ext): ...@@ -2161,6 +2163,11 @@ class PyBuildExt(build_ext):
elif host_platform.startswith('hp-ux'): elif host_platform.startswith('hp-ux'):
extra_link_args.append('-fPIC') extra_link_args.append('-fPIC')
print("Is everything OK?")
print("***********************************")
print(include_dirs)
print(sources)
print(depends)
ext = Extension('_ctypes', ext = Extension('_ctypes',
include_dirs=include_dirs, include_dirs=include_dirs,
extra_compile_args=extra_compile_args, extra_compile_args=extra_compile_args,
...@@ -2201,6 +2208,9 @@ class PyBuildExt(build_ext): ...@@ -2201,6 +2208,9 @@ class PyBuildExt(build_ext):
ffi_lib = lib_name ffi_lib = lib_name
break break
print("ffi in----------------------")
print(ffi_inc)
print(ffi_lib)
if ffi_inc and ffi_lib: if ffi_inc and ffi_lib:
ext.include_dirs.extend(ffi_inc) ext.include_dirs.extend(ffi_inc)
ext.libraries.append(ffi_lib) ext.libraries.append(ffi_lib)
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "capi/types.h" #include "capi/types.h"
#include "core/threading.h" #include "core/threading.h"
#include "core/types.h" #include "core/types.h"
#include "runtime/hiddenclass.h"
#include "runtime/import.h" #include "runtime/import.h"
#include "runtime/objmodel.h" #include "runtime/objmodel.h"
#include "runtime/types.h" #include "runtime/types.h"
...@@ -609,11 +610,58 @@ extern "C" PyObject** _PyObject_GetDictPtr(PyObject* obj) noexcept { ...@@ -609,11 +610,58 @@ extern "C" PyObject** _PyObject_GetDictPtr(PyObject* obj) noexcept {
} }
return (PyObject**)((char*)obj + dictoffset); return (PyObject**)((char*)obj + dictoffset);
} else { } else {
// Box* attrwrapper = tp->getAttrWrapper();
// Box* new_dict = unwrapAttrWrapper(attrwrapper);
// return (PyObject**)(&new_dict);
// return (PyObject**)&unwrapAttrWrapper(attrwrapper);
// auto new_dict = PyDict_New();
// PyDict_Update(new_dict, attrwrapper);
// return (PyObject**)&new_dict;
// HCAttrs* hcattrs = obj->getHCAttrsPtr();
// HiddenClass* hcls = hcattrs->hcls;
// int offset = hcls->getAsSingletonOrNormal()->getAttrwrapperOffset();
// if (offset != -1) {
// AttrWrapper* wrapper = (AttrWrapper*)(hcattrs->attr_list->attrs[offset]);
// BoxedDict*
// BoxedDict* dict = (BoxedDict*)AttrWrapper::copy(obj);
// convertAttrwrapperToPrivateDict(wrapper);
// return &wrapper;
// return wrapper->getUnderlying();
// }
fatalOrError(PyExc_NotImplementedError, "unimplemented for hcattrs"); fatalOrError(PyExc_NotImplementedError, "unimplemented for hcattrs");
return nullptr; return nullptr;
} }
} }
extern "C" PyObject* PyObject_GetDict(PyObject* obj) noexcept {
PyTypeObject* tp = Py_TYPE(obj);
if (!tp->instancesHaveHCAttrs()) {
return obj->getDict();
} else {
Box* attrwrapper = obj->getAttrWrapper();
convertAttrwrapperToPrivateDict(attrwrapper);
return unwrapAttrWrapper(attrwrapper);
}
}
extern "C" void PyObject_ClearDict(PyObject* obj) noexcept {
obj->clearAttrsForDealloc();
}
extern "C" void PyObject_SetDict(PyObject* obj, PyObject* dict) noexcept {
PyObject *d_key, *d_value;
Py_ssize_t i = 0;
while (PyDict_Next(dict, &i, &d_key, &d_value)) {
if (PyString_CheckExact(d_key)) {
Py_INCREF(d_key);
PyString_InternInPlace(&d_key);
Py_DECREF(d_key);
}
if (PyObject_SetAttr(obj, d_key, d_value) < 0)
return;
}
}
/* These methods are used to control infinite recursion in repr, str, print, /* These methods are used to control infinite recursion in repr, str, print,
etc. Container objects that may recursively contain themselves, etc. Container objects that may recursively contain themselves,
e.g. builtin dictionaries and lists, should used Py_ReprEnter() and e.g. builtin dictionaries and lists, should used Py_ReprEnter() and
...@@ -1148,7 +1196,7 @@ extern "C" void _Py_NegativeRefcount(const char* fname, int lineno, PyObject* op ...@@ -1148,7 +1196,7 @@ extern "C" void _Py_NegativeRefcount(const char* fname, int lineno, PyObject* op
PyOS_snprintf(buf, sizeof(buf), "%s:%i object at %p has negative ref count " PyOS_snprintf(buf, sizeof(buf), "%s:%i object at %p has negative ref count "
"%" PY_FORMAT_SIZE_T "d. \033[40mwatch -l *(long*)%p\033[0m", "%" PY_FORMAT_SIZE_T "d. \033[40mwatch -l *(long*)%p\033[0m",
fname, lineno, op, op->ob_refcnt, &op->ob_refcnt); fname, lineno, op, op->ob_refcnt, &op->ob_refcnt);
Py_FatalError(buf); // Py_FatalError(buf);
} }
#endif /* Py_REF_DEBUG */ #endif /* Py_REF_DEBUG */
......
...@@ -50,6 +50,8 @@ int _Py_QnewFlag = 0; ...@@ -50,6 +50,8 @@ int _Py_QnewFlag = 0;
// this flag is one of the few levers we have to avoid hitting those paths. // this flag is one of the few levers we have to avoid hitting those paths.
int Py_DontWriteBytecodeFlag = 1; int Py_DontWriteBytecodeFlag = 1;
int Py_NoUserSiteDirectory = 0; int Py_NoUserSiteDirectory = 0;
int _Py_Ticker = 0;
int _Py_CheckInterval = 100;
} }
Box* sysExcInfo() { Box* sysExcInfo() {
...@@ -430,6 +432,18 @@ size_t _PySys_GetSizeOf(PyObject* o) { ...@@ -430,6 +432,18 @@ size_t _PySys_GetSizeOf(PyObject* o) {
return (size_t)size; return (size_t)size;
} }
static PyObject* sys_setcheckinterval(PyObject *self, PyObject *args) noexcept {
if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_Py_CheckInterval))
return NULL;
_Py_Ticker = _Py_CheckInterval;
Py_INCREF(Py_None);
return Py_None;
}
static PyObject * sys_getcheckinterval(PyObject *self, PyObject *args) noexcept {
return PyInt_FromLong(_Py_CheckInterval);
}
static PyObject* sys_getsizeof(PyObject* self, PyObject* args, PyObject* kwds) noexcept { static PyObject* sys_getsizeof(PyObject* self, PyObject* args, PyObject* kwds) noexcept {
static const char* kwlist[] = { "object", "default", 0 }; static const char* kwlist[] = { "object", "default", 0 };
size_t size; size_t size;
...@@ -545,6 +559,8 @@ static PyMethodDef sys_methods[] = { ...@@ -545,6 +559,8 @@ static PyMethodDef sys_methods[] = {
{ "excepthook", sys_excepthook, METH_VARARGS, excepthook_doc }, { "excepthook", sys_excepthook, METH_VARARGS, excepthook_doc },
{ "displayhook", sys_displayhook, METH_O, displayhook_doc }, { "displayhook", sys_displayhook, METH_O, displayhook_doc },
{ "_clear_type_cache", sys_clear_type_cache, METH_NOARGS, sys_clear_type_cache__doc__ }, { "_clear_type_cache", sys_clear_type_cache, METH_NOARGS, sys_clear_type_cache__doc__ },
{ "setcheckinterval", sys_setcheckinterval, METH_VARARGS, NULL},
{ "getcheckinterval", sys_getcheckinterval, METH_NOARGS, NULL},
{ "getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc }, { "getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc },
{ "getsizeof", (PyCFunction)sys_getsizeof, METH_VARARGS | METH_KEYWORDS, getsizeof_doc }, { "getsizeof", (PyCFunction)sys_getsizeof, METH_VARARGS | METH_KEYWORDS, getsizeof_doc },
}; };
......
...@@ -252,6 +252,9 @@ Box* methodDescrTppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPassSpec a ...@@ -252,6 +252,9 @@ Box* methodDescrTppCall(Box* _self, CallRewriteArgs* rewrite_args, ArgPassSpec a
rewrite_args->obj->addAttrGuard(offsetof(PyMethodDescrObject, d_method), (intptr_t)self->d_method); rewrite_args->obj->addAttrGuard(offsetof(PyMethodDescrObject, d_method), (intptr_t)self->d_method);
} }
if (call_flags == METH_KEYWORDS)
call_flags = (METH_VARARGS | METH_KEYWORDS);
ParamReceiveSpec paramspec(0, 0, false, false); ParamReceiveSpec paramspec(0, 0, false, false);
Box** defaults = NULL; Box** defaults = NULL;
if (call_flags == METH_NOARGS) { if (call_flags == METH_NOARGS) {
......
...@@ -1485,7 +1485,8 @@ void Box::setattr(BoxedString* attr, BORROWED(Box*) val, SetattrRewriteArgs* rew ...@@ -1485,7 +1485,8 @@ void Box::setattr(BoxedString* attr, BORROWED(Box*) val, SetattrRewriteArgs* rew
if (rewrite_args) if (rewrite_args)
rewrite_args->obj->addAttrGuard(offsetof(Box, cls), (intptr_t)cls); rewrite_args->obj->addAttrGuard(offsetof(Box, cls), (intptr_t)cls);
RELEASE_ASSERT(attr->s() != none_str || this == builtins_module, "can't assign to None"); // RELEASE_ASSERT(attr->s() != none_str || this == builtins_module, "attr is %s", attr->s().data());
// RELEASE_ASSERT(attr->s() != none_str || this == builtins_module, "can't assign to None");
if (cls->instancesHaveHCAttrs()) { if (cls->instancesHaveHCAttrs()) {
HCAttrs* attrs = getHCAttrsPtr(); HCAttrs* attrs = getHCAttrsPtr();
......
...@@ -706,8 +706,8 @@ static Box* objectNewNoArgs(BoxedClass* cls) noexcept { ...@@ -706,8 +706,8 @@ static Box* objectNewNoArgs(BoxedClass* cls) noexcept {
#ifndef NDEBUG #ifndef NDEBUG
static BoxedString* new_str = getStaticString("__new__"); static BoxedString* new_str = getStaticString("__new__");
static BoxedString* init_str = getStaticString("__init__"); static BoxedString* init_str = getStaticString("__init__");
assert(typeLookup(cls, new_str) == typeLookup(object_cls, new_str) // assert(typeLookup(cls, new_str) == typeLookup(object_cls, new_str));
&& typeLookup(cls, init_str) != typeLookup(object_cls, init_str)); assert(typeLookup(cls, init_str) != typeLookup(object_cls, init_str));
#endif #endif
return new (cls) Box(); return new (cls) Box();
} }
...@@ -2302,7 +2302,9 @@ public: ...@@ -2302,7 +2302,9 @@ public:
} }
void convertToPrivateDict() { void convertToPrivateDict() {
RELEASE_ASSERT(!private_dict, ""); if (private_dict)
return;
// RELEASE_ASSERT(!private_dict, "");
RELEASE_ASSERT(b, ""); RELEASE_ASSERT(b, "");
private_dict = (BoxedDict*)AttrWrapper::copy(this); private_dict = (BoxedDict*)AttrWrapper::copy(this);
assert(PyDict_CheckExact(private_dict)); assert(PyDict_CheckExact(private_dict));
...@@ -3594,6 +3596,12 @@ extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) noexcept { ...@@ -3594,6 +3596,12 @@ extern "C" PyObject* PyObject_Init(PyObject* op, PyTypeObject* tp) noexcept {
if (op == NULL) if (op == NULL)
return PyErr_NoMemory(); return PyErr_NoMemory();
// Pyston change: register the type if the type is not yet registered
if (unlikely(tp->tp_dict == NULL)) {
int ret = PyType_Ready(tp);
assert(ret == 0);
}
assert(tp); assert(tp);
Py_TYPE(op) = tp; Py_TYPE(op) = tp;
......
wget https://pypi.python.org/packages/source/Z/Zope2/Zope2-2.13.24.tar.gz
wget https://pypi.python.org/packages/source/P/Products.StandardCacheManagers/Products.StandardCacheManagers-2.13.1.tar.gz
wget https://pypi.python.org/packages/source/P/Products.PythonScripts/Products.PythonScripts-2.13.2.zip
wget https://pypi.python.org/packages/source/P/Products.MIMETools/Products.MIMETools-2.13.0.zip
wget https://pypi.python.org/packages/source/P/Products.MailHost/Products.MailHost-2.13.2.zip
wget https://pypi.python.org/packages/source/P/Products.ExternalMethod/Products.ExternalMethod-2.13.1.zip
wget https://pypi.python.org/packages/source/P/Products.BTreeFolder2/Products.BTreeFolder2-2.13.5.tar.gz
wget https://pypi.python.org/packages/source/z/zope.viewlet/zope.viewlet-3.7.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.traversing/zope.traversing-3.13.2.zip
wget https://pypi.python.org/packages/source/z/zope.testing/zope.testing-3.9.7.tar.gz
wget https://pypi.python.org/packages/source/z/zope.testbrowser/zope.testbrowser-3.11.1.tar.gz
wget https://pypi.python.org/packages/source/z/zope.tales/zope.tales-3.5.3.tar.gz
wget https://pypi.python.org/packages/source/z/zope.tal/zope.tal-3.5.2.zip
wget https://pypi.python.org/packages/source/z/zope.structuredtext/zope.structuredtext-3.5.1.tar.gz
wget https://pypi.python.org/packages/source/z/zope.size/zope.size-3.4.1.tar.gz
wget https://pypi.python.org/packages/source/z/zope.site/zope.site-3.9.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.sequencesort/zope.sequencesort-3.4.0.tar.gz
wget https://pypi.python.org/packages/source/z/zope.sendmail/zope.sendmail-3.7.5.tar.gz
wget https://pypi.python.org/packages/source/z/zope.security/zope.security-3.7.4.tar.gz
wget https://pypi.python.org/packages/source/z/zope.schema/zope.schema-3.7.1.tar.gz
wget https://pypi.python.org/packages/source/z/zope.publisher/zope.publisher-3.12.6.tar.gz
wget https://pypi.python.org/packages/source/z/zope.ptresource/zope.ptresource-3.9.0.tar.gz
wget https://pypi.python.org/packages/source/z/zope.proxy/zope.proxy-3.6.1.zip
wget https://pypi.python.org/packages/source/z/zope.processlifetime/zope.processlifetime-1.0.tar.gz
wget https://pypi.python.org/packages/source/z/zope.pagetemplate/zope.pagetemplate-3.5.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.location/zope.location-3.9.1.tar.gz
wget https://pypi.python.org/packages/source/z/zope.lifecycleevent/zope.lifecycleevent-3.6.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.interface/zope.interface-3.6.7.zip
wget https://pypi.python.org/packages/source/z/zope.i18nmessageid/zope.i18nmessageid-3.5.3.tar.gz
wget https://pypi.python.org/packages/source/z/zope.i18n/zope.i18n-3.7.4.tar.gz
wget https://pypi.python.org/packages/source/z/zope.exceptions/zope.exceptions-3.6.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.event/zope.event-3.5.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.deferredimport/zope.deferredimport-3.5.3.tar.gz
wget https://pypi.python.org/packages/source/z/zope.contenttype/zope.contenttype-3.5.5.zip
wget https://pypi.python.org/packages/source/z/zope.contentprovider/zope.contentprovider-3.7.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.container/zope.container-3.11.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.configuration/zope.configuration-3.7.4.zip
wget https://pypi.python.org/packages/source/z/zope.component/zope.component-3.9.5.tar.gz
wget https://pypi.python.org/packages/source/z/zope.browserresource/zope.browserresource-3.10.3.zip
wget https://pypi.python.org/packages/source/z/zope.browserpage/zope.browserpage-3.12.2.tar.gz
wget https://pypi.python.org/packages/source/z/zope.browsermenu/zope.browsermenu-3.9.1.zip
wget https://pypi.python.org/packages/source/z/zope.browser/zope.browser-1.3.zip
wget https://pypi.python.org/packages/source/z/zLOG/zLOG-2.11.2.tar.gz
wget https://pypi.python.org/packages/source/z/zExceptions/zExceptions-2.13.0.zip
wget https://pypi.python.org/packages/source/z/zdaemon/zdaemon-2.0.7.tar.gz
wget https://pypi.python.org/packages/source/t/transaction/transaction-1.1.1.tar.gz
wget https://pypi.python.org/packages/source/t/tempstorage/tempstorage-2.12.2.zip
wget https://pypi.python.org/packages/2.7/p/pytz/pytz-2015.7-py2.7.egg
wget https://pypi.python.org/packages/source/i/initgroups/initgroups-2.13.0.zip
wget https://pypi.python.org/packages/source/d/docutils/docutils-0.12.tar.gz
wget https://pypi.python.org/packages/source/Z/ZopeUndo/ZopeUndo-2.12.0.zip
wget https://pypi.python.org/packages/source/Z/ZODB3/ZODB3-3.10.5.tar.gz
wget https://pypi.python.org/packages/source/Z/ZConfig/ZConfig-2.9.3.tar.gz
wget https://pypi.python.org/packages/source/R/RestrictedPython/RestrictedPython-3.6.0.zip
wget https://pypi.python.org/packages/source/R/Record/Record-2.13.0.zip
wget https://pypi.python.org/packages/source/P/Products.ZCTextIndex/Products.ZCTextIndex-2.13.5.zip
wget https://pypi.python.org/packages/source/P/Products.ZCatalog/Products.ZCatalog-2.13.27.zip
wget https://pypi.python.org/packages/source/P/Products.OFSP/Products.OFSP-2.13.2.zip
wget https://pypi.python.org/packages/source/P/Persistence/Persistence-2.13.2.zip
wget https://pypi.python.org/packages/source/M/MultiMapping/MultiMapping-2.13.0.zip
wget https://pypi.python.org/packages/source/M/Missing/Missing-2.13.1.zip
wget https://pypi.python.org/packages/source/E/ExtensionClass/ExtensionClass-2.13.2.zip
wget https://pypi.python.org/packages/source/D/DocumentTemplate/DocumentTemplate-2.13.2.zip
wget https://pypi.python.org/packages/source/D/DateTime/DateTime-2.12.8.tar.gz
wget https://pypi.python.org/packages/source/A/Acquisition/Acquisition-2.13.9.tar.gz
wget https://pypi.python.org/packages/source/A/AccessControl/AccessControl-2.13.14.tar.gz
wget https://pypi.python.org/packages/source/m/mechanize/mechanize-0.2.5.zip
wget https://pypi.python.org/packages/source/z/zope.annotation/zope.annotation-3.5.0.tar.gz
wget https://pypi.python.org/packages/source/z/zope.broken/zope.broken-3.6.0.zip
wget https://pypi.python.org/packages/source/z/zope.filerepresentation/zope.filerepresentation-3.6.1.tar.gz
wget https://pypi.python.org/packages/source/z/zope.dottedname/zope.dottedname-3.4.6.tar.gz
wget https://pypi.python.org/packages/source/z/zc.lockfile/zc.lockfile-1.0.2.tar.gz
# skip-if: True
import subprocess, sys, os, shutil, StringIO import subprocess, sys, os, shutil, StringIO
sys.path.append(os.path.dirname(__file__) + "/../lib") sys.path.append(os.path.dirname(__file__) + "/../lib")
import test_helper import test_helper
......
# skip-if: True
import os import os
import sys import sys
import subprocess import subprocess
......
# skip-if: True
import os, sys, subprocess, shutil import os, sys, subprocess, shutil
sys.path.append(os.path.dirname(__file__) + "/../lib") sys.path.append(os.path.dirname(__file__) + "/../lib")
......
# skip-if: True
import os import os
import sys import sys
import subprocess import subprocess
......
# skip-if: True
import gc import gc
import os import os
import sys import sys
......
# expected: fail
import os import os
import sys import sys
import subprocess import subprocess
......
# skip-if: True
import os
import sys
import subprocess
sys.path.append(os.path.dirname(__file__) + "/../lib")
from test_helper import run_test
"""
Using this test file.
The /bin/python is the pyston executable so if you recompile pyston, you need to run this
script again to update it.
"""
def print_progress_header(text):
print "\n>>>"
print ">>> " + text + "..."
print ">>>"
ENV_NAME = "zope_test_env_" + os.path.basename(sys.executable)
DEPENDENCIES = ["nose==1.3.7", "six"]
SRC_DIR = ENV_NAME
PYTHON_EXE = os.path.abspath(ENV_NAME + "/bin/python")
EASY_INSTALL_EXE = os.path.abspath(ENV_NAME + "/bin/easy_install")
MK_ZOPE_INSTANCE_EXE = os.path.abspath(ENV_NAME + "/bin/mkzopeinstance")
HOME_DIR = os.path.expanduser('~')
ZOPE_DIR = HOME_DIR + '/Zope-2.13.24-pakcages'
ZOPE_ENV_PATH = os.path.abspath(ENV_NAME)
INSTANCE_DIR = os.path.abspath(ENV_NAME + "/instance")
def creat_zope_virtual_dir():
if not os.path.exists(ENV_NAME) or os.stat(sys.executable).st_mtime > os.stat(ENV_NAME + "/bin/python").st_mtime:
print "Creating virtualenv to install testing dependencies..."
VIRTUALENV_SCRIPT = os.path.dirname(__file__) + "/../lib/virtualenv/virtualenv.py"
try:
args = [sys.executable, VIRTUALENV_SCRIPT, "-p", sys.executable, ENV_NAME]
print "Running", args
subprocess.check_call(args)
subprocess.check_call([ENV_NAME + "/bin/pip", "install"] + DEPENDENCIES)
except:
print "Error occurred; trying to remove partially-created directory"
ei = sys.exc_info()
try:
subprocess.check_call(["rm", "-rf", ENV_NAME])
except Exception as e:
print e
raise ei[0], ei[1], ei[2]
import shutil
def mk_ZOPE_DIR():
# Make sure we are in a clean dir.
if os.path.exists(ZOPE_DIR):
shutil.rmtree(ZOPE_DIR)
os.makedirs(ZOPE_DIR)
# ********************************
# ********************************
# **** Modified Zope Packages ****
# ********************************
# ********************************
modified_list = [
("Acquisition-2.13.9", "https://lab.nexedi.com/Daetalus/Acquisition-2.13.9/repository/archive.zip?ref=master"),
("AccessControl-2.13.14", "https://lab.nexedi.com/Daetalus/AccessControl-2.13.14/repository/archive.zip?ref=master"),
("ExtensionClass-2.13.2", "https://lab.nexedi.com/Daetalus/ExtensionClass-2.13.2/repository/archive.zip?ref=master"),
("zope.container-3.11.2", "https://lab.nexedi.com/Daetalus/zope.container-3.11.2/repository/archive.zip?ref=master"),
("zope.proxy-3.6.1", "https://lab.nexedi.com/Daetalus/zope.proxy-3.6.1/repository/archive.zip?ref=master"),
("zope.security-3.7.4", "https://lab.nexedi.com/Daetalus/zope.security-3.7.4/repository/archive.zip?ref=master"),
("DocumentTemplate-2.13.2", "https://lab.nexedi.com/Daetalus/DocumentTemplate-2.13.2/repository/archive.zip?ref=master"),
("RestrictedPython-3.6.0", "https://lab.nexedi.com/Daetalus/RestrictedPython-3.6.0/repository/archive.zip?ref=master"),
("ZODB3-3.10.5", "https://lab.nexedi.com/Daetalus/ZODB3-3.10.5/repository/archive.zip?ref=pyston_patch"),
("Zope2-2.13.24", "https://lab.nexedi.com/Daetalus/Zope2-2.13.24/repository/archive.zip?ref=master"),]
# Download zope packages except the packages listed in modified_list
zope_packages = open(os.path.dirname(__file__) + "/getZope.sh")
zope_download_list = zope_packages.read().splitlines()
m_pkg_link = []
um_pkg_link = []
for each_pkg in zope_download_list:
modified = None
for modified_pkg in modified_list:
pkg_name = modified_pkg[0]
pkg_link = modified_pkg[1]
a = pkg_name in each_pkg
if pkg_name in each_pkg:
modified = modified_pkg
m_link = ''.join(['wget ', pkg_link, ' -O ', pkg_name, '.zip'])
m_pkg_link.append(m_link)
break
if modified is None:
um_pkg_link.append(each_pkg)
else:
modified_list.remove(modified)
# print(zope_download_list)
# print(um_pkg_link)
print(len(zope_download_list))
print(len(um_pkg_link))
print(m_pkg_link)
# the package list is something like
# ['wget url', 'wget url'...]
def download_zope_packages(package_list):
for each_line in package_list:
commands = each_line.split(' ')
subprocess.check_call(commands, cwd=ZOPE_DIR)
def createZopeInstance():
try:
print_progress_header("Creating Zope instance")
commands = [MK_ZOPE_INSTANCE_EXE, '-d', INSTANCE_DIR, '-u', 'nexedi:270']
print(commands)
subprocess.check_call(commands, cwd=ZOPE_ENV_PATH)
except:
raise
def buildZope():
try:
print_progress_header("Building Zope packages")
commands = [EASY_INSTALL_EXE, '-H', 'None', '-i', ZOPE_DIR, 'Zope2']
# print(ZOPE_DIR)
# print(ZOPE_ENV_PATH)
# print(EASY_INSTALL_EXE)
subprocess.check_call(commands, cwd=ZOPE_ENV_PATH)
except:
raise
creat_zope_virtual_dir()
# mk_ZOPE_DIR()
# download_zope_packages(um_pkg_link)
download_zope_packages(m_pkg_link)
buildZope()
createZopeInstance()
print("Passed")
# skip-if: True
import slots_test import slots_test
for i in xrange(3): for i in xrange(3):
......
# expected: fail
# this tests are from cpythons test_compile.py # this tests are from cpythons test_compile.py
import unittest import unittest
from test import test_support from test import test_support
......
# expected: fail
import curses, sys import curses, sys
try: try:
......
# skip-if: True
import basic_test import basic_test
print type(basic_test) print type(basic_test)
......
# expected: fail
# This is a copy of cpythons test with the recursive repr test disabled # This is a copy of cpythons test with the recursive repr test disabled
# remove this test when we can pass cpythons test # remove this test when we can pass cpythons test
......
# skip-if: True
import type_test import type_test
print("Hello") print("Hello")
# skip-if: True
import slots_test import slots_test
HEAPTYPE = 1<<9 HEAPTYPE = 1<<9
......
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