commit-gnue
[Top][All Lists]
Advanced

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

gnue/gnue-common setup.py src/GBaseApp.py src/G...


From: Jason Cater
Subject: gnue/gnue-common setup.py src/GBaseApp.py src/G...
Date: Sun, 11 Nov 2001 16:11:29 -0500

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/11/11 16:11:28

Modified files:
        gnue-common    : setup.py 
        gnue-common/src: GBaseApp.py GConnections.py 

Log message:
        no longer bombs if connections.conf not present; fixed setup.py for 
'./setup.py sdist'

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/setup.py.diff?cvsroot=OldCVS&tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GBaseApp.py.diff?cvsroot=OldCVS&tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/GConnections.py.diff?cvsroot=OldCVS&tr1=1.25&tr2=1.26&r1=text&r2=text

Patches:
Index: gnue/gnue-common/setup.py
diff -u gnue/gnue-common/setup.py:1.27 gnue/gnue-common/setup.py:1.28
--- gnue/gnue-common/setup.py:1.27      Sat Nov 10 17:01:43 2001
+++ gnue/gnue-common/setup.py   Sun Nov 11 16:11:28 2001
@@ -164,12 +164,12 @@
        # Override certain command classes with our own ones
        cmdclass = {'install_data':install_Data_Files,
                    'build_scripts':my_build_scripts},
-       scripts = ["scripts/gnuedtd"],
+#       scripts = ["scripts/gnuedtd"],
        data_files = dfiles,
        packages = ["gnue",
                    "gnue.common",
                    "gnue.common.FormatMasks",
-                   "gnue.common.installer",
+#                   "gnue.common.installer",
                    "gnue.common.dbdrivers",
                    "gnue.common.dbdrivers._dbsig",
                    "gnue.common.dbdrivers._empty",
Index: gnue/gnue-common/src/GBaseApp.py
diff -u gnue/gnue-common/src/GBaseApp.py:1.5 
gnue/gnue-common/src/GBaseApp.py:1.6
--- gnue/gnue-common/src/GBaseApp.py:1.5        Mon Oct 22 12:33:20 2001
+++ gnue/gnue-common/src/GBaseApp.py    Sun Nov 11 16:11:28 2001
@@ -8,7 +8,7 @@
 #
 # GNU Enterprise 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 
+# 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 
@@ -113,14 +113,14 @@
           shortoptions = shortoptions + ':'
         longoptions.append(lo)
  
-    try: 
+    try:
       opt, self.ARGUMENTS = getopt.getopt(sys.argv[1:], shortoptions, 
longoptions)
     except getopt.error, msg: 
       self.handleStartupError(msg)
 
     for o in opt: 
       if len(o[1]):
-        self.OPTIONS[lookup[o[0]]] = o[1] 
+        self.OPTIONS[lookup[o[0]]] = o[1]
       else:
         self.OPTIONS[lookup[o[0]]] = 1
 
@@ -133,14 +133,14 @@
 
     # Should we profile?
     self._run = self.run
-    if self.OPTIONS['profile']: 
+    if self.OPTIONS['profile']:
       self.run = self._profile
 
     # Setup debugging
-    try: 
+    try:
       GDebug.setDebug(int("%s" % self.OPTIONS['debug_level']),
           self.OPTIONS['debug_file'])
-    except ValueError: 
+    except ValueError:
       self.handleStartupError('The debug_level option ("-d") expects a 
numerical value.')
 
     GDebug.printMesg(1,"Run Options: %s" % opt)
@@ -149,36 +149,35 @@
     # Read the config files
     if application:
       GConfig.GConfig(application)
-       
+
     # Get the connection definitions
-    if connections != None: 
+    if connections != None:
+      GDebug.printMesg(1,"Reusing connections instance")
       self.connections = connections
-    else: 
-      if self.OPTIONS['connections']: 
+    else:
+      if self.OPTIONS['connections']:
         self.connections_file = self.OPTIONS['connections']
       elif os.environ.has_key('GNUE_CONNECTIONS'):
         self.connections_file = os.environ['GNUE_CONNECTIONS']
-      else: 
+      else:
         self.connections_file = "" # temp
 #        self.handleStartupError(
 #            'Unable to load the connections definition file.\n' \
 #            + '\n   Please set the environmental variable GNUE_CONNECTIONS or 
' \
 #            + '\n   use the "-f" command option.')
-#
+
       GDebug.printMesg(1, 'Connection Definition: "%s"' % 
self.connections_file)
 
-      # TODO: Temporary "if" until we fully implement the connection 
definitions
-      if len(self.connections_file): 
-        try:
-          self.connections = GConnections.GConnections(self.connections_file)
-        except GConnections.InvalidFormatError, msg: 
-          self.handleStartupError(
+      try:
+        self.connections = GConnections.GConnections(self.connections_file)
+      except GConnections.InvalidFormatError, msg:
+        self.handleStartupError(
             'Unable to load the connections definition file.\n' \
             + '\n   The connections file is in an invalid format. ' \
             + '\n   %s' \
                % msg)
-        except:
-          self.handleStartupError(
+      except IOError:
+        self.handleStartupError(
              'Unable to load the connections definition file.\n' \
              + '\n   The connections file specified either does ' \
              + '\n   not exist or is not readable by your account.\n' \
Index: gnue/gnue-common/src/GConnections.py
diff -u gnue/gnue-common/src/GConnections.py:1.25 
gnue/gnue-common/src/GConnections.py:1.26
--- gnue/gnue-common/src/GConnections.py:1.25   Wed Nov  7 21:59:35 2001
+++ gnue/gnue-common/src/GConnections.py        Sun Nov 11 16:11:28 2001
@@ -22,8 +22,8 @@
 # GConnections.py
 #
 # DESCRIPTION:
-# Class that loads connection definition files and maintains 
-# database connections. 
+# Class that loads connection definition files and maintains
+# database connections.
 #
 # NOTES:
 #
@@ -67,21 +67,22 @@
 
     GDebug.printMesg(1,'Conn File: "%s"' % location)
 
-    fileHandle = openResource(location)
+    if len(location):
+      fileHandle = openResource(location)
 
-    try:
-      self._parser.readfp(fileHandle)
-    except DuplicateSectionError:
-      raise InvalidFormatError, \
-         'The connections file has duplicate source definitions.\n\nFile: %s' \
-            % location
-    except MissingSectionError:
-      raise InvalidFormatError, \
-         'The connections file has no source definitions.\n\nFile: %s' \
-            % location
-    except:
-      raise InvalidFormatError, \
-         'The connections file cannot be parsed.\n\nFile: %s' % location
+      try:
+        self._parser.readfp(fileHandle)
+      except DuplicateSectionError:
+        raise InvalidFormatError, \
+           'The connections file has duplicate source definitions.\n\nFile: 
%s' \
+              % location
+      except MissingSectionError:
+        raise InvalidFormatError, \
+           'The connections file has no source definitions.\n\nFile: %s' \
+              % location
+      except:
+        raise InvalidFormatError, \
+           'The connections file cannot be parsed.\n\nFile: %s' % location
 
     self._openConnections = {}
 



reply via email to

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