Skip to content

Use conditional download of the mslex #7

@pomponchik

Description

@pomponchik

I see that you download the mslex independent of OS:

"mslex",

But if a user-OS is, as example, Linux, it is not required. And there is a special mechanism for OS-specific dependensies. I suggest you to use it.

And if you'll go this way, you probably can throw away code like this:

def is_posix() -> bool:
    """
    Returns whether the system running Python is POSIX compatible.
    This is the condition for oslex.underlying being shlex.
    This is also the condition for os.path being posixpath.
    """
    return 'posix' in sys.builtin_module_names


def is_windows() -> bool:
    """
    Returns whether the system running Python is Windows based.
    This is the condition for oslex.underlying being mslex.
    This is also the condition for os.path being ntpath.
    """

    if is_posix():
        # This early return is likely redundant, but we want to be 100% equivalent to the if-elseif structure found in os.py
        # See https://github.com/python/cpython/blob/3.7/Lib/os.py
        return False

    return 'nt' in sys.builtin_module_names

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions