commit-gnue
[Top][All Lists]
Advanced

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

gnue gnue-common/setup.cfg.in gnue-common/setup...


From: Jason Cater
Subject: gnue gnue-common/setup.cfg.in gnue-common/setup...
Date: Mon, 08 Oct 2001 23:02:57 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    01/10/08 23:02:57

Modified files:
        gnue-common    : setup.cfg.in setup.py 
        gnuef          : setup.py 

Log message:
        setup.py now adds a single GNUe.py module to python's default search 
path. A client app can import GNUe, after which the gnue.common, gnue.forms, 
etc packages will be in your session's search path (i.e., your app can 'import 
GNUe';'from gnue.common import *' without having to do funky stuff to find the 
installation path of gnue.
        Also made setup.py check for python >= 2.0 and die otherwise

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/setup.cfg.in.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue-common/setup.py.diff?cvsroot=OldCVS&tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnuef/setup.py.diff?cvsroot=OldCVS&tr1=1.39&tr2=1.40&r1=text&r2=text

Patches:
Index: gnue/gnue-common/setup.cfg.in
diff -u gnue/gnue-common/setup.cfg.in:1.1 gnue/gnue-common/setup.cfg.in:1.2
--- gnue/gnue-common/setup.cfg.in:1.1   Fri Jun 29 19:27:23 2001
+++ gnue/gnue-common/setup.cfg.in       Mon Oct  8 23:02:57 2001
@@ -1,44 +1,44 @@
-#
-# Copyright 2001 Free Software Foundation
-#
-# This file is part of GNU Enterprise.
-#
-# GNU Enterprise 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.
-#
-# 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
-# PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public
-# 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
-
-
+#
+# Copyright 2001 Free Software Foundation
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise 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.
+#
+# 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
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# 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
+
+
Index: gnue/gnue-common/setup.py
diff -u gnue/gnue-common/setup.py:1.20 gnue/gnue-common/setup.py:1.21
--- gnue/gnue-common/setup.py:1.20      Wed Sep 19 19:50:59 2001
+++ gnue/gnue-common/setup.py   Mon Oct  8 23:02:57 2001
@@ -24,6 +24,25 @@
 import string
 import os
 
+# First of all, make sure this is a current enough Python release.
+try:
+  if sys.hexversion < 0x02000000:
+    raise AttributeError
+except AttributeError:
+  print "-" * 70
+  print """
+  You are running Python %s.
+
+  GNU Enterprise requires at least Python 2.0 (recommended: 2.1+).
+  If you have a later version installed, you should run setup.py
+  against that version. For example, if you have Python 2.1
+  installed, you may need to run:
+
+       python2.1 setup.py
+""" % string.split(sys.version)[0]
+  print "-" * 70
+  sys.exit()
+
 #
 # hack to deal w/ fact distutils won't
 # allow us to set absolute path prefix
@@ -38,10 +57,12 @@
       os.remove('setup.cfg')
     except:
       pass
-  
+
 try:
-  from distutils.core import setup
-  from setupext import Data_Files, install_Data_Files 
+  import distutils
+  from distutils.command.build_scripts import build_scripts
+  from distutils.command.build import build
+  from setupext import Data_Files, install_Data_Files
 except ImportError:
   print """
 Setup requires that python's distutils be
@@ -53,28 +74,83 @@
 
 dfiles = [
   Data_Files(
-             base_dir = 'install_data', 
-             copy_to = 'shared', 
-             template = ['recursive-include images *.png', 
+             base_dir = 'install_data',
+             copy_to = 'shared',
+             template = ['recursive-include images *.png',
                          'recursive-include images *.xpm',
-                         'prune images/CVS'], 
-             preserve_path = 1), 
+                         'prune images/CVS'],
+             preserve_path = 1),
   Data_Files(
-             base_dir = 'install_data', 
-             copy_to = '', 
+             base_dir = 'install_data',
+             copy_to = '',
              template = ['recursive-include etc *',
-                         'prune etc/CVS'],  
-             preserve_path = 1), 
+                         'prune etc/CVS'],
+             preserve_path = 1),
   Data_Files(
-             base_dir = 'install_data', 
-             copy_to = 'doc/common', 
+             base_dir = 'install_data',
+             copy_to = 'doc/common',
              template = ['recursive-include doc *',
-                         'prune doc/CVS'], 
+                         'prune doc/CVS'],
              strip_dirs = 1, # This is a number, not true/false
              preserve_path = 1)
   ]
+
+class my_build_scripts(build_scripts):
+  def finalize_options(self):
+
+    build_scripts.finalize_options(self)
+
+    if self.finalized:
+      return
+
+    dict = self.distribution.get_option_dict("install")
+
+    # This statement stops the "search path" error messages
+    sys.path.append(dict['install_lib'][1])
+
+    options = []
+    for key in dict.keys():
+      options.append('%s = "%s"' % (key, 
string.replace(dict[key][1],'"','\\"')))
+
+    GNUe_py = """
+#
+# Copyright 2001 Free Software Foundation
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise 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.
+#
+# 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
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# 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.
+#
+
+import sys
+
+# Settings used during installation
+%s
+
 
-setup (name = "GNUe-Common",
+# Add gnue base directory to the sys.path
+if install_lib not in sys.path:
+  sys.path.insert(0,install_lib)
+""" % string.join(options,'\n')
+
+    output = open("GNUe.py", "w")
+    output.write(GNUe_py)
+    output.close()
+
+
+distutils.core.setup (name = "GNUe-Common",
        version = "0.0.3",
        description = "Base files of a GNU Enterprise Tools install",
        long_description = "",
@@ -82,8 +158,9 @@
        author_email = "address@hidden",
        url = "http://www.gnue.org";,
        # Override certain command classes with our own ones
-       cmdclass = {'install_data':install_Data_Files},
-       
+       cmdclass = {'install_data':install_Data_Files,
+                   'build_scripts':my_build_scripts},
+       scripts = ["scripts/gnuedtd"],
        data_files = dfiles,
        packages = ["gnue",
                    "gnue.common",
@@ -116,6 +193,35 @@
        )
 
 
+if not 'sdist' in sys.argv:
+  if sys.platform != 'win32':
+    os.remove ("setup.cfg")
+
+  # This is a nasty hack to get GNUe.py (and only GNUe.py)
+  # to install to site_packages
+  file = open ("setup.cfg","w")
+  file.write ("[build]\n"
+              "build_base=build.1\n"
+              "[install_lib]\n"
+              "build_dir=build.1\n")
+  file.close()
+
+
+distutils.core.setup (name = "GNUe-Common",
+       version = "0.0.3",
+       description = "Base files of a GNU Enterprise Tools install",
+       long_description = "",
+       author = "GNUe Project",
+       author_email = "address@hidden",
+       url = "http://www.gnue.org";,
+       # Override certain command classes with our own ones
+       py_modules = ['GNUe'],
+       scripts = [],
+       data_files = None,
+       packages = []
+       )
+
+
 if 'install' in sys.argv:
   print """
   Note:
@@ -131,7 +237,4 @@
          /usr/lib/python1.5/site-packages/gnue
   """
 
-if not 'sdist' in sys.argv:
-  if sys.platform != 'win32':
-    os.remove ("setup.cfg")
 
Index: gnue/gnuef/setup.py
diff -u gnue/gnuef/setup.py:1.39 gnue/gnuef/setup.py:1.40
--- gnue/gnuef/setup.py:1.39    Sun Oct  7 02:28:34 2001
+++ gnue/gnuef/setup.py Mon Oct  8 23:02:57 2001
@@ -24,6 +24,7 @@
 import string
 import os
 import os.path
+import copy
 
 try:
   import py2exe
@@ -123,22 +124,22 @@
 Make sure and create update the html and text docs
 prior to creating the source distribution.
 """
-  raw_input ("Press Control-D to abort or any other key to continue") 
-  
+  raw_input ("Press Control-D to abort or any other key to continue")
+
 if ('build' in sys.argv) or ('install' in sys.argv):
   # Verify that gnue-common is installed
 #  try:
 #    print "Checking for GNUe-Common....",
 #    from gnue import common
-#    if common.__dict__.has_key('VERSION'): 
+#    if common.__dict__.has_key('VERSION'):
 #      print "OK (version %s)" % common.VERSION
-#    else: 
+#    else:
 #      print "OK"
 #  except ImportError:
 #    print """
 #You will need to install gnue-common
 #before gnuef will function.  You can
-#obtain a copy from 
+#obtain a copy from
 #
 #http://www.gnuenterprise.org/download.php
 #"""
@@ -165,8 +166,8 @@
   UIOK = 0
 
   print "Checking for available UI drivers...."
-  # PyNcurses 
-  try: 
+  # PyNcurses
+  try:
     print "  Pyncurses(Currently not working)....",
     import ncurses.form
     print "OK"
@@ -201,12 +202,15 @@
   python curses - Read python install docs on how to activate
 """
     sys.exit()
+
 
-class my_build_scripts(build_scripts): 
+
+class my_build_scripts(build_scripts):
   def finalize_options(self):
+
     build_scripts.finalize_options(self)
 
-    if self.finalized: 
+    if self.finalized:
       return
 
     dict = self.distribution.get_option_dict("install")
@@ -229,26 +233,26 @@
          + "os.environ['INSTALL_LIB']='%s'\n" % (sys.prefix)                  \
          + "#######\n"
 
-    for script in self.scripts: 
+    for script in self.scripts:
       print "Building %s..."% (script),
-      
 
+
       fin = open(script+".in", "r")
       fout = open(script, "w")
 
-      print "Generating script %s from %s.in" % (script,script) 
+      print "Generating script %s from %s.in" % (script,script)
 
       lines = fin.readlines()
 
-      for i in range(0, len(lines)): 
-        if string.strip(lines[i]) == "__GNUEENV__": 
+      for i in range(0, len(lines)):
+        if string.strip(lines[i]) == "__GNUEENV__":
           lines[i] = gnue_env
 
       fout.writelines(lines)
       fin.close()
       fout.close()
       print "OK"
-          
+
 setup (name = "GNUe-Forms",
        version = "0.0.9",
        description = "GNU Enterprise Forms",
@@ -256,12 +260,12 @@
        author = "GNUe Forms 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/forms',['doc/techref.txt']) ],
-              
+
        packages = ["gnue.forms", "gnue.forms.GFObjects"],
        package_dir = {"gnue.forms" : "src"},
        scripts = ["client/gfclient"]
@@ -275,7 +279,7 @@
     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.
     """
-  
+
 if not 'sdist' in sys.argv:
   if sys.platform != 'win32':
     os.system (""" /bin/rm -rf setup.cfg""")



reply via email to

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