gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r17815 - in gnunet-update: . gnunet_update


From: gnunet
Subject: [GNUnet-SVN] r17815 - in gnunet-update: . gnunet_update
Date: Thu, 27 Oct 2011 19:32:56 +0200

Author: harsha
Date: 2011-10-27 19:32:56 +0200 (Thu, 27 Oct 2011)
New Revision: 17815

Added:
   gnunet-update/gnunet_update/
   gnunet-update/gnunet_update/__init__.py
   gnunet-update/gnunet_update/dependency.py
   gnunet-update/gnunet_update/install.py
   gnunet-update/gnunet_update/package.py
Removed:
   gnunet-update/package.py
Log:
added gnunet_update python package

Added: gnunet-update/gnunet_update/__init__.py
===================================================================
--- gnunet-update/gnunet_update/__init__.py                             (rev 0)
+++ gnunet-update/gnunet_update/__init__.py     2011-10-27 17:32:56 UTC (rev 
17815)
@@ -0,0 +1,23 @@
+# This file is part of GNUnet.
+# (C) 2001--2011 Christian Grothoff (and other contributing authors)
+#
+# GNUnet is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 2, or (at your
+# option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNUnet; see the file COPYING.  If not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+#File:     package.py
+#Author:   Sree Harsha Totakura
+#
+#gnunet_update python package initialization file
+

Added: gnunet-update/gnunet_update/dependency.py
===================================================================
--- gnunet-update/gnunet_update/dependency.py                           (rev 0)
+++ gnunet-update/gnunet_update/dependency.py   2011-10-27 17:32:56 UTC (rev 
17815)
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+# This file is part of GNUnet.
+# (C) 2001--2011 Christian Grothoff (and other contributing authors)
+#
+# GNUnet is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 2, or (at your
+# option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNUnet; see the file COPYING.  If not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+#File:     package.py
+#Author:   Sree Harsha Totakura
+#                                     
+#                                                                   
+#File for holding the Dependency and BinaryObject classes
+
+from operator import xor
+
+
+class Dependency:
+    """Class for holding data for a dependency"""
+    major = minor = rev = None   
+    def __init__(self, name, path):
+        """Creates a new dependency object with name and path."""
+        self.name = name
+        self.path = path
+    
+    def __eq__(self, other):
+        """Compares two dependency objects. Returns True if both have same name
+        and path, false otherwise.
+        """
+        return (self.name == other.name and self.path == other.path)        
+        
+    def __hash__(self):
+        """Calculates the hashes of name and path. Returns XOR of hashes."""
+        return xor(hash(self.name), hash(self.path))
+
+class BinaryObject:
+    """Class representing executable code."""
+    
+    def __init__(self, name):
+        """Returns am instance of BinaryObject."""
+        self.name = name
+        self._deps = list()
+        
+    def add_dependency(self, dep):
+        """Adds dep object to the list of dependencies."""
+        self._deps.append(dep)
+        
+    def get_dependencies(self):
+        """Return the list of dependencies."""
+        return self._deps
+    
+    def _dependency_ascii(self, dep):
+        """Given a dependency, returns an ascii line describing it."""
+        dep_str = self.name + ";" + dep.name + ";"
+        dep_str += "-1:" if dep.major == None else dep.major + ":"
+        dep_str += "-1:" if dep.minor == None else dep.minor + ":"
+        dep_str += "-1" if dep.rev == None else dep.rev
+        return dep_str + "\n"
+    
+    def dependency_listlines(self):
+        """Return list of lines which describe all dependencies."""
+        return map(self._dependency_ascii, self._deps)
+

Added: gnunet-update/gnunet_update/install.py
===================================================================
--- gnunet-update/gnunet_update/install.py                              (rev 0)
+++ gnunet-update/gnunet_update/install.py      2011-10-27 17:32:56 UTC (rev 
17815)
@@ -0,0 +1,22 @@
+# This file is part of GNUnet.
+# (C) 2001--2011 Christian Grothoff (and other contributing authors)
+#
+# GNUnet is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 2, or (at your
+# option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNUnet; see the file COPYING.  If not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+#File:     package.py
+#Author:   Sree Harsha Totakura
+#
+#Python sript for installing the packages packed using package script
\ No newline at end of file

Copied: gnunet-update/gnunet_update/package.py (from rev 17814, 
gnunet-update/package.py)
===================================================================
--- gnunet-update/gnunet_update/package.py                              (rev 0)
+++ gnunet-update/gnunet_update/package.py      2011-10-27 17:32:56 UTC (rev 
17815)
@@ -0,0 +1,267 @@
+#!/usr/bin/python
+# This file is part of GNUnet.
+# (C) 2001--2011 Christian Grothoff (and other contributing authors)
+#
+# GNUnet is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published
+# by the Free Software Foundation; either version 2, or (at your
+# option) any later version.
+#
+# GNUnet is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNUnet; see the file COPYING.  If not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+#File:     package.py
+#Author:   Sree Harsha Totakura
+#
+#TODO:
+#
+#Thoughts:
+#            
+
+#python script to build, install and package along with dependencies the given
+#gnunet source tree
+
+import getopt
+import sys
+import os
+import re
+import subprocess
+import tempfile
+import tarfile
+from dependency import Dependency, BinaryObject
+
+#global variables
+gnunet_src = ""
+install_prefix = ""
+package_file = ""
+prefix_given = False
+config_options = list()
+binary_objects = list()
+#dependency cache
+dependencies = dict()
+
+def usage():
+    """Print helpful usage information."""    
+    print """
+Usage: package.py [options] /path/to/gnunet/source package-file
+This script compiles and builds given gnunet source tree. It then attempts to 
+install it and packs the installed files along with their dependencies into
+package-file
+
+Options:
+    -h, --help        : prints this message
+    -i                : treat the given path as a location where gnunet is
+                        already installed and package the objects in that path
+    -c "option"       : options that are to be passed to configure script in 
the
+                        given source tree. Multiple number of such options can 
+                        be specified. These must be enclosed in double quotes. 
+                        E.g: -c "--prefix=/opt/gnunet" 
+                             -c "--with-extractor=/opt/Extractor"
+                        
+"""
+
+def run_configure():
+    """Runs configure on the given source tree."""
+    
+    #Clean the directory; it may fail if there is no makefile - ignore it
+    proc = subprocess.Popen(["make", "clean"])
+    proc.wait()
+    
+    #if ./configure is not present run bootstrap
+    if not os.path.isfile("./configure"):
+        proc = subprocess.Popen("",bufsize=-1, executable="./bootstrap");
+        if 0 != proc.wait():
+            print "Bootstrapping failed! Exiting."
+            sys.exit(1)
+    
+    #Ideally, by now we should have generated ./configure
+    if os.access("./configure", os.R_OK|os.X_OK):
+        config_options.insert(0, "./configure")
+        
+        if not prefix_given:
+            config_options.insert(1 ,"--prefix=" + install_prefix)
+        
+        proc = subprocess.Popen(config_options, bufsize = -1)
+        if 0 != proc.wait():
+            print "Configure on the given source tree failed"
+            sys.exit(1)
+            
+def run_make():
+    """Runs make on the given source tree."""
+    proc = subprocess.Popen("make", bufsize = -1)
+    if 0 != proc.wait():
+        print "Cannot build the source tree. make failed"
+        sys.exit(1)
+        
+def run_make_install():
+    """Installs the compiled binaries in the given source tree by running make
+    installdep_str += "-1:" if dep.minor == None else dep.minor + ":"
+    """
+    proc = subprocess.Popen(["make", "install"], bufsize = -1)
+    if 0 != proc.wait():
+        print "Failed while installing the compiled binaries."
+        sys.exit(1)
+        
+def strip(str):
+    """ helper function to strip any trailing characters."""
+    return str.strip()
+
+def extract_deps(ldd_line):
+    """ extracts the path of the dependency from ldd's output line."""
+    tokens = map (strip, ldd_line.split(' => '))
+    tokens[-1] = tokens[-1].rsplit(' ', 1)[0]
+    return tokens
+    
+def get_deps(install_dir):
+    """Extract dependencies from ldd output."""
+    regex = 
re.compile(".*\.so\.(?P<major>\d+)(?:\.(?P<minor>\d+))?(?:\.(?P<rev>\d+))?$")
+    for root, dirs, files in os.walk(install_dir):
+        for file in files:
+            file_path = os.path.join(root, file)
+            #ignore symbolic links if they point to something inside 
install_dir
+            if (os.path.islink(file_path) and
+                len(os.path.commonprefix([file_path, root])) >= 
+                len(install_dir)):
+                continue
+            
+            proc = subprocess.Popen(["ldd", file_path],
+                                    bufsize = -1, stdout = subprocess.PIPE)
+            (proc_stdout, proc_stderr) = proc.communicate()
+            proc.stdout.close()
+            if 0 != proc.returncode:
+                continue
+            #create a new BinaryObject instance and collect its dependencies
+            bin_object = BinaryObject(root[len(install_dir) + 1:] + '/' + file)
+            
+            for dep_data in map (extract_deps, proc_stdout.splitlines()):
+                #we cannot find a library without its location
+                if dep_data[-1][0] == '(':
+                    continue
+                #create a new dependency object and add it to the set
+                dep = Dependency(dep_data[0], dep_data[-1])
+                #check in cache if we already saw this dependency
+                if dep not in dependencies:
+                    #Retrieve major number of the dependency
+                    match = regex.match(dep_data[-1])
+                    if match:
+                        match2 = None
+                        if os.path.islink(dep_data[-1]):
+                            match2 = 
regex.match(os.path.realpath(dep_data[-1]))
+                            
+                        (dep.major, 
+                         dep.minor, 
+                         dep.rev) = match2.groups() if match2 \
+                                                    else match.groups()
+                    else:
+                        raise Exception('Unhandled discrepancy.')
+                    
+                    dependencies[dep] = dep
+                else:
+                    dep = dependencies[dep]
+                bin_object.add_dependency(dep)
+            #Add the binary object to the global list of binary objects
+            binary_objects.append(bin_object)
+
+def test_dependency_collection():
+    """Function to check whether we are collecting dependencies correctly."""
+    for bin_object in binary_objects:
+        print bin_object.name
+        deps = bin_object.get_dependencies()
+        for dep in deps:
+            print "|--" + dep.name + " (" + dep.path + ")"
+            
+def run(action):
+    """control procedure."""
+    #change the directory to gnunet_src
+    if "build" == action:
+        current_dir = os.getcwd()
+        os.chdir(gnunet_src)
+        run_configure()
+        run_make()
+        run_make_install()
+        os.chdir(current_dir)
+        get_deps(install_prefix)
+    else :
+        get_deps(gnunet_src)
+    test_dependency_collection()
+
+    metadata_file = tempfile.NamedTemporaryFile()
+    
+    for binary_object in binary_objects:
+        metadata_file.file.writelines(binary_object.dependency_listlines())
+    
+    #package the installed files
+    tar_file = tarfile.open(package_file + ".tgz", 'w:gz')
+    tar_file.add(install_prefix, "install-prefix")
+    
+    #add the metadata file to tar
+    metadata_file.file.flush()
+    tar_file.add(metadata_file.name, "metadata.dat")
+    
+    print "Here are the dependencies:"
+    for dep in dependencies:
+        print dep.name
+        if os.path.islink(dep.path):
+            dep_realpath = os.path.realpath(dep.path)
+            print "|--" + dep_realpath
+            tar_file.add(dep_realpath, 
+                         "dependencies/" + os.path.basename(dep_realpath))
+        
+    if (not prefix_given) and "build" == action:
+        #FIXME: May be delete the temporary directory after packing?
+        print "gnunet has been installed into the temp dir: " + install_prefix
+        
+    tar_file.close()
+    metadata_file.close()
+        
+def main():
+    """Starting point of execution."""
+    global prefix_given
+    global gnunet_src
+    global install_prefix
+    global package_file
+    
+    #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(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

Deleted: gnunet-update/package.py
===================================================================
--- gnunet-update/package.py    2011-10-27 16:10:59 UTC (rev 17814)
+++ gnunet-update/package.py    2011-10-27 17:32:56 UTC (rev 17815)
@@ -1,317 +0,0 @@
-#!/usr/bin/python
-# This file is part of GNUnet.
-# (C) 2001--2011 Christian Grothoff (and other contributing authors)
-#
-# GNUnet is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2, or (at your
-# option) any later version.
-#
-# GNUnet is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with GNUnet; see the file COPYING.  If not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-#
-#File:     package.py
-#Author:   Sree Harsha Totakura
-#
-#TODO:
-#
-#Thoughts:
-#            
-
-#python script to build, install and package along with dependencies the given
-#gnunet source tree
-
-import getopt
-import sys
-import os
-import re
-import subprocess
-import tempfile
-import tarfile
-from operator import xor
-from xml.dom.minidom import Document
-
-#global variables
-gnunet_src = ""
-install_prefix = ""
-package_file = ""
-prefix_given = False
-config_options = list()
-binary_objects = list()
-#dependency cache
-dependencies = dict()
-
-    
-class Dependency:
-    """Class for holding data for a dependency"""
-    major = minor = rev = None   
-    def __init__(self, name, path):
-        """Creates a new dependency object with name and path."""
-        self.name = name
-        self.path = path
-    
-    def __eq__(self, other):
-        """Compares two dependency objects. Returns True if both have same name
-        and path, false otherwise.
-        """
-        return (self.name == other.name and self.path == other.path)        
-        
-    def __hash__(self):
-        """Calculates the hashes of name and path. Returns XOR of hashes."""
-        return xor(hash(self.name), hash(self.path))
-
-
-class BinaryObject:
-    """Class representing executable code."""
-    
-    def __init__(self, name):
-        """Returns am instance of BinaryObject."""
-        self.name = name
-        self._deps = list()
-        
-    def add_dependency(self, dep):
-        """Adds dep object to the list of dependencies."""
-        self._deps.append(dep)
-        
-    def get_dependencies(self):
-        """Return the list of dependencies."""
-        return self._deps
-    
-    def _dependency_ascii(self, dep):
-        """Given a dependency, returns an ascii line describing it."""
-        dep_str = self.name + ";" + dep.name + ";"
-        dep_str += "-1:" if dep.major == None else dep.major + ":"
-        dep_str += "-1:" if dep.minor == None else dep.minor + ":"
-        dep_str += "-1" if dep.rev == None else dep.rev
-        return dep_str + "\n"
-    
-    def dependency_listlines(self):
-        """Return list of lines which describe all dependencies."""
-        return map(self._dependency_ascii, self._deps)
-
-
-def usage():
-    """Print helpful usage information."""    
-    print """
-Usage: package.py [options] /path/to/gnunet/source package-file
-This script compiles and builds given gnunet source tree. It then attempts to 
-install it and packs the installed files along with their dependencies into
-package-file
-
-Options:
-    -h, --help        : prints this message
-    -i                : treat the given path as a location where gnunet is
-                        already installed and package the objects in that path
-    -c "option"       : options that are to be passed to configure script in 
the
-                        given source tree. Multiple number of such options can 
-                        be specified. These must be enclosed in double quotes. 
-                        E.g: -c "--prefix=/opt/gnunet" 
-                             -c "--with-extractor=/opt/Extractor"
-                        
-"""
-
-def run_configure():
-    """Runs configure on the given source tree."""
-    
-    #Clean the directory; it may fail if there is no makefile - ignore it
-    proc = subprocess.Popen(["make", "clean"])
-    proc.wait()
-    
-    #if ./configure is not present run bootstrap
-    if not os.path.isfile("./configure"):
-        proc = subprocess.Popen("",bufsize=-1, executable="./bootstrap");
-        if 0 != proc.wait():
-            print "Bootstrapping failed! Exiting."
-            sys.exit(1)
-    
-    #Ideally, by now we should have generated ./configure
-    if os.access("./configure", os.R_OK|os.X_OK):
-        config_options.insert(0, "./configure")
-        
-        if not prefix_given:
-            config_options.insert(1 ,"--prefix=" + install_prefix)
-        
-        proc = subprocess.Popen(config_options, bufsize = -1)
-        if 0 != proc.wait():
-            print "Configure on the given source tree failed"
-            sys.exit(1)
-            
-def run_make():
-    """Runs make on the given source tree."""
-    proc = subprocess.Popen("make", bufsize = -1)
-    if 0 != proc.wait():
-        print "Cannot build the source tree. make failed"
-        sys.exit(1)
-        
-def run_make_install():
-    """Installs the compiled binaries in the given source tree by running make
-    installdep_str += "-1:" if dep.minor == None else dep.minor + ":"
-    """
-    proc = subprocess.Popen(["make", "install"], bufsize = -1)
-    if 0 != proc.wait():
-        print "Failed while installing the compiled binaries."
-        sys.exit(1)
-        
-def strip(str):
-    """ helper function to strip any trailing characters."""
-    return str.strip()
-
-def extract_deps(ldd_line):
-    """ extracts the path of the dependency from ldd's output line."""
-    tokens = map (strip, ldd_line.split(' => '))
-    tokens[-1] = tokens[-1].rsplit(' ', 1)[0]
-    return tokens
-    
-def get_deps(install_dir):
-    """Extract dependencies from ldd output."""
-    regex = 
re.compile(".*\.so\.(?P<major>\d+)(?:\.(?P<minor>\d+))?(?:\.(?P<rev>\d+))?$")
-    for root, dirs, files in os.walk(install_dir):
-        for file in files:
-            file_path = os.path.join(root, file)
-            #ignore symbolic links if they point to something inside 
install_dir
-            if (os.path.islink(file_path) and
-                len(os.path.commonprefix([file_path, root])) >= 
-                len(install_dir)):
-                continue
-            
-            proc = subprocess.Popen(["ldd", file_path],
-                                    bufsize = -1, stdout = subprocess.PIPE)
-            (proc_stdout, proc_stderr) = proc.communicate()
-            proc.stdout.close()
-            if 0 != proc.returncode:
-                continue
-            #create a new BinaryObject instance and collect its dependencies
-            bin_object = BinaryObject(root[len(install_dir) + 1:] + '/' + file)
-            
-            for dep_data in map (extract_deps, proc_stdout.splitlines()):
-                #we cannot find a library without its location
-                if dep_data[-1][0] == '(':
-                    continue
-                #create a new dependency object and add it to the set
-                dep = Dependency(dep_data[0], dep_data[-1])
-                #check in cache if we already saw this dependency
-                if dep not in dependencies:
-                    #Retrieve major number of the dependency
-                    match = regex.match(dep_data[-1])
-                    if match:
-                        match2 = None
-                        if os.path.islink(dep_data[-1]):
-                            match2 = 
regex.match(os.path.realpath(dep_data[-1]))
-                            
-                        (dep.major, 
-                         dep.minor, 
-                         dep.rev) = match2.groups() if match2 \
-                                                    else match.groups()
-                    else:
-                        raise Exception('Unhandled discrepancy.')
-                    
-                    dependencies[dep] = dep
-                else:
-                    dep = dependencies[dep]
-                bin_object.add_dependency(dep)
-            #Add the binary object to the global list of binary objects
-            binary_objects.append(bin_object)
-
-def test_dependency_collection():
-    """Function to check whether we are collecting dependencies correctly."""
-    for bin_object in binary_objects:
-        print bin_object.name
-        deps = bin_object.get_dependencies()
-        for dep in deps:
-            print "|--" + dep.name + " (" + dep.path + ")"
-            
-def run(action):
-    """control procedure."""
-    #change the directory to gnunet_src
-    if "build" == action:
-        current_dir = os.getcwd()
-        os.chdir(gnunet_src)
-        run_configure()
-        run_make()
-        run_make_install()
-        os.chdir(current_dir)
-        get_deps(install_prefix)
-    else :
-        get_deps(gnunet_src)
-    test_dependency_collection()
-
-    metadata_file = tempfile.NamedTemporaryFile()
-    
-    for binary_object in binary_objects:
-        metadata_file.file.writelines(binary_object.dependency_listlines())
-    
-    #package the installed files
-    tar_file = tarfile.open(package_file + ".tgz", 'w:gz')
-    tar_file.add(install_prefix, "install-prefix")
-    
-    #add the metadata file to tar
-    metadata_file.file.flush()
-    tar_file.add(metadata_file.name, "metadata.dat")
-    
-    print "Here are the dependencies:"
-    for dep in dependencies:
-        print dep.name
-        if os.path.islink(dep.path):
-            dep_realpath = os.path.realpath(dep.path)
-            print "|--" + dep_realpath
-            tar_file.add(dep_realpath, 
-                         "dependencies/" + os.path.basename(dep_realpath))
-        
-    if (not prefix_given) and "build" == action:
-        #FIXME: May be delete the temporary directory after packing?
-        print "gnunet has been installed into the temp dir: " + install_prefix
-        
-    tar_file.close()
-    metadata_file.close()
-        
-def main():
-    """Starting point of execution."""
-    global prefix_given
-    global gnunet_src
-    global install_prefix
-    global package_file
-    
-    #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(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]