Workarounds for install errors on Windows (#21890)
1. Forwarding sys.stdin, e.g. use input_multiprocess_fd, gives an error on Windows. Skipping for now 3. subprocess_context needs to serialize for Windows, like it does for Mac. Co-authored-by: lou.lawrence@kitware.com <lou.lawrence@kitware.com> Co-authored-by: John Parent <john.parent@kitware.com>
This commit is contained in:
parent
81bc00d61f
commit
b60a0eea01
@ -6,11 +6,9 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import contextlib
|
import contextlib
|
||||||
import fcntl
|
|
||||||
import os
|
import os
|
||||||
import struct
|
import struct
|
||||||
import sys
|
import sys
|
||||||
import termios
|
|
||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@ -18,6 +16,11 @@
|
|||||||
import six
|
import six
|
||||||
from six import StringIO
|
from six import StringIO
|
||||||
from six.moves import input
|
from six.moves import input
|
||||||
|
from sys import platform as _platform
|
||||||
|
|
||||||
|
if _platform != "win32":
|
||||||
|
import fcntl
|
||||||
|
import termios
|
||||||
|
|
||||||
from llnl.util.tty.color import cescape, clen, cprint, cwrite
|
from llnl.util.tty.color import cescape, clen, cprint, cwrite
|
||||||
|
|
||||||
@ -370,6 +373,7 @@ def hline(label=None, **kwargs):
|
|||||||
|
|
||||||
def terminal_size():
|
def terminal_size():
|
||||||
"""Gets the dimensions of the console: (rows, cols)."""
|
"""Gets the dimensions of the console: (rows, cols)."""
|
||||||
|
if _platform != "win32":
|
||||||
def ioctl_gwinsz(fd):
|
def ioctl_gwinsz(fd):
|
||||||
try:
|
try:
|
||||||
rc = struct.unpack('hh', fcntl.ioctl(
|
rc = struct.unpack('hh', fcntl.ioctl(
|
||||||
@ -389,3 +393,8 @@ def ioctl_gwinsz(fd):
|
|||||||
rc = (os.environ.get('LINES', 25), os.environ.get('COLUMNS', 80))
|
rc = (os.environ.get('LINES', 25), os.environ.get('COLUMNS', 80))
|
||||||
|
|
||||||
return int(rc[0]), int(rc[1])
|
return int(rc[0]), int(rc[1])
|
||||||
|
else:
|
||||||
|
# return shutil.get_terminal_size()
|
||||||
|
# TODO: find python 2 compatible module to get terminal size
|
||||||
|
rc = (os.environ.get('LINES', 25), os.environ.get('COLUMNS', 80))
|
||||||
|
return int(rc[0]), int(rc[1])
|
||||||
|
@ -1135,7 +1135,7 @@ def child_fun():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Forward sys.stdin when appropriate, to allow toggling verbosity
|
# Forward sys.stdin when appropriate, to allow toggling verbosity
|
||||||
if sys.stdin.isatty() and hasattr(sys.stdin, 'fileno'):
|
if sys.platform != "win32" and sys.stdin.isatty() and hasattr(sys.stdin, 'fileno'):
|
||||||
input_fd = os.dup(sys.stdin.fileno())
|
input_fd = os.dup(sys.stdin.fileno())
|
||||||
input_multiprocess_fd = MultiProcessFd(input_fd)
|
input_multiprocess_fd = MultiProcessFd(input_fd)
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@
|
|||||||
import spack.repo
|
import spack.repo
|
||||||
import spack.store
|
import spack.store
|
||||||
|
|
||||||
_serialize = sys.version_info >= (3, 8) and sys.platform == 'darwin'
|
_serialize = sys.platform == 'win32' or (sys.version_info >= (3, 8)
|
||||||
|
and sys.platform == 'darwin')
|
||||||
|
|
||||||
|
|
||||||
patches = None
|
patches = None
|
||||||
|
@ -10,12 +10,19 @@
|
|||||||
from os import O_NONBLOCK
|
from os import O_NONBLOCK
|
||||||
from os.path import basename
|
from os.path import basename
|
||||||
from subprocess import PIPE, Popen
|
from subprocess import PIPE, Popen
|
||||||
|
from sys import platform as _platform
|
||||||
from sys import stdout
|
from sys import stdout
|
||||||
|
|
||||||
from llnl.util import tty
|
from llnl.util import tty
|
||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
|
|
||||||
|
if _platform != 'win32':
|
||||||
|
from fcntl import F_GETFL, F_SETFL, fcntl
|
||||||
|
from os import O_NONBLOCK, rename
|
||||||
|
else:
|
||||||
|
from os import rename
|
||||||
|
|
||||||
re_optline = re.compile(r'\s+[0-9]+\..*\((serial|smpar|dmpar|dm\+sm)\)\s+')
|
re_optline = re.compile(r'\s+[0-9]+\..*\((serial|smpar|dmpar|dm\+sm)\)\s+')
|
||||||
re_paroptname = re.compile(r'\((serial|smpar|dmpar|dm\+sm)\)')
|
re_paroptname = re.compile(r'\((serial|smpar|dmpar|dm\+sm)\)')
|
||||||
re_paroptnum = re.compile(r'\s+([0-9]+)\.\s+\(')
|
re_paroptnum = re.compile(r'\s+([0-9]+)\.\s+\(')
|
||||||
@ -27,7 +34,9 @@
|
|||||||
def setNonBlocking(fd):
|
def setNonBlocking(fd):
|
||||||
"""
|
"""
|
||||||
Set the given file descriptor to non-blocking
|
Set the given file descriptor to non-blocking
|
||||||
|
Non-blocking pipes are not supported on windows
|
||||||
"""
|
"""
|
||||||
|
if _platform != 'win32':
|
||||||
flags = fcntl(fd, F_GETFL) | O_NONBLOCK
|
flags = fcntl(fd, F_GETFL) | O_NONBLOCK
|
||||||
fcntl(fd, F_SETFL, flags)
|
fcntl(fd, F_SETFL, flags)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user