commit-gnue
[Top][All Lists]
Advanced

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

gnue-common INSTALL setup.cfg.in setup.py


From: Reinhard Mueller
Subject: gnue-common INSTALL setup.cfg.in setup.py
Date: Thu, 25 Sep 2003 18:17:41 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-common
Branch:         
Changes by:     Reinhard Mueller <address@hidden>       03/09/25 18:17:41

Modified files:
        .              : INSTALL setup.cfg.in setup.py 

Log message:
        setup.py now creates gnue.py in Python's default site directory.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/INSTALL.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/setup.cfg.in.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/setup.py.diff?tr1=1.68&tr2=1.69&r1=text&r2=text

Patches:
Index: gnue-common/INSTALL
diff -c gnue-common/INSTALL:1.6 gnue-common/INSTALL:1.7
*** gnue-common/INSTALL:1.6     Sun May 18 11:01:29 2003
--- gnue-common/INSTALL Thu Sep 25 18:17:41 2003
***************
*** 2,10 ****
  
    ./setup.py install
  
    for help:
  
!   ./setup.py --help
  
  On *nix based machine
    Switch to  the etc directory under your install directory.
--- 2,18 ----
  
    ./setup.py install
  
+   for packagers we recommend
+ 
+   ./setup.py install --prefix /usr --install-lib /usr/lib/gnue --root ...
+ 
    for help:
  
!   ./setup.py install --help
! 
!   If you don't have write access to Python's standard directory for
!   site-specific packages (/usr/lib/pythonx.y/site-packages on Posix systems),
!   you will get a message that you have to set the PYTHONPATH variable. Do it.
  
  On *nix based machine
    Switch to  the etc directory under your install directory.
***************
*** 29,32 ****
    You should also rename sample.connections.conf to connections.conf and edit 
it to 
    reflect the databases you wish to access frequently.
  
!   See doc/Connections.txt for more information
\ No newline at end of file
--- 37,40 ----
    You should also rename sample.connections.conf to connections.conf and edit 
it to 
    reflect the databases you wish to access frequently.
  
!   See doc/Connections.txt for more information
Index: gnue-common/setup.cfg.in
diff -c gnue-common/setup.cfg.in:1.3 gnue-common/setup.cfg.in:1.4
*** gnue-common/setup.cfg.in:1.3        Wed Jan  1 19:45:41 2003
--- gnue-common/setup.cfg.in    Thu Sep 25 18:17:41 2003
***************
*** 1,3 ****
--- 1,4 ----
+ # GNU Enterprise - Setup configuration for default installation
  #
  # Copyright 2001-2003 Free Software Foundation
  #
***************
*** 17,44 ****
  # License along with program; see the file COPYING. If not,
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
- #
  
  [install]
  
  
! # Where to install GNUe's application files...
! prefix = /usr/local/gnue
! 
! # Where to install GNUe executable symlinks...
! exec_prefix = /usr/local/bin
! 
! 
! 
! ###############################################
! #
! # We recommend you do not change anything below
! # this line unless you know what you are doing
! #
! ###############################################
! 
! install_lib=%(prefix)s/lib/python
! install_data=%(prefix)s
! install_scripts=%(exec_prefix)s
! 
! 
--- 18,28 ----
  # License along with program; see the file COPYING. If not,
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  
  [install]
  
+ # base directory for the installation
+ home = /usr/local/gnue
  
! # we install the scripts in /usr/local/bin so they are in $PATH
! install_scripts = /usr/local/bin
Index: gnue-common/setup.py
diff -c gnue-common/setup.py:1.68 gnue-common/setup.py:1.69
*** gnue-common/setup.py:1.68   Thu Sep 25 16:25:13 2003
--- gnue-common/setup.py        Thu Sep 25 18:17:41 2003
***************
*** 26,33 ****
--- 26,36 ----
  import os
  
  from distutils.core import setup
+ from distutils.util import change_root
+ from distutils.sysconfig import get_python_lib
  from distutils.command.build import build
  from distutils.command.install import install
+ from distutils.command.install_lib import install_lib
  from setupext import Data_Files, install_Data_Files
  
  from src import PACKAGE, VERSION
***************
*** 88,93 ****
--- 91,102 ----
      pass
  
  # 
-----------------------------------------------------------------------------
+ # Save sys.path for later
+ # 
-----------------------------------------------------------------------------
+ 
+ orig_sys_path = list (sys.path)         # list () is needed to make a copy
+ 
+ # 
-----------------------------------------------------------------------------
  # Build files to be distributed and installed
  # 
-----------------------------------------------------------------------------
  
***************
*** 302,308 ****
        fout.close()
  
    # 
---------------------------------------------------------------------------
!   # Do it all - this is called by setu () if option install is given
    # 
---------------------------------------------------------------------------
  
    def finalize_options (self):
--- 311,317 ----
        fout.close()
  
    # 
---------------------------------------------------------------------------
!   # Do it all - this is called by setup () if option install is given
    # 
---------------------------------------------------------------------------
  
    def finalize_options (self):
***************
*** 323,328 ****
--- 332,378 ----
  
      self._generate_scripts (path_line, config_line)
  
+ # 
=============================================================================
+ # After installation of lib, create gnue.py in python's search path
+ # 
=============================================================================
+ 
+ class gnue_install_lib (install_lib):
+ 
+   def run (self):
+     install_lib.run (self)
+ 
+     # we need gnue.py only if we don't install in python's search path
+     if self.install_dir not in orig_sys_path:
+       # --root parameter
+       root = self.get_finalized_command("install").root
+       # the location we have to add to the search path
+       inst_dir = self.install_dir
+       # where to install gnue.py
+       site_dir = get_python_lib ()
+       if root:
+         # remove --root from installation directory
+         inst_dir = inst_dir [len(root):]
+         # add --root to target directory for gnue.py
+         site_dir = change_root (root, site_dir)
+       # especially if we have --root, the directory might not exist
+       if not os.path.isdir (site_dir):
+         os.makedirs (site_dir)
+       file = os.path.join (site_dir, "gnue.py")
+       # now create the file
+       try:
+         output = open (file, "w")
+         output.write ("# This file was generated during installation.\n")
+         output.write ("import sys\n")
+         output.write ("sys.path.insert (0, \"%s\")\n" % inst_dir)
+         output.write ("del sys.modules [\"gnue\"]\n")
+         output.write ("import gnue")
+         output.close ()
+       except:
+         # file could not be created:
+         # simply restore original sys.path so the warning appears at the end
+         # of the installation
+         sys.path = orig_sys_path
+ 
  # 
-----------------------------------------------------------------------------
  # GNUE_VERSION_SUFFIX handling
  # 
-----------------------------------------------------------------------------
***************
*** 389,394 ****
--- 439,445 ----
         # Override certain command classes with our own ones
         cmdclass = {"build": gnue_build,
                     "install": gnue_install,
+                    "install_lib": gnue_install_lib,
                     "install_data": install_Data_Files},
  
         data_files = dfiles,




reply via email to

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