Commits

Dan Villiom Podlaski Christiansen  committed c3f1f1b

New patches.

  • Participants
  • Parent commits 801a312

Comments (0)

Files changed (3)

 test-kwargs.diff
 sem_t.diff
 database-sentinels.diff
+w_star-doc.diff
+sys-mercurial.diff #+broken

File sys-mercurial.diff

+# HG changeset patch
+# Parent 3a68a0810456d087a04056bdaed847144553b14a
+# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
+diff --git a/pypy/module/sys/__init__.py b/pypy/module/sys/__init__.py
+--- a/pypy/module/sys/__init__.py
++++ b/pypy/module/sys/__init__.py
+@@ -59,6 +59,7 @@ class Module(MixedModule):
+         'pypy_version_info'     : 'version.get_pypy_version_info(space)',
+         'pypy_svn_url'          : 'version.get_svn_url(space)',
+         'subversion'            : 'version.get_subversion_info(space)',
++        '_mercurial'            : 'version.get_mercurial_info(space)',
+         'hexversion'            : 'version.get_hexversion(space)',
+ 
+         'displayhook'           : 'hook.displayhook', 
+diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
+--- a/pypy/module/sys/version.py
++++ b/pypy/module/sys/version.py
+@@ -84,6 +84,32 @@ def get_subversion_info(space):
+                            space.wrap(svnbranch),
+                            space.wrap(str(svn_revision()))])
+ 
++def get_mercurial_info(space):
++    import py
++    from pypy.tool.ansi_print import ansi_log
++    log = py.log.Producer("version")
++    py.log.setconsumer("version", ansi_log)
++    log.ERROR("pypydir is %r" % pypydir)
++
++    if not os.path.isdir(os.path.join(pypydir, '..', '.hg')):
++        return space.w_None
++    else:
++        os.putenv('HGPLAIN', '1')
++        fp = os.popen('hg id -i "%s"' % pypydir)
++        hgid = fp.read().strip()
++        fp.close()
++
++        fp = os.popen('hg id -t "%s"' % pypydir)
++        hgtags = fp.read().strip()
++        fp.close()
++
++        log.ERROR("tag is %r" % hgtags)
++        log.ERROR("id is %r" % hgid)
++
++        return space.newtuple([space.wrap('PyPy'),
++                               space.wrap(hgtags),
++                               space.wrap(hgid)])
++
+ def tuple2hex(ver):
+     d = {'alpha':     0xA,
+          'beta':      0xB,
+@@ -133,4 +159,12 @@ def svn_revision():
+             f.close()
+     except (IOError, OSError):
+         pass
++    if rev == 0 and os.path.isdir(os.path.join(pypydir, '..', '.hg')):
++        try:
++            os.putenv('HGPLAIN', '1')
++            fp = os.popen('hg id -i "%s"' % pypydir)
++            rev = fp.read().strip()
++            fp.close()
++        except (IOError, OSError), e:
++            pass
+     return rev

File w_star-doc.diff

+# HG changeset patch
+# Parent e7e24b8d66128404a220708c1e616902c2a07e63
+# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
+diff --git a/pypy/module/posix/interp_posix.py b/pypy/module/posix/interp_posix.py
+--- a/pypy/module/posix/interp_posix.py
++++ b/pypy/module/posix/interp_posix.py
+@@ -925,7 +925,7 @@ def declare_new_w_star(name):
+     else:
+         def WSTAR(space, status):
+             return space.newbool(getattr(os, name)(status))
+-    WSTAR.__doc__ = getattr(os, name).__doc__
++    WSTAR.__doc__ = RegisterOs[name]
+     WSTAR.unwrap_spec = [ObjSpace, "c_int"]
+     WSTAR.func_name = name
+     return WSTAR
+diff --git a/pypy/rpython/module/ll_os.py b/pypy/rpython/module/ll_os.py
+--- a/pypy/rpython/module/ll_os.py
++++ b/pypy/rpython/module/ll_os.py
+@@ -1435,11 +1435,39 @@ class RegisterOs(BaseLazyRegistering):
+ 
+     # ------------------------------- os.W* ---------------------------------
+ 
+-    w_star = ['WCOREDUMP', 'WIFCONTINUED', 'WIFSTOPPED',
+-              'WIFSIGNALED', 'WIFEXITED', 'WEXITSTATUS',
+-              'WSTOPSIG', 'WTERMSIG']
++    w_star = {
++        'WCOREDUMP':
++        "Return True if the process returning 'status' was dumped to a core "
++        "file.",
++
++        'WIFCONTINUED':
++        "Return True if the process returning 'status' was continued from a "
++        "job control stop.",
++
++        'WIFSTOPPED':
++        "Return True if the process returning 'status' was stopped.",
++
++        'WIFSIGNALED': "",
++        "Return True if the process returning 'status' was terminated by a "
++        "signal",
++
++        'WIFEXITED':
++        "Return True if the process returning 'status' exited using the "
++        "exit() system call.",
++
++        'WEXITSTATUS':
++        "Return the process return code from 'status'.",
++
++        'WSTOPSIG':
++        "Return the signal that stopped the process that provided the "
++        "'status' value.",
++
++        'WTERMSIG':
++        "Return the signal that terminated the process that provided the "
++        "'status' value.",
++    }
+     # last 3 are returning int
+-    w_star_returning_int = dict.fromkeys(w_star[-3:])
++    w_star_returning_int = set(['WEXITSTATUS', 'WSTOPSIG', 'WTERMSIG'])
+ 
+ 
+