Skip to content

Use proper PEP 508 environment marker to install colorama on Windows only#257

Merged
jiasli merged 3 commits intomicrosoft:devfrom
niander:fixColoramaInstall
Mar 16, 2022
Merged

Use proper PEP 508 environment marker to install colorama on Windows only#257
jiasli merged 3 commits intomicrosoft:devfrom
niander:fixColoramaInstall

Conversation

@niander
Copy link
Member

@niander niander commented Mar 1, 2022

Issue #256

Using proper PEP 508 environment marker to install colorama on Windows only.

@jiasli
Copy link
Member

jiasli commented Mar 16, 2022

Indeed, after decompressing https://files.pythonhosted.org/packages/bf/9e/6378bc3d04592cd3692dd50f829c6678fae69052fda048a7981657c17489/knack-0.9.0-py3-none-any.whl, knack-0.9.0.dist-info/METADATA contains:

Requires-Dist: argcomplete
Requires-Dist: jmespath
Requires-Dist: pygments
Requires-Dist: pyyaml
Requires-Dist: tabulate

'tabulate'
'tabulate',
# On Windows, colorama is required for legacy terminals.
'colorama; sys_platform == "win32"'
Copy link
Member

@jiasli jiasli Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am actually wondering which one is the best:

portalocker is one dependency of Azure CLI and it uses:

https://github.com/WoLpH/portalocker/blob/00cffcb1831208691d3bf6850df4768989a0bd4c/setup.py#L133

            'pywin32>=226; platform_system == "Windows"',

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen several projects to use platform_system == "Windows" before, but none to use sys_platform. I don't think it matters but maybe we should use platform_system because it is more commonly used?

Copy link
Member Author

@niander niander Mar 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see this has already been merged so I guess it doesn't matter. But.. Would ever be the case sys_platform would be something else than win32 in a Windows? Like win64?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would ever be the case sys_platform would be something else than win32 in a Windows? Like win64?

I don't think so. I am running 64-bit Python on 64-bit Windows:

> python -c "import sys; print(sys.platform)"
win32

https://docs.python.org/3/library/sys.html#sys.platform only mentions win32 too.

@jiasli jiasli changed the title Fix colorama install Use proper PEP 508 environment marker to install colorama on Windows only Mar 16, 2022
@jiasli jiasli merged commit b4d9e66 into microsoft:dev Mar 16, 2022
@niander
Copy link
Member Author

niander commented Apr 6, 2022

When will this be released?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants