question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

linux, macOS, and win variables instead of sys.platform.startswith(...)

See original GitHub issue

This is just a suggestion to define (boolean) python variables linux, macOS (or osx), and win32 such that the following:

{% if sys.platform.startswith('linux') or sys.platform.startswith('osx') %}

could be replaced with:

{% if linux or osx %}

Are there any limitations in the tools used by conda-devenv that prevent this simpler usage?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
allanlealcommented, Feb 13, 2019

@nicoddemus Sure! 😃 I’ll see what I can do. @marcelotrevisani Sure, unix === linux or osx, right.

1reaction
prusse-martincommented, Feb 13, 2019

Yes you are right. I say we drop all python (and numpy) related vars. Since to the environment being created the info from the root (base) environment is not really useful and can became confusing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linux 3: code should avoid using sys.platform == 'linux2'
msg138251 ‑ (view) Author: Charles‑François Natali (neologix) * Date: 2011‑06‑13 14:34 msg138252 ‑ (view) Author: STINNER Victor (vstinner) * Date: 2011‑06‑13 14:38 msg138253 ‑ (view)...
Read more >
sys.platform.startswith Example
Learn how to use python api sys.platform.startswith. ... return 'win' elif sys.platform.startswith('linux'): return 'linux' elif ...
Read more >
How to identify which OS Python is running on?
i.e. platform. system() returns "Windows" instead of "win32" . sys. platform also contains "linux2" on old versions of Python while it contains just...
Read more >
Building Go Applications for Different Operating Systems ...
You can set either the GOOS or GOARCH environment variables to build for a different platform using go build . If you are...
Read more >
What's the difference between "platform.system() ...
Use os.name == 'nt' for determining windows (vs posix), sys.platform for finer granularity (eg. sys.platform.startswith('linux') for checking if it's Linux.).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found