Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r61863:a16f5b9e4808 Date: 2013-02-27 19:55 +0100 http://bitbucket.org/pypy/pypy/changeset/a16f5b9e4808/
Log: merge heads diff --git a/pypy/objspace/fake/checkmodule.py b/pypy/objspace/fake/checkmodule.py --- a/pypy/objspace/fake/checkmodule.py +++ b/pypy/objspace/fake/checkmodule.py @@ -11,9 +11,10 @@ module = mod.Module(space, W_Root()) for name in module.loaders: module._load_lazily(space, name) - for cls in module.submodules.itervalues(): - submod = cls(space, W_Root()) - for name in submod.loaders: - submod._load_lazily(space, name) + if hasattr(module, 'submodules'): + for cls in module.submodules.itervalues(): + submod = cls(space, W_Root()) + for name in submod.loaders: + submod._load_lazily(space, name) # space.translates(**{'translation.list_comprehension_operations': True}) diff --git a/rpython/rlib/rdynload.py b/rpython/rlib/rdynload.py --- a/rpython/rlib/rdynload.py +++ b/rpython/rlib/rdynload.py @@ -15,6 +15,7 @@ _WIN32 = _MSVC or _MINGW _MAC_OS = platform.name == "darwin" _FREEBSD = sys.platform.startswith("freebsd") +_NETBSD = sys.platform.startswith("netbsd") if _WIN32: from rpython.rlib import rwin32 @@ -27,7 +28,7 @@ else: pre_include_bits = [] -if _FREEBSD or _WIN32: +if _FREEBSD or _NETBSD or _WIN32: libraries = [] else: libraries = ['dl'] diff --git a/rpython/rtyper/module/ll_os.py b/rpython/rtyper/module/ll_os.py --- a/rpython/rtyper/module/ll_os.py +++ b/rpython/rtyper/module/ll_os.py @@ -224,9 +224,10 @@ decls = [] defs = [] for name in self.w_star: - data = {'ret_type': 'int', 'name': name} - decls.append((decl_snippet % data).strip()) - defs.append((def_snippet % data).strip()) + if hasattr(os, name): + data = {'ret_type': 'int', 'name': name} + decls.append((decl_snippet % data).strip()) + defs.append((def_snippet % data).strip()) self.compilation_info = self.compilation_info.merge( ExternalCompilationInfo( diff --git a/rpython/rtyper/module/ll_time.py b/rpython/rtyper/module/ll_time.py --- a/rpython/rtyper/module/ll_time.py +++ b/rpython/rtyper/module/ll_time.py @@ -41,7 +41,7 @@ RUSAGE = platform.Struct('struct rusage', [('ru_utime', TIMEVAL), ('ru_stime', TIMEVAL)]) -if sys.platform.startswith('freebsd'): +if sys.platform.startswith('freebsd') or sys.platform.startswith('netbsd'): libraries = ['compat'] else: libraries = [] diff --git a/rpython/translator/platform/__init__.py b/rpython/translator/platform/__init__.py --- a/rpython/translator/platform/__init__.py +++ b/rpython/translator/platform/__init__.py @@ -286,6 +286,13 @@ host_factory = Freebsd else: host_factory = Freebsd_64 +elif sys.platform.startswith('netbsd'): + from rpython.translator.platform.netbsd import Netbsd, Netbsd_64 + import platform + if platform.architecture()[0] == '32bit': + host_factory = Netbsd + else: + host_factory = Netbsd_64 elif "openbsd" in sys.platform: from rpython.translator.platform.openbsd import OpenBSD, OpenBSD_64 import platform diff --git a/rpython/translator/platform/netbsd.py b/rpython/translator/platform/netbsd.py new file mode 100644 --- /dev/null +++ b/rpython/translator/platform/netbsd.py @@ -0,0 +1,55 @@ +"""Support for NetBSD.""" + +import os + +from rpython.translator.platform import posix + +def get_env(key, default): + if key in os.environ: + return os.environ[key] + else: + return default + +def get_env_vector(key, default): + string = get_env(key, default) + # XXX: handle quotes + return string.split() + +class Netbsd(posix.BasePosix): + name = "netbsd" + + link_flags = ['-pthread'] + get_env_vector('LDFLAGS', '') + cflags = ['-O3', '-pthread', '-fomit-frame-pointer' + ] + get_env_vector('CFLAGS', '') + standalone_only = [] + shared_only = [] + so_ext = 'so' + make_cmd = 'gmake' + extra_libs = ('-lrt',) + + def __init__(self, cc=None): + if cc is None: + cc = get_env("CC", "gcc") + super(Netbsd, self).__init__(cc) + + def _args_for_shared(self, args): + return ['-shared'] + args + + def _preprocess_include_dirs(self, include_dirs): + res_incl_dirs = list(include_dirs) + res_incl_dirs.append(os.path.join(get_env("LOCALBASE", "/usr/pkg"), "include")) + return res_incl_dirs + + def _preprocess_library_dirs(self, library_dirs): + res_lib_dirs = list(library_dirs) + res_lib_dirs.append(os.path.join(get_env("LOCALBASE", "/usr/pkg"), "lib")) + return res_lib_dirs + + def _include_dirs_for_libffi(self): + return [os.path.join(get_env("LOCALBASE", "/usr/pkg"), "include")] + + def _library_dirs_for_libffi(self): + return [os.path.join(get_env("LOCALBASE", "/usr/pkg"), "lib")] + +class Netbsd_64(Netbsd): + shared_only = ('-fPIC',) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit