Skip to content

Commit

Permalink
Fix platform detection
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Jun 1, 2015
1 parent 8c86f8f commit a40bca2
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/etc/check-sanitycheck.py
Expand Up @@ -17,14 +17,12 @@

STATUS = 0


def error_unless_permitted(env_var, message):
global STATUS
if not os.getenv(env_var):
sys.stderr.write(message)
STATUS = 1


def only_on(platforms):
def decorator(func):
@functools.wraps(func)
Expand All @@ -34,8 +32,7 @@ def inner():
return inner
return decorator


@only_on(('linux', 'darwin', 'freebsd', 'openbsd'))
@only_on(['linux', 'darwin', 'freebsd', 'openbsd'])
def check_rlimit_core():
import resource
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
Expand All @@ -46,9 +43,9 @@ def check_rlimit_core():
set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
""" % (soft))

@only_on(('windows'))
@only_on(['win32'])
def check_console_code_page():
if "65001" not in subprocess.check_output(['cmd', '/c', 'chcp']):
if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']):
sys.stderr.write('Warning: the console output code page is not UTF-8, \
some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n')

Expand Down

0 comments on commit a40bca2

Please sign in to comment.