Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/util.py @ 10756:cb681cc59a8d
util: fake the builtin buffer if it's missing (jython)
author | Ronny Pfannschmidt <Ronny.Pfannschmidt@gmx.de> |
---|---|
date | Tue, 23 Mar 2010 11:36:19 +0100 |
parents | 7a6b5f85c3ab |
children | ef3668450cd0 |
comparison
equal
deleted
inserted
replaced
10752:53313405b54d | 10756:cb681cc59a8d |
---|---|
33 except ImportError: | 33 except ImportError: |
34 from sha import sha as _sha1 | 34 from sha import sha as _sha1 |
35 global _fastsha1, sha1 | 35 global _fastsha1, sha1 |
36 _fastsha1 = sha1 = _sha1 | 36 _fastsha1 = sha1 = _sha1 |
37 return _sha1(s) | 37 return _sha1(s) |
38 | |
39 import __builtin__ | |
40 | |
41 def fakebuffer(sliceable, offset=0): | |
42 return sliceable[offset:] | |
43 if not hasattr(__builtin__, 'buffer'): | |
44 __builtin__.buffer = fakebuffer | |
38 | 45 |
39 import subprocess | 46 import subprocess |
40 closefds = os.name == 'posix' | 47 closefds = os.name == 'posix' |
41 | 48 |
42 def popen2(cmd, env=None, newlines=False): | 49 def popen2(cmd, env=None, newlines=False): |