Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 3 commits into from
Mar 16, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,18 @@
import sys
from setuptools import setup

VERSION = '0.9.0'
VERSION = '0.9.1'

DEPENDENCIES = [
'argcomplete',
'jmespath',
'pygments',
'pyyaml',
'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.

]

# On Windows, colorama is required for legacy terminals.
if sys.platform == 'win32':
DEPENDENCIES.append('colorama')

with open('README.rst', 'r') as f:
README = f.read()

Expand Down