]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools ConvertMasmToNasm: Fix running script outside of a git tree
authorJordan Justen <jordan.l.justen@intel.com>
Wed, 10 Feb 2016 18:08:37 +0000 (10:08 -0800)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 10 Mar 2016 17:59:11 +0000 (09:59 -0800)
The script previously would hit an exception if it was run outside of
a git tree.

The exception looked like:

edk2/BaseTools/Scripts/ConvertMasmToNasm.py Version 0.01
Traceback (most recent call last):
  File "edk2/BaseTools/Scripts/ConvertMasmToNasm.py", line 986, in <module>
    ConvertAsmApp()
  File "edk2/BaseTools/Scripts/ConvertMasmToNasm.py", line 984, in __init__
    ConvertAsmFile(src, dst, self)
  File "edk2/BaseTools/Scripts/ConvertMasmToNasm.py", line 209, in __init__
    CommonUtils.__init__(self, clone)
  File "edk2/BaseTools/Scripts/ConvertMasmToNasm.py", line 69, in __init__
    self.gitemail = clone.gitemail
AttributeError: ConvertAsmApp instance has no attribute 'gitemail'

Fixes: https://github.com/tianocore/edk2/issues/63
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
BaseTools/Scripts/ConvertMasmToNasm.py

index 7ad0bd23f3ee1a2a96329898c2fd1dbaef396d21..2f0dd4f9a65c765591359024c16326514e6991c3 100755 (executable)
@@ -1,7 +1,7 @@
 # @file ConvertMasmToNasm.py\r
 # This script assists with conversion of MASM assembly syntax to NASM\r
 #\r
-#  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -127,6 +127,7 @@ class CommonUtils:
         while True:\r
             path = os.path.split(lastpath)[0]\r
             if path == lastpath:\r
+                self.gitemail = None\r
                 return\r
             candidate = os.path.join(path, '.git')\r
             if os.path.isdir(candidate):\r
@@ -197,6 +198,7 @@ class CommonUtils:
         message += '%s to %s\n' % (src, dst)\r
         message += '\n'\r
         message += 'Contributed-under: TianoCore Contribution Agreement 1.0\n'\r
+        assert(self.gitemail is not None)\r
         message += 'Signed-off-by: %s\n' % self.gitemail\r
 \r
         cmd = ('git', 'commit', '-F', '-')\r