Bug 1379961 - Add platform and architecture name to MozbuildObject. r?gps
MozReview-Commit-ID: 7F0oFEkTAsk
--- a/python/mozbuild/mozbuild/base.py
+++ b/python/mozbuild/mozbuild/base.py
@@ -264,16 +264,31 @@ class MozbuildObject(ProcessExecutionMix
@property
def includedir(self):
return os.path.join(self.topobjdir, 'dist', 'include')
@property
def statedir(self):
return os.path.join(self.topobjdir, '.mozbuild')
+ @property
+ def platform(self):
+ """Returns current platform and architecture name"""
+ import mozinfo
+ platform_name = None
+ bits = str(mozinfo.info['bits'])
+ if mozinfo.isLinux:
+ platform_name = "linux" + bits
+ elif mozinfo.isWin:
+ platform_name = "win" + bits
+ elif mozinfo.isMac:
+ platform_name = "macosx" + bits
+
+ return platform_name, bits + 'bit'
+
@memoized_property
def extra_environment_variables(self):
'''Some extra environment variables are stored in .mozconfig.mk.
This functions extracts and returns them.'''
from mozbuild import shellutil
mozconfig_mk = os.path.join(self.topobjdir, '.mozconfig.mk')
env = {}
with open(mozconfig_mk) as fh: