mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
tests: Windows compatibility fixes
- printenv.py, md5sum.py, simplemerge, test-archive, test-merge1, test-merge-symlinks: set standard streams to binary mode - test-encode: replace "gunzip" by "gzip -d" - test-hup: requires fifo
This commit is contained in:
parent
e82fd2d627
commit
0d0f719f13
@ -42,6 +42,9 @@ def showhelp():
|
||||
sys.stdout.write(' %-*s %s\n' % (opts_len, first, second))
|
||||
|
||||
try:
|
||||
for fp in (sys.stdin, sys.stdout, sys.stderr):
|
||||
util.set_binary(fp)
|
||||
|
||||
opts = {}
|
||||
try:
|
||||
args = fancyopts.fancyopts(sys.argv[1:], options, opts)
|
||||
|
@ -6,13 +6,20 @@
|
||||
# of the PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2, which is
|
||||
# GPL-compatible.
|
||||
|
||||
import sys
|
||||
import sys, os
|
||||
|
||||
try:
|
||||
from hashlib import md5
|
||||
except ImportError:
|
||||
from md5 import md5
|
||||
|
||||
try:
|
||||
import msvcrt
|
||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
for filename in sys.argv[1:]:
|
||||
try:
|
||||
fp = open(filename, 'rb')
|
||||
|
@ -16,6 +16,14 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
try:
|
||||
import msvcrt
|
||||
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
|
||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
exitcode = 0
|
||||
out = sys.stdout
|
||||
|
||||
|
@ -46,6 +46,13 @@ TIP=`hg id -v | cut -f1 -d' '`
|
||||
QTIP=`hg id -q`
|
||||
cat > getarchive.py <<EOF
|
||||
import os, sys, urllib2
|
||||
try:
|
||||
# Set stdout to binary mode for win32 platforms
|
||||
import msvcrt
|
||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
node, archive = sys.argv[1:]
|
||||
f = urllib2.urlopen('http://127.0.0.1:%s/?cmd=archive;node=%s;type=%s'
|
||||
% (os.environ['HGPORT'], node, archive))
|
||||
|
@ -4,7 +4,7 @@ hg init
|
||||
|
||||
cat > .hg/hgrc <<EOF
|
||||
[encode]
|
||||
*.gz = gunzip
|
||||
*.gz = gzip -d
|
||||
|
||||
[decode]
|
||||
*.gz = gzip
|
||||
|
@ -1,5 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
"$TESTDIR/hghave" fifo || exit 80
|
||||
|
||||
hg init
|
||||
mkfifo p
|
||||
|
||||
|
@ -2,7 +2,14 @@
|
||||
|
||||
cat > echo.py <<EOF
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import os, sys
|
||||
try:
|
||||
import msvcrt
|
||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
for k in ('HG_FILE', 'HG_MY_ISLINK', 'HG_OTHER_ISLINK', 'HG_BASE_ISLINK'):
|
||||
print k, os.environ[k]
|
||||
EOF
|
||||
|
@ -2,6 +2,14 @@
|
||||
|
||||
cat <<EOF > merge
|
||||
import sys, os
|
||||
|
||||
try:
|
||||
import msvcrt
|
||||
msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
|
||||
msvcrt.setmode(sys.stderr.fileno(), os.O_BINARY)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
print "merging for", os.path.basename(sys.argv[1])
|
||||
EOF
|
||||
HGMERGE="python ../merge"; export HGMERGE
|
||||
|
Loading…
Reference in New Issue
Block a user