| Index: recipe_modules/platform/api.py
|
| diff --git a/recipe_modules/platform/api.py b/recipe_modules/platform/api.py
|
| index ecd5f673cc345f4165edc7bc51bf8313e44e5bfa..ded9f6ec947ec1395aaeea1a3623a46710303b09 100644
|
| --- a/recipe_modules/platform/api.py
|
| +++ b/recipe_modules/platform/api.py
|
| @@ -4,6 +4,7 @@
|
|
|
| import sys
|
| import platform
|
| +import multiprocessing
|
|
|
| from recipe_engine import recipe_api
|
|
|
| @@ -44,6 +45,7 @@ class PlatformApi(recipe_api.RecipeApi):
|
| # Default to linux/64, unless test case says otherwise.
|
| self._name = norm_plat(self._test_data.get('name', 'linux'))
|
| self._bits = norm_bits(self._test_data.get('bits', 64))
|
| + self._cpu_count = self._test_data.get('cpu_count', 2)
|
| else: # pragma: no cover
|
| # platform.machine is based on running kernel. It's possible to use 64-bit
|
| # kernel with 32-bit userland, e.g. to give linker slightly more memory.
|
| @@ -60,6 +62,8 @@ class PlatformApi(recipe_api.RecipeApi):
|
| platform.architecture()[0] == '64bit'):
|
| self._bits = 64
|
|
|
| + self._cpu_count = multiprocessing.cpu_count()
|
| +
|
| @property
|
| def is_win(self):
|
| return self.name == 'win'
|
| @@ -86,6 +90,11 @@ class PlatformApi(recipe_api.RecipeApi):
|
| def arch(self):
|
| return self._arch
|
|
|
| + @property
|
| + def cpu_count(self):
|
| + """The number of CPU cores, according to multiprocessing.cpu_count()."""
|
| + return self._cpu_count
|
| +
|
| @staticmethod
|
| def normalize_platform_name(platform):
|
| """One of python's sys.platform values -> 'win', 'linux' or 'mac'."""
|
|
|