-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Treat empty environment variables as unset in setup.py
#3763
Conversation
@Eta0 - if you want to merge this you'll need to reply to the Microsoft contributor agreement in the comment above |
@loadams Got it. Currently waiting on approval from my company to agree to it. |
@Eta0 any update? It would be great to get this merged |
Thank you all for your patience! I'm still waiting on legal approval, so I'll check in with them again. Update: it should be wrapped up some time this week 🎇 then I can sign and we can get this merged. Yay! |
Hi @Eta0 - no rush, but figured I'd follow up since its been a week! |
Hi @Eta0 - following up on this again, curious if you were able to get legal approval. |
This change fixes a bug that causes
setup.py
to fail when any of its configuration environment variables are the empty string.For example, running the following:
Currently fails with the following message:
Because
os.environ.get
does not use its fallback argument when an environment variable exists, but is empty.Similarly,
key in os.environ
returnsTrue
for empty (but still set) keys.Shells usually do not distinguish between unset variables and empty variables, so setting variables to the empty string is usually seen as another way to unset them. This specifically arose as an issue for me while I was writing a Dockerfile, since those have no way to unset
ENV
andARG
directives—only to set them to the empty string (or to figure out and hardcode what the default would have resolved to for eachARG
). I figure fixing this here is more helpful than writing weird workarounds.This changes
setup.py
to treat unset and empty environment variables identically. This behaviour could potentially be changed in other files, as well, but that is not included here.