瀏覽代碼

makepanda: Strip version suffixes when parsing setup.cfg metadata

Fixes #1539
rdb 2 年之前
父節點
當前提交
d5263b597b
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      makepanda/makepanda.py

+ 6 - 0
makepanda/makepanda.py

@@ -421,6 +421,12 @@ if VERSION is None:
     else:
     else:
         # Take the value from the setup.cfg file.
         # Take the value from the setup.cfg file.
         VERSION = GetMetadataValue('version')
         VERSION = GetMetadataValue('version')
+        match = re.match(r'^\d+\.\d+(\.\d+)+', VERSION)
+        if not match:
+            exit("Invalid version %s in setup.cfg, three digits are required" % (VERSION))
+        if WHLVERSION is None:
+            WHLVERSION = VERSION
+        VERSION = match.group()
 
 
 if WHLVERSION is None:
 if WHLVERSION is None:
     WHLVERSION = VERSION
     WHLVERSION = VERSION