platform

Platform-specific code lives here.

This is its own module to abstract away what would otherwise be distracting logic-flow interruptions.

invoke.platform.WINDOWS = False

Whether or not the current platform appears to be Windows in nature.

Note that Cygwin’s Python is actually close enough to “real” UNIXes that it doesn’t need (or want!) to use PyWin32 – so we only test for literal Win32 setups (vanilla Python, ActiveState etc) here.

invoke.platform.bytes_to_read(input_)

Query stream input_ to see how many bytes may be readable.

Note

If we are unable to tell (e.g. if input_ isn’t a true file descriptor) we fall back to suggesting reading 1 byte only.

Parameters:input – Input stream object (file-like).
Returns:int number of bytes to read.
invoke.platform.character_buffered(*args, **kwds)

Force local terminal stream be character, not line, buffered.

Only applies to Unix-based systems; on Windows this is a no-op.

invoke.platform.pty_size()

Determine current local pseudoterminal dimensions.

Returns:A (num_cols, num_rows) two-tuple describing PTY size. Defaults to (80, 24) if unable to get a sensible result dynamically.
invoke.platform.ready_for_reading(input_)

Test input_ to determine whether a read action will succeed.

Parameters:input – Input stream object (file-like).
Returns:True if a read should succeed, False otherwise.