commit-gnue
[Top][All Lists]
Advanced

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

gnue-appserver setup.py


From: Reinhard Mueller
Subject: gnue-appserver setup.py
Date: Thu, 18 Sep 2003 18:35:59 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue-appserver
Branch:         
Changes by:     Reinhard Mueller <address@hidden>       03/09/18 18:35:59

Modified files:
        .              : setup.py 

Log message:
        Much work on setup procedure.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-appserver/setup.py.diff?tr1=1.14&tr2=1.15&r1=text&r2=text

Patches:
Index: gnue-appserver/setup.py
diff -c gnue-appserver/setup.py:1.14 gnue-appserver/setup.py:1.15
*** gnue-appserver/setup.py:1.14        Tue Sep 16 17:58:25 2003
--- gnue-appserver/setup.py     Thu Sep 18 18:35:59 2003
***************
*** 21,27 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: setup.py,v 1.14 2003/09/16 21:58:25 reinhard Exp $
  
  import sys
  import string
--- 21,27 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # $Id: setup.py,v 1.15 2003/09/18 22:35:59 reinhard Exp $
  
  import sys
  import string
***************
*** 29,34 ****
--- 29,37 ----
  import os.path
  import copy
  
+ from distutils.core import setup
+ from distutils.command.build_scripts import build_scripts
+ 
  from src import PACKAGE, VERSION
  
  # 
-----------------------------------------------------------------------------
***************
*** 37,218 ****
  
  if sys.hexversion < 0x02010000:
    print "%s needs at least Python version 2.1" % PACKAGE
!   sys.exit()
  
  # 
-----------------------------------------------------------------------------
  # distutils won't allow us to set absolute path prefix on windows
  # 
-----------------------------------------------------------------------------
  
! if not 'sdist' in sys.argv:
!   if sys.platform != 'win32':
!     os.system ("""cp setup.cfg.in setup.cfg""")
!   else:
!     try:
!       os.remove('setup.cfg')
!     except:
!       pass
! 
! # 
-----------------------------------------------------------------------------
! # Initalize stuff
! # 
-----------------------------------------------------------------------------
! 
! from distutils.core import setup
! from distutils.command.build_scripts import build_scripts
! 
! docfiles = None
! manfiles = None
! 
! # 
-----------------------------------------------------------------------------
! # sdist (Source distribution): build docs
! # 
-----------------------------------------------------------------------------
! 
! if 'sdist' in sys.argv:
!   print """
! We are going to create the docs needed for the
! source distro.  You'll need texinfo installed.
! """
!   raw_input ("Press Control-D to abort or any other key to continue")
!   os.system ("""
! cd doc/api
! make html
! make txt
! make pdf
! cd ../whitepaper
! make html
! make txt
! make pdf
! """)
! 
!   print "Now, we are going to create the man pages for our tools."
!   os.system( """
! if [ ! -e man ]
! then
! mkdir man
! fi
! cd man
! ../scripts/gacvs --generate-man-page
! """)
  
  # 
-----------------------------------------------------------------------------
  # build and install: Check dependencies
  # 
-----------------------------------------------------------------------------
  
! if ('build' in sys.argv) or ('install' in sys.argv):
! 
!   ## TODO: These checks will not work as gnue.common
!   ## TODO: isn't in python's default search path.
! 
! #  # Verify that gnue-common is installed
! #  try:
! #    print "Checking for GNUe-Common....",
! #    from gnue import common
! #    if common.__dict__.has_key('VERSION'):
! #      print "OK (version %s)" % common.VERSION
! #    else:
! #      print "OK"
! #  except ImportError:
! #    print """
! #You will need to install gnue-common before
! #GNUe Application Server will function.  You can
! #obtain a copy from
! #
! #http://www.gnuenterprise.org/download.php
! #"""
! #    sys.exit()
! #
! #  # Verify that gnue-common has newest dbdriver/appserver
! #  try:
! #    print "Checking for dbdriver/appserver....",
! #    from gnue.common.dbdrivers.appserver import DBdriver
! #    print "OK (version %s)" % DBdriver.VERSION
! #
! #  except ImportError:
! #    print """
! #You will need to install newer version of gnue-common before
! #GNUe Application Server will function.  You can
! #obtain a copy from
! #
! #http://www.gnuenterprise.org/download.php
! #(You need at least version 0.2.0)
! #"""
! #    sys.exit()
! #
  
  
-   #
    # Verify at least one RPC driver is installed
-   #
    RPCOK = 0
  
!   print "Checking for available GNU-RPC drivers...."
!   # XMLRPC
    try:
-     print "   PY-XMLRPC....",
      import xmlrpc
-     print "OK"
      RPCOK = 1
    except ImportError:
!     print "No"
  
!   # PW_XMLRPC
    try:
!     print "   Pythonware XMLRPC....",
!     try:
!       import xmlrpclib
!     except ImportError:
!       from xmlrpclib import xmlrpclib
!     print "OK"
      RPCOK = 1
    except ImportError:
!     print "No"
! 
!   # SOAP
!   try:
!     print "   SOAP (currently not working)....",
!     from SOAP import SOAP
!     print "OK"
!     RPCOK = 1
!   except ImportError:
!     print "No"
! 
  
    if RPCOK != 1:
      print """
! No valid GNURRPC drivers are installed on this machine:
!    Py-XMLRPC         - http://sourceforge.net/projects/py-xmlrpc
!    Pythonware XMLRPC - http://www.pythonware.com/products/xmlrpc/
!    SOAP              - ***
!    CORBA             - ***
  """
!     sys.exit()
  
!   # List non-program files to be installed
! 
!   docfiles = ['README', 'INSTALL', 'AUTHORS', 'COPYING', 'NEWS', 'THANKS']
!   for file in ('doc/api/api.html',
!                'doc/api/api.txt',
!                'doc/api/api.pdf',
!                'doc/whitepaper/whitepaper.html',
!                'doc/whitepaper/whitepaper.txt',
!                'doc/whitepaper/whitepaper.pdf'):
!     if os.path.isfile(file):
!       docfiles.append(file)
!     else:
!       print "WARNING: File %s does not exist... not installing!" % file
! 
!   manfiles = []
!   for file in ('man/gnue-appserver.1'):
!     if os.path.isfile(file):
!       manfiles.append(file)
!     else:
!       print "WARNING: File %s does not exist... not installing!" % file
  
  # 
-----------------------------------------------------------------------------
! # Site config stuff
  # 
-----------------------------------------------------------------------------
  
  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)
--- 40,175 ----
  
  if sys.hexversion < 0x02010000:
    print "%s needs at least Python version 2.1" % PACKAGE
!   sys.exit (1)
  
  # 
-----------------------------------------------------------------------------
  # distutils won't allow us to set absolute path prefix on windows
  # 
-----------------------------------------------------------------------------
  
! if "install" in sys.argv or "bdist_rpm" in sys.argv:
!   if sys.platform != "win32":
!     os.system ("cp setup.cfg.in setup.cfg")
! 
! # 
-----------------------------------------------------------------------------
! # sdist (Source distribution): build documentation, SQL scripts and manpage
! # 
-----------------------------------------------------------------------------
! 
! if "sdist" in sys.argv:
!   # First check if we have everything installed we need to build the
!   # distribution
! 
!   # Texinfo
!   if os.system ("makeinfo --version > /dev/null") != 0:
!     print "Could not find 'makeinfo'. Please install Texinfo 4.0 or greater."
!     sys.exit (1)
! 
!   # create-technote-index from gnue-common/utils
!   file = "../gnue-common/utils/create-technote-index.py"
!   if not os.path.isfile (file):
!     print "Could not find file '%s'." % file
!     print "Please download gnue-common 0.5.0 or greater."
!     sys.exit (1)
! 
!   # Sablotron
!   if os.system ("sabcmd --version > /dev/null") != 0:
!     print "Could not find 'sabcmd'. Please install Sablotron."
!     sys.exit (1)
! 
!   # xsl scripts from gnue-common/utils/xml2sql
!   for cmd in ["pgsql", "mysql", "mssql", "sybase", "interbase", "display",
!               "strip.command"]:
!     file = "../gnue-common/utils/xml2sql/%s.xsl" % cmd
!     if not os.path.isfile (file):
!       print "Could not find file '%s'." % file
!       print "Please download gnue-common 0.5.0 or greater."
!       sys.exit (1)
! 
!   # is gacvs available (to build man pages)?
!   if not os.path.isfile ("scripts/gacvs"):
!     print "Could not find file 'scripts/gacvs'.  Please run 'setup-cvs.py'."
!     sys.exit (1)
! 
!   # 
---------------------------------------------------------------------------
! 
!   # Build documentation
!   print "building documentation: doc/api"
!   if os.system ("cd doc/api && make txt") != 0:
!     sys.exit (1)
! 
!   print "building documentation: doc/whitepaper"
!   if os.system ("cd doc/whitepaper && make txt") != 0:
!     sys.exit (1)
! 
!   print "building documentation: doc/technotes"
!   if os.system ("cd doc/technotes && make") != 0:
!     sys.exit (1)
! 
!   # Build sample SQL scripts
!   print "building sample sql scripts"
!   if os.system ("cd samples && make") != 0:
!     sys.exit (1)
! 
!   # Build man page
!   print "building man page"
!   if os.system ("mkdir -p man && cd man " \
!                 + "&& ../scripts/gacvs --generate-man-page") != 0:
!     sys.exit (1)
  
  # 
-----------------------------------------------------------------------------
  # build and install: Check dependencies
  # 
-----------------------------------------------------------------------------
  
! if ("build" in sys.argv) or ("install" in sys.argv):
  
+   # xml
+   try:
+     print "checking Python xml library"
+     import xml
+   except ImportError:
+     print "Could not import the xml package.  " \
+           + "Please install Python's XML library."
+     print "The file 'INSTALL' contains more information about dependencies."
+     sys.exit (1)
  
    # Verify at least one RPC driver is installed
    RPCOK = 0
  
!   # xmlrpc
!   print "checking Python xmlrpc library (py-xmlrpc)"
    try:
      import xmlrpc
      RPCOK = 1
    except ImportError:
!     pass
  
!   # pw_xmlrpc
!   print "checking Python xmlrpclib library (pw-xmlrpc)"
    try:
!     import xmlrpclib
      RPCOK = 1
    except ImportError:
!     pass
  
+   # found any?
    if RPCOK != 1:
      print """
! No valid GNURRPC drivers are installed on this machine.
! Please install one of the following packages.
!    py-xmlrpc         - http://sourceforge.net/projects/py-xmlrpc
!    Pythonware XMLRPC - http://www.pythonware.com/products/xmlrpc
! The file 'INSTALL' contains more information about dependencies.
  """
!     sys.exit (1)
  
!   # gnue-common
!   # TODO: Can't find out here where gnue-common is installed
  
  # 
-----------------------------------------------------------------------------
! # Some magic to create $script from $script.in while installing
  # 
-----------------------------------------------------------------------------
  
  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)
***************
*** 228,249 ****
      if self.finalized:
        return
  
! 
!     if sys.platform != 'win32':
!       dict = self.distribution.get_option_dict("install")
!       install_prefix = dict['prefix'][1]
! 
        gnue_env = \
             "#######\n" \
           + "# The following variable were set when GNUe was installed\n" \
           + "import os, sys\n" \
!          + "sys.path.append('%s')\n" % dict['install_lib'][1] \
!          + "INST_GNUE_CONNECTIONS='%s/etc/connections.conf'\n" % 
dict['prefix'][1] \
!          + "os.environ['INSTALL_LIB']='%s'\n" % dict['install_lib'][1] \
!          + "os.environ['INSTALL_PREFIX']='%s'\n" % dict['prefix'][1] \
           + config_line \
           + "#######\n"
      else:
        gnue_env = \
                 "#######\n" \
               + "# The following variables were set when GNUe was installed\n" 
   \
--- 185,206 ----
      if self.finalized:
        return
  
!     if sys.platform != "win32":
!       dict = self.distribution.get_option_dict ("install")
!       install_prefix = dict ["prefix"] [1]
!       sys.path.append (dict ["install_lib"] [1])
        gnue_env = \
             "#######\n" \
           + "# The following variable were set when GNUe was installed\n" \
           + "import os, sys\n" \
!          + "sys.path.append('%s')\n" % dict["install_lib"][1] \
!          + "INST_GNUE_CONNECTIONS='%s/etc/connections.conf'\n" % 
dict["prefix"][1] \
!          + "os.environ['INSTALL_LIB']='%s'\n" % dict["install_lib"][1] \
!          + "os.environ['INSTALL_PREFIX']='%s'\n" % dict["prefix"][1] \
           + config_line \
           + "#######\n"
      else:
+       options.append('install_lib = r"%s"' % sys.prefix)
        gnue_env = \
                 "#######\n" \
               + "# The following variables were set when GNUe was installed\n" 
   \
***************
*** 295,301 ****
  # and the packages will be created as GNUe-App-0.x.x-pre1.tar.gz
  
  try:
!   suffix = os.environ['GNUE_VERSION_SUFFIX']
  except KeyError:
    suffix = ""
  
--- 252,258 ----
  # and the packages will be created as GNUe-App-0.x.x-pre1.tar.gz
  
  try:
!   suffix = os.environ["GNUE_VERSION_SUFFIX"]
  except KeyError:
    suffix = ""
  
***************
*** 303,350 ****
  # Call the actual setup routine
  # 
-----------------------------------------------------------------------------
  
  setup (name = "GNUe-AppServer",
         version = VERSION + suffix,
         description = "GNU Enterprise Application Server",
         long_description = "",
         author = "GNUe Application Server Team",
!        author_email = "address@hidden",
         url = "http://www.gnue.org";,
  
         # Override certain command classes with our own ones
!        cmdclass = {'build_scripts':my_build_scripts},
  
!        data_files = [ ('doc/appserver', docfiles),
!                       ('man/man1', manfiles),
!                       ('samples/appserver',['samples/appservertest.gfd',
!                                   'samples/setup-pgsql.sh',
! #                                  'samples/setup-mysql.sh'
!                               ]),
!                       ('shared/grpc',['grpc/appserver.grpc'])
                         ],
  
         packages = ["gnue.appserver",
                     "gnue.appserver.classrep",
!                    "gnue.appserver.language",],
  
         package_dir = {"gnue.appserver" : "src"},
  
         scripts = ["scripts/gnue-appserver"]
         )
  
! if 'install' in sys.argv:
!     print """
!     Note:
!     Warnings about the files not being installed in pythons search path can 
be ignored.
  
!     Make sure you have a default gnue.conf file (typically in 
/usr/local/gnue/etc.
!     A sample is provided in that directory that you can typically just copy 
over.
!     """
  
  # 
-----------------------------------------------------------------------------
! # Clean up
  # 
-----------------------------------------------------------------------------
  
! if not 'sdist' in sys.argv:
!   if sys.platform != 'win32':
!     os.system (""" /bin/rm -rf setup.cfg""")
--- 260,319 ----
  # Call the actual setup routine
  # 
-----------------------------------------------------------------------------
  
+ docfiles = ["AUTHORS", "COPYING", "INSTALL", "NEWS", "README", "ROADMAP",
+             "THANKS", "TODO", "doc/api/api.txt",
+             "doc/whitepaper/whitepaper.txt"]
+ 
+ manfiles = ["man/gnue-appserver.1"]
+ 
+ samplefiles = ["samples/sample.gfd", "samples/setup-pgsql.sh",
+                "samples/setup-mysql.sh"]
+ 
  setup (name = "GNUe-AppServer",
         version = VERSION + suffix,
         description = "GNU Enterprise Application Server",
         long_description = "",
         author = "GNUe Application Server Team",
!        author_email = "address@hidden",
         url = "http://www.gnue.org";,
  
         # Override certain command classes with our own ones
!        cmdclass = {"build_scripts": my_build_scripts},
  
!        data_files = [ ("doc/appserver", docfiles),
!                       ("man/man1", manfiles),
!                       ("samples/appserver", samplefiles),
!                       ("samples/appserver/interbase",
!                                                
["samples/interbase/full.sql"]),
!                       ("samples/appserver/mssql", ["samples/mssql/full.sql"]),
!                       ("samples/appserver/mysql", ["samples/mysql/full.sql"]),
!                       ("samples/appserver/pgsql", ["samples/pgsql/full.sql"]),
!                       ("samples/appserver/sybase", 
["samples/sybase/full.sql"]),
!                       ("shared/grpc", ["grpc/appserver.grpc"]),
!                       ("lib/python/gnue/appserver/classrep",
!                                                
["src/classrep/repository.ini"])
                         ],
  
         packages = ["gnue.appserver",
                     "gnue.appserver.classrep",
!                    "gnue.appserver.language"],
  
         package_dir = {"gnue.appserver" : "src"},
  
         scripts = ["scripts/gnue-appserver"]
         )
  
! # 
-----------------------------------------------------------------------------
! # Clean up
! # 
-----------------------------------------------------------------------------
  
! if "install" in sys.argv or "bdist_rpm" in sys.argv:
!   if sys.platform != "win32":
!     os.system ("/bin/rm -rf setup.cfg")
  
  # 
-----------------------------------------------------------------------------
! # Be happy
  # 
-----------------------------------------------------------------------------
  
! if "sdist" in sys.argv or "build" in sys.argv or "install" in sys.argv:
!   print "./setup.py successfully completed."




reply via email to

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