commit-gnue
[Top][All Lists]
Advanced

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

gnue-common ./setup.py src/apps/GBaseApp.py uni...


From: Reinhard Mueller
Subject: gnue-common ./setup.py src/apps/GBaseApp.py uni...
Date: Fri, 26 Sep 2003 10:24:56 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-common
Branch:         
Changes by:     Reinhard Mueller <address@hidden>       03/09/26 10:24:55

Modified files:
        .              : setup.py 
        src/apps       : GBaseApp.py 
        unittest       : datasource.py 

Log message:
        GNUE_CONNECTIONS and site-config.cfg are no longer needed.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/setup.py.diff?tr1=1.73&tr2=1.74&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/src/apps/GBaseApp.py.diff?tr1=1.38&tr2=1.39&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/unittest/datasource.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gnue-common/setup.py
diff -c gnue-common/setup.py:1.73 gnue-common/setup.py:1.74
*** gnue-common/setup.py:1.73   Fri Sep 26 09:09:19 2003
--- gnue-common/setup.py        Fri Sep 26 10:24:54 2003
***************
*** 126,146 ****
      os.remove ("module/base/paths.py")
    build_files ()
  
- # 
-----------------------------------------------------------------------------
- # User can supply a path to the config file
- # 
-----------------------------------------------------------------------------
- 
- try:
-   index = sys.argv.index('--cfg-file')
-   site_config = os.path.join(os.path.abspath(sys.argv[index+1]))
-   sys.argv.pop(index)
-   sys.argv.pop(index)
-   config_line = "os.environ['GNUE_INSTALLED_SITE_CFG']='%s'\n" % site_config
- 
- except ValueError:
-   site_config = None
-   config_line = ""
- 
  # 
=============================================================================
  # Before build: if done from CVS, build files to be installed
  # 
=============================================================================
--- 126,131 ----
***************
*** 189,198 ****
      pass
  
    # 
---------------------------------------------------------------------------
!   # Create paths.py and site_config.cfg
    # 
---------------------------------------------------------------------------
  
!   def _write_config (self):
  
      output = open ("module/base/paths.py", "w")
      output.write ("# This file was generated during installation.\n")
--- 174,183 ----
      pass
  
    # 
---------------------------------------------------------------------------
!   # Create paths.py
    # 
---------------------------------------------------------------------------
  
!   def _write_paths_py (self):
  
      output = open ("module/base/paths.py", "w")
      output.write ("# This file was generated during installation.\n")
***************
*** 208,287 ****
      output.write ("config = \"%s\"\n" % self.install_config)
      output.close ()
  
-     # 
-------------------------------------------------------------------------
- 
-     dict = self.distribution.get_option_dict ("install")
- 
-     options = []
-     for key in dict.keys():
-       options.append('%s = "%s"' % (key, 
string.replace(str(dict[key][1]),'"','\\"')))
- 
-     if dict.has_key('prefix') and not dict.has_key('install_prefix'):
-       options.append('install_prefix = prefix')
- 
-     output = open("site_config.cfg", "w")
-     output.write("""# IF YOU DON'T KNOW WHAT THIS FILE IS FOR, THEN YOU DON'T 
NEED TO BE HERE
- 
- 
- ##
- ## Python dist-utils options
- ##
- %s
- 
- 
- ##
- ## .. and our settings
- ##
- common_etc = install_prefix + '/etc'
- common_shared = install_prefix + '/shared'
- common_images = common_shared + '/images'
- common_appbase = install_prefix
- 
- # forms_etc = common_etc
- # forms_shared = common_shared
- # forms_images = common_images
- # forms_appbase = common_appbase
- 
- # reports_etc = common_etc
- # reports_shared = common_shared
- # reports_images = common_images
- # reports_appbase = common_appbase
- 
- # designer_etc = common_etc
- # designer_shared = common_shared
- # designer_images = common_images
- 
- ##
- ## ... and package maintainer overrides
- ##
- """ % string.join(options,'\n'))
- 
-     output.close()
- 
-     # Copy site_config.cfg to the given destination
-     if site_config is not None:
-       input = open('site_config.cfg')
-       file = input.readlines()
-       input.close()
-       print "Writing site configuration to %s" % site_config
-       output = open(site_config,'w')
-       output.writelines(file)
-       output.close()
- 
    # 
---------------------------------------------------------------------------
    # Build the commands to place into the scripts
    # 
---------------------------------------------------------------------------
  
!   def _build_gnue_env (self, path_line, config_line):
      if sys.platform != 'win32':
!       gnue_env = \
!         "#######\n" \
!         + "# The following variable were set when GNUe was installed\n" \
!         + "INST_GNUE_CONNECTIONS='%s/etc/connections.conf'\n" % self.prefix \
!         + path_line \
!         + "import os\n" \
!         + config_line \
!         + "#######\n"
      else:
        gnue_env = \
          "#######\n" \
--- 193,205 ----
      output.write ("config = \"%s\"\n" % self.install_config)
      output.close ()
  
    # 
---------------------------------------------------------------------------
    # Build the commands to place into the scripts
    # 
---------------------------------------------------------------------------
  
!   def _build_gnue_env (self):
      if sys.platform != 'win32':
!       gnue_env = ""
      else:
        gnue_env = \
          "#######\n" \
***************
*** 296,306 ****
          + "    os.environ['PATH']= 
os.path.abspath(os.path.dirname(sys.argv[0]))\n" \
          + "else: \n" \
          + "  _BASE = 
os.path.abspath(os.path.join(os.path.dirname(__file__),'..'))\n" \
-         + 
"INST_GNUE_CONNECTIONS=os.path.join(_BASE,'etc','connections.conf')\n" \
          + "os.putenv('PYTHONCASEOK','1')\n" \
          + "if os.path.isdir(os.path.join(_BASE,'extras')):\n" \
          + "  sys.path.append(os.path.join(_BASE,'extras'))\n" \
-         + config_line \
          + "#######\n\n"
      return gnue_env
  
--- 214,222 ----
***************
*** 308,315 ****
    # Generate the real scripts
    # 
---------------------------------------------------------------------------
  
!   def _generate_scripts (self, path_line, config_line):
!     gnue_env = self._build_gnue_env (path_line, config_line)
  
      for script in self.distribution.scripts:
        print "building script %s" % script
--- 224,231 ----
    # Generate the real scripts
    # 
---------------------------------------------------------------------------
  
!   def _generate_scripts (self):
!     gnue_env = self._build_gnue_env ()
  
      for script in self.distribution.scripts:
        print "building script %s" % script
***************
*** 347,363 ****
          self.install_config = os.path.join (self.install_data, "etc")
  
      # if install directory isn't in Python's search path, add it there
!     if self.install_lib in sys.path:
!       path_line = ""
!     else:
        sys.path.append (self.install_lib)
-       path_line = "import sys\nsys.path.append('%s')\n" % self.install_lib
  
!     self._write_config ()
  
      self._check_dependencies ()
  
!     self._generate_scripts (path_line, config_line)
  
  # 
=============================================================================
  # After installation of lib, create gnue.py in python's search path
--- 263,276 ----
          self.install_config = os.path.join (self.install_data, "etc")
  
      # if install directory isn't in Python's search path, add it there
!     if self.install_lib not in sys.path:
        sys.path.append (self.install_lib)
  
!     self._write_paths_py ()
  
      self._check_dependencies ()
  
!     self._generate_scripts ()
  
  # 
=============================================================================
  # After installation of lib, create gnue.py in python's search path
Index: gnue-common/src/apps/GBaseApp.py
diff -c gnue-common/src/apps/GBaseApp.py:1.38 
gnue-common/src/apps/GBaseApp.py:1.39
*** gnue-common/src/apps/GBaseApp.py:1.38       Mon Mar 31 22:23:20 2003
--- gnue-common/src/apps/GBaseApp.py    Fri Sep 26 10:24:55 2003
***************
*** 40,45 ****
--- 40,46 ----
  import ConfigParser
  import gettext
  from gnue.common.utils.TextUtils import lineWrap
+ from gnue import paths
  import locale
  
  # Mac has problems with LC_ALL...
***************
*** 113,119 ****
             _('or a URL location ') + \
             '(http://localhost/connections.conf).' + \
             _('If this option is not specified, the environent variable ') + \
!            _('GNUE_CONNECTIONS is checked.') ],
           [ 'help', None, 'help', 0, None, None,
             _('Displays this help screen.') ],
           [ 'configuration_options', None, 'configuration-options', 0, None, 
None,
--- 114,122 ----
             _('or a URL location ') + \
             '(http://localhost/connections.conf).' + \
             _('If this option is not specified, the environent variable ') + \
!            _('GNUE_CONNECTIONS is checked.') + \
!            _('If neither of them is set, "%s" is used as a default.') %
!              os.path.join (paths.config, "connections.conf")],
           [ 'help', None, 'help', 0, None, None,
             _('Displays this help screen.') ],
           [ 'configuration_options', None, 'configuration-options', 0, None, 
None,
***************
*** 262,268 ****
        elif os.environ.has_key('GNUE_CONNECTIONS'):
          self.connections_file = os.environ['GNUE_CONNECTIONS']
        else:
!         self.connections_file = "" # temp
  #        self.handleStartupError(
  #            _('Unable to load the connections definition file.\n') \
  #            + _('\n   Please set the environmental variable GNUE_CONNECTIONS 
or ') \
--- 265,271 ----
        elif os.environ.has_key('GNUE_CONNECTIONS'):
          self.connections_file = os.environ['GNUE_CONNECTIONS']
        else:
!         self.connections_file = os.path.join (paths.config, 
"connections.conf")
  #        self.handleStartupError(
  #            _('Unable to load the connections definition file.\n') \
  #            + _('\n   Please set the environmental variable GNUE_CONNECTIONS 
or ') \
Index: gnue-common/unittest/datasource.py
diff -c gnue-common/unittest/datasource.py:1.1 
gnue-common/unittest/datasource.py:1.2
*** gnue-common/unittest/datasource.py:1.1      Mon Sep  8 19:52:06 2003
--- gnue-common/unittest/datasource.py  Fri Sep 26 10:24:55 2003
***************
*** 19,31 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: datasource.py,v 1.1 2003/09/08 23:52:06 siesel Exp $
  
  import unittest, os
  
  from gnue.common.datasources import GDataSource, GConnections, GLoginHandler
  # import GBaseApp to setup i18n
  from gnue.common.apps import GConfig,GBaseApp
  
  
  ####################################################################
--- 19,32 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: datasource.py,v 1.2 2003/09/26 14:24:55 reinhard Exp $
  
  import unittest, os
  
  from gnue.common.datasources import GDataSource, GConnections, GLoginHandler
  # import GBaseApp to setup i18n
  from gnue.common.apps import GConfig,GBaseApp
+ from gnue import paths
  
  
  ####################################################################
***************
*** 40,46 ****
      if os.environ.has_key('GNUE_CONNECTIONS'):
          connections_file = os.environ['GNUE_CONNECTIONS']
      else:
!         connections_file = "" 
      try:
          connections = GConnections.GConnections(connections_file)
      except GConnections.InvalidFormatError, msg:
--- 41,47 ----
      if os.environ.has_key('GNUE_CONNECTIONS'):
          connections_file = os.environ['GNUE_CONNECTIONS']
      else:
!         connections_file = os.path.join (paths.config, "connections.conf")
      try:
          connections = GConnections.GConnections(connections_file)
      except GConnections.InvalidFormatError, msg:




reply via email to

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