Skip to content

Commit

Permalink
Handle missing os.sysconf more gracefully
Browse files Browse the repository at this point in the history
os.sysconf is not available on all platforms (like Windows) but it
is used to retrieve the number of online processors. If missing,
assume one processor (building on such a platform will most likely
not work, though).

Fixes: #948 ("Windows compatibility") (at least it improves the
Windows support a bit)
  • Loading branch information
marcus-h committed Sep 3, 2021
1 parent a7bdd67 commit 0285986
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions osc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@
def _get_processors():
"""
get number of processors (online) based on
SC_NPROCESSORS_ONLN (returns 1 if config name does not exist).
SC_NPROCESSORS_ONLN (returns 1 if config name/os.sysconf does not exist).
"""
try:
return os.sysconf('SC_NPROCESSORS_ONLN')
except ValueError as e:
except (AttributeError, ValueError):
return 1


Expand Down

0 comments on commit 0285986

Please sign in to comment.