/[gnue]/gnue-reports/setup.py
ViewVC logotype

Diff of /gnue-reports/setup.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by jcater, Fri Sep 19 03:59:59 2003 UTC revision 1.34 by reinhard, Sun Oct 5 17:12:07 2003 UTC
# Line 1  Line 1 
1  #!/usr/bin/env python  #!/usr/bin/env python
2  #  #
3    # GNU Enterprise Reports - Installation Procedure
4    #
5  # Copyright 2001-2003 Free Software Foundation  # Copyright 2001-2003 Free Software Foundation
6  #  #
7  # This file is part of GNU Enterprise.  # This file is part of GNU Enterprise.
# Line 19  Line 21 
21  # write to the Free Software Foundation, Inc., 59 Temple Place  # write to the Free Software Foundation, Inc., 59 Temple Place
22  # - Suite 330, Boston, MA 02111-1307, USA.  # - Suite 330, Boston, MA 02111-1307, USA.
23  #  #
24    # $Id$
25    
26  import sys  import sys
 import string  
27  import os  import os
 import os.path  
   
 from src import VERSION  
   
 try:  
   import py2exe  
 except:  
   pass  
   
   
 #  
 # hack to deal w/ fact distutils won't  
 # allow us to set absolute path prefix  
 # on windows  
 #  
   
 if not 'sdist' in sys.argv:  
   if sys.platform != 'win32' and '--prefix' not in sys.argv and '--root' not in sys.argv:  
     os.system ("""cp setup.cfg.in setup.cfg""")  
   else:  
     try:  
       os.remove('setup.cfg')  
     except:  
       pass  
   
   
   
28    
29    from src import PACKAGE, VERSION
30    
31  try:  try:
32    from distutils.core import setup    from gnue.common.setup import GSetup
   from distutils.command.build_scripts import build_scripts  
33  except ImportError:  except ImportError:
34    print """    print "You need GNUe-Common 0.5.2 or newer installed to install %s" % PACKAGE
35  Setup requires that python's distutils be    sys.exit (1)
 installed.  You can get a copy of it from  
 http://www.python.org/sigs/distutils-sig/  
     """  
   sys.exit()  
   
   
 if 'sdist' in sys.argv:  
   print """  
 *** Notes for creating source disto ***  
   
 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")  
   
   os.system ("""  
 cd doc  
 lyx --export text ReportingConcepts.lyx  
 lyx --export pdf ReportingConcepts.lyx  
 """)  
   
   
   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/grcvs --generate-man-page  
 #../scripts/gnue-reports-server --generate-man-page  
 """)  
36    
37    # =============================================================================
38    
39  # Site config stuff  class setup (GSetup):
 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:  
   config_line = ""  
   
 #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'):  
 #      print "OK (version %s)" % common.VERSION  
 #    else:  
 #      print "OK"  
 #  except ImportError:  
 #    print """  
 #You will need to install gnue-common  
 #before gnuef will function.  You can  
 #obtain a copy from  
 #  
 #http://www.gnuenterprise.org/download.php  
 #"""  
 #    sys.exit()  
   
   
   
 class my_build_scripts(build_scripts):  
   def finalize_options(self):  
   
     build_scripts.finalize_options(self)  
   
     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"    \  
              + "# (Generated for a Win32 system)\n" \  
              + "import os, sys\n" \  
              + "if __name__ == '__main__': \n" \  
              + "  _BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]),'..'))\n" \  
              + "  try:\n" \  
              + "    os.environ['PATH']= os.path.abspath(os.path.dirname(sys.argv[0])) + ';' + os.environ['PATH']\n" \  
              + "  except KeyError:\n" \  
              + "    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.environ['INSTALL_PREFIX']=_BASE\n"                \  
              + "os.environ['INSTALL_LIB']=_BASE\n"                   \  
              + "os.putenv('PYTHONCASEOK','1')\n" \  
              + config_line \  
              + "if os.path.isdir(os.path.join(_BASE,'extras')):\n" \  
              + "  sys.path.append(os.path.join(_BASE,'extras'))\n" \  
              + "#######\n\n"  
   
     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)  
   
       lines = fin.readlines()  
   
       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"  
   
   
 docfiles = []  
 for file in ('doc/ReportingConcepts.txt',  
              'doc/ReportingConcepts.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-reports.1',  
              'man/gnue-reports-server.1'):  
   if os.path.isfile(file):  
     manfiles.append(file)  
   else:  
     print "WARNING: File %s does not exist... not installing!" % file  
40    
41      # ---------------------------------------------------------------------------
42      # Definition of basic parameters for distribution and installation.
43      # Please add new files/directories that should be installed here.
44      # Note that you also have to add them to MANIFEST.in.
45      # ---------------------------------------------------------------------------
46    
47      def set_params (self, params):
48      
49        # The Work
50        params ["name"]             = PACKAGE
51        params ["version"]          = VERSION
52        params ["description"]      = "GNU Enterprise Reports"
53        params ["long_description"] = ""
54        params ["license"]          = "GPL"
55    
56        # The Author
57        params ["author"]       = "GNU Enterprise Team"
58        params ["author_email"] = "gnue-dev@gnu.org"
59        params ["url"]          = "http://www.gnue.org"
60    
61        # The Programs
62        params ["package_dir"] = {"gnue.reports": "src"}
63        params ["scripts"]     = ["scripts/gnue-reports"]
64    
65        # The Data
66        filterLabels = self.allfiles ("src/adapters/filters/Labels/etc/")
67        filterSimple = self.allfiles ("src/adapters/filters/SimpleTabulation/etc/")
68        docfiles     = self.allfiles ("doc")
69    
70        params ["data_files"] = \
71          [("share/gnue/filters/Labels",           filterLabels),
72           ("share/gnue/filters/SimpleTabulation", filterSimple),
73           ("share/doc/gnue-reports",              docfiles)]
74    
75      # ---------------------------------------------------------------------------
76      # Build files to be distributed and installed:
77      # Should generate the files that go in a distribution but aren't in CVS.
78      # Gets called on sdist (always) and on build/install (only when run from CVS).
79      # ---------------------------------------------------------------------------
80    
81      def build_files (self):
82        # nothing to do here
83        pass
84    
85      # ---------------------------------------------------------------------------
86      # Check dependencies for installation:
87      # Should sys.exit(1) in case any requirement isn't met.
88      # Gets called on install.
89      # ---------------------------------------------------------------------------
90    
91      def check_dependencies (self):
92        # TODO
93        pass
94    
95  #  # =============================================================================
96  # You can run:  
97  #   $ GNUE_VERSION_SUFFIX=-pre1 ./setup.py sdist  if __name__ == "__main__":
98  # and the packages will be created as GNUe-App-0.x.x-pre1.tar.gz    setup().run()
 #  
 try:  
   suffix = os.environ['GNUE_VERSION_SUFFIX']  
 except KeyError:  
   suffix = ""  
   
   
 setup (name = "GNUe-Reports",  
        version = VERSION+suffix,  
        description = "GNU Enterprise Reports",  
        long_description = "",  
        author = "GNUe Reports Team",  
        author_email = "info@gnue.org",  
        url = "http://www.gnue.org",  
   
        # Override certain command classes with our own ones  
        cmdclass = {'build_scripts':my_build_scripts},  
   
        data_files = [ ('doc/reports', docfiles),  
                       ('man/man1', manfiles),  
                       ('shared/filters/Labels', ['src/adapters/filters/Labels/etc/label-specs.dat']),  
                       ('shared/filters/SimpleTabulation', [  
                                       'src/adapters/filters/SimpleTabulation/etc/csv.xsl',  
                                       'src/adapters/filters/SimpleTabulation/etc/html.xsl',  
                                       'src/adapters/filters/SimpleTabulation/etc/text.xsl']  
                        ) ],  
   
        packages = ["gnue.reports",  
                    "gnue.reports.adapters",  
                    "gnue.reports.adapters.destinations",  
                    "gnue.reports.adapters.destinations.email",  
                    "gnue.reports.adapters.destinations.fax",  
                    "gnue.reports.adapters.destinations.file",  
                    "gnue.reports.adapters.destinations.printer",  
                    "gnue.reports.adapters.filters",  
                    "gnue.reports.adapters.filters.Labels",  
                    "gnue.reports.adapters.filters.Labels.labels",  
                    "gnue.reports.adapters.filters.Labels.labels.formatters",  
                    "gnue.reports.adapters.filters.MailMerge",  
                    "gnue.reports.adapters.filters.MailMerge._merge",  
                    "gnue.reports.adapters.filters.MailMerge.merge_latex",  
                    "gnue.reports.adapters.filters.MailMerge.merge_ps",  
                    "gnue.reports.adapters.filters.MailMerge.merge_psfax",  
                    "gnue.reports.adapters.filters.MailMerge.merge_rtf",  
                    "gnue.reports.adapters.filters.SimpleTabulation",  
                    "gnue.reports.adapters.filters.SimpleTabulation.tabulator",  
                    "gnue.reports.adapters.filters.SimpleTabulation.tabulator.formatters",  
                    "gnue.reports.adapters.filters.general",  
                    "gnue.reports.adapters.filters.general.4xslt",  
                    "gnue.reports.adapters.filters.general.raw",  
                    "gnue.reports.adapters.filters.general.sablotron",  
                    "gnue.reports.adapters.filters.Universal",  
                    "gnue.reports.adapters.filters.Universal.Base",  
                    "gnue.reports.adapters.filters.Universal.Base.Objects",  
                    "gnue.reports.adapters.filters.Universal.postscript",  
                    "gnue.reports.adapters.filters.Universal.postscript.psutils",  
                    "gnue.reports.adapters.filters.Universal.pcl5",  
                    "gnue.reports.adapters.filters.Universal.html",  
                    "gnue.reports.adapters.filters.Universal.xhtml",  
                    "gnue.reports.adapters.filters.Universal.rtf",  
                    "gnue.reports.adapters.filters.Universal.tex",  
                    "gnue.reports.adapters.filters.Universal.lineprinter",  
                    "gnue.reports.adapters.filters.Universal.Base.styles",  
                    "gnue.reports.adapters.filters.Universal.Base.styles.Objects",  
                    "gnue.reports.adapters.filters.Universal.Base.Helpers",  
                    "gnue.reports.adapters.filters.Universal.Base.Writers",  
                    "gnue.reports.base",  
                    "gnue.reports.base.layout",  
                    "gnue.reports.client",  
                    "gnue.reports.server",  
                    ],  
   
        package_dir = {"gnue.reports" : "src"},  
   
        scripts = ["scripts/gnue-reports", ] # "scripts/gnue-reports-server"]  
        )  
   
 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.  
     """  
   
 if not 'sdist' in sys.argv:  
   if sys.platform != 'win32':  
     os.system (""" /bin/rm -rf setup.cfg""")  

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26