gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r17426 - gnunet-update


From: gnunet
Subject: [GNUnet-SVN] r17426 - gnunet-update
Date: Wed, 12 Oct 2011 16:41:16 +0200

Author: harsha
Date: 2011-10-12 16:41:15 +0200 (Wed, 12 Oct 2011)
New Revision: 17426

Modified:
   gnunet-update/package.py
Log:
cleaned

Modified: gnunet-update/package.py
===================================================================
--- gnunet-update/package.py    2011-10-12 14:27:56 UTC (rev 17425)
+++ gnunet-update/package.py    2011-10-12 14:41:15 UTC (rev 17426)
@@ -39,9 +39,6 @@
 from xml.dom.minidom import Document
 
 #global variables
-configure = False
-build = False
-install = False
 gnunet_src = ""
 install_prefix = ""
 package_file = ""
@@ -210,7 +207,8 @@
                             
                         (dep.major, 
                          dep.minor, 
-                         dep.rev) = match2.groups() if match2 else 
match.groups()
+                         dep.rev) = match2.groups() if match2 \
+                                                    else match.groups()
                     else:
                         raise Exception('Unhandled discrepancy.')
                     
@@ -273,42 +271,47 @@
     tar_file.close()
     metadata_file.close()
         
-
-#first parse the command line arguments
-try:
-    opts, args = getopt.getopt(sys.argv[1:], 
-                               "c:hi", 
-                               ["help", "config="])
+def main():
+    """Starting point of execution."""
+    global prefix_given
+    global gnunet_src
+    global install_prefix
+    global package_file
     
-except getopt.GetoptError, err:
-    print err
-    print "Exception occured"
-    usage()
-    sys.exit(2)
-else:
-    action = "build"
-    for option, value in opts:
-        if option in ("-h", "--help"):
+    #first parse the command line arguments
+    try:
+        opts, args = getopt.getopt(sys.argv[1:], 
+                                   "c:hi", 
+                                   ["help", "config="])
+    except getopt.GetoptError, err:
+        print err
+        print "Exception occured"
+        usage()
+        sys.exit(2)
+    else:
+        action = "build"
+        for option, value in opts:
+            if option in ("-h", "--help"):
+                usage()
+                sys.exit(2)
+            elif option in ("-c", "--config"):
+                config_options.append(value)
+                #check if the user has given an installation prefix
+                if(value.strip()[0:9] == "--prefix="):
+                    prefix_given = True
+                    install_prefix = value.strip()[9:] 
+            elif option == "-i":
+                action = "extract_deps"  
+        if len(args) != 2:
+            print "Incorrect number of arguments passed"
             usage()
-            sys.exit(2)
-        elif option in ("-c", "--config"):
-            config_options.append(value)
-            #check if the user has given an installation prefix
-            if(value.strip()[0:9] == "--prefix="):
-                prefix_given = True
-                install_prefix = value.strip()[9:] 
-        elif option == "-i":
-            action = "extract_deps"  
-    if len(args) != 2:
-        print "Incorrect number of arguments passed"
-        usage()
-        sys.exit(1)
-    gnunet_src = args[0]
-    package_file = args[1]
-    
-    #if the prefix is not given we need to install into a temporary directory
-    if not prefix_given:
-        install_prefix = tempfile.mkdtemp(prefix="gnunet-install.")
-        
-    run(action)
-    
\ No newline at end of file
+            sys.exit(1)
+        gnunet_src = args[0]
+        package_file = args[1]
+        #if prefix is not given we need to install into a temporary directory
+        if not prefix_given:
+            install_prefix = tempfile.mkdtemp(prefix="gnunet-install.")
+        run(action)
+
+if __name__ == "__main__":
+    main()
\ No newline at end of file




reply via email to

[Prev in Thread] Current Thread [Next in Thread]