Commit d7a9fd9a authored by Marius Wachtler's avatar Marius Wachtler

Set correct site-package directory, fix 'str * -1', add sys.dont_write_bytecode

parent 6c3ef5aa
...@@ -126,12 +126,17 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): ...@@ -126,12 +126,17 @@ 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,
"lib", "python" + get_python_version()) "from_cpython", "Lib")
if standard_lib: if standard_lib:
return libpython return libpython
else: else:
return os.path.join(libpython, "site-packages") # Pyston change
# 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:
......
...@@ -311,6 +311,9 @@ void setupSys() { ...@@ -311,6 +311,9 @@ void setupSys() {
sys_module->giveAttr("path_hooks", new BoxedList()); sys_module->giveAttr("path_hooks", new BoxedList());
sys_module->giveAttr("path_importer_cache", new BoxedDict()); sys_module->giveAttr("path_importer_cache", new BoxedDict());
// As we don't support compile() etc yet force 'dont_write_bytecode' to true.
sys_module->giveAttr("dont_write_bytecode", True);
sys_module->giveAttr("prefix", boxStrConstant(Py_GetPrefix())); sys_module->giveAttr("prefix", boxStrConstant(Py_GetPrefix()));
sys_module->giveAttr("exec_prefix", boxStrConstant(Py_GetExecPrefix())); sys_module->giveAttr("exec_prefix", boxStrConstant(Py_GetExecPrefix()));
......
...@@ -1106,6 +1106,8 @@ extern "C" Box* strMul(BoxedString* lhs, Box* rhs) { ...@@ -1106,6 +1106,8 @@ extern "C" Box* strMul(BoxedString* lhs, Box* rhs) {
n = static_cast<BoxedInt*>(rhs)->n; n = static_cast<BoxedInt*>(rhs)->n;
else else
return NotImplemented; return NotImplemented;
if (n <= 0)
return boxString("");
// TODO: use createUninitializedString and getWriteableStringContents // TODO: use createUninitializedString and getWriteableStringContents
int sz = lhs->size(); int sz = lhs->size();
......
...@@ -166,3 +166,5 @@ print "1".zfill(3), "+1".zfill(3), "-1".zfill(3), "0".zfill(3) ...@@ -166,3 +166,5 @@ print "1".zfill(3), "+1".zfill(3), "-1".zfill(3), "0".zfill(3)
it = iter("hello world") it = iter("hello world")
print list(it) print list(it)
print "'{0}' '{1}'".format("Hello " * 3, "Hello " * -3)
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