Bug 1379961 - Add platform and architecture name to MozbuildObject. r?gps draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Tue, 05 Sep 2017 16:10:09 +0300
changeset 663299 d4f2e5bd516e4c622a2e86858505ce4edd5cfb8a
parent 663134 a73cc4e08bf5a005722c95b43f84ab0c8ff2bc7c
child 731159 ecd1beef01f41a4bd9dfcf66595caeb2fca55283
push id79389
push userbpostelnicu@mozilla.com
push dateTue, 12 Sep 2017 21:04:03 +0000
reviewersgps
bugs1379961
milestone57.0a1
Bug 1379961 - Add platform and architecture name to MozbuildObject. r?gps MozReview-Commit-ID: 7F0oFEkTAsk
python/mozbuild/mozbuild/base.py
--- 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: