[java-sig-commits] [javapackages] mvn_artifact: check if extensions match

Michal Srb msrb at fedoraproject.org
Mon Sep 23 08:27:54 UTC 2013


commit 42fcec264b1187360e67422680d530e59902f9d2
Author: Michal Srb <msrb at redhat.com>
Date:   Mon Sep 23 09:17:50 2013 +0200

    mvn_artifact: check if extensions match

 java-utils/mvn_artifact.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/java-utils/mvn_artifact.py b/java-utils/mvn_artifact.py
index 2c723f6..eb9be9d 100644
--- a/java-utils/mvn_artifact.py
+++ b/java-utils/mvn_artifact.py
@@ -69,6 +69,9 @@ Path where JAR file is located.
 
 config = ".xmvn-reactor"
 
+class ExtensionsDontMatch(Exception):
+    pass
+
 if __name__ == "__main__":
     parser = SaneParser(usage=usage,
                         epilog=epilog)
@@ -93,7 +96,11 @@ if __name__ == "__main__":
     jar_path = None
     if len(args) > 1:
         jar_path = args[1]
-        orig.extension = (os.path.splitext(jar_path)[1])[1:]
+        extension = (os.path.splitext(jar_path)[1])[1:]
+        if hasattr(orig, "extension") and orig.extension and orig.extension != extension:
+            raise ExtensionsDontMatch("Extensions don't match: '%s' != '%s'" % (orig.extension, extension))
+        else:
+            orig.extension = extension
     else:
         orig.extension = "pom"
 


More information about the java-sig-commits mailing list