Code

more doc, more cleanup
[roundup.git] / setup.py
index 29f75ca1ce7d7ad04d22c904cde1bf8256d32b43..b146d8289e938ac41154d4410288a661d53edfb6 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: setup.py,v 1.31 2002-03-22 18:36:00 jhermann Exp $
+# $Id: setup.py,v 1.37 2002-09-06 04:25:31 richard Exp $
 
 from distutils.core import setup, Extension
 from distutils.util import get_platform
@@ -25,7 +25,7 @@ from distutils.command.build_scripts import build_scripts
 import sys, os, string
 from glob import glob
 
-from roundup.templatebuilder import makeHtmlBase
+from roundup.templates.builder import makeHtmlBase
 
 
 #############################################################################
@@ -85,7 +85,8 @@ class build_scripts_create(build_scripts):
             try:
                 if sys.platform == "win32":
                     file.write('@echo off\n'
-                        '%(python)s -c "from %(package)s.scripts.%(module)s import run; run()" %%$\n'
+                        'if NOT "%%_4ver%%" == "" %(python)s -c "from %(package)s.scripts.%(module)s import run; run()" %%$\n'
+                        'if     "%%_4ver%%" == "" %(python)s -c "from %(package)s.scripts.%(module)s import run; run()" %%*\n'
                         % script_vars)
                 else:
                     file.write('#! %(python)s\n'
@@ -111,8 +112,6 @@ def scriptname(path):
         script = script + ".bat"
     return script
 
-# build list of scripts from their implementation modules
-roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py'))
 
 
 #############################################################################
@@ -123,55 +122,104 @@ def isTemplateDir(dir):
     return dir[0] != '.' and dir != 'CVS' and os.path.isdir(dir) \
         and os.path.isfile(os.path.join(dir, '__init__.py'))
 
+# use that function to list all the templates
 templates = map(os.path.basename, filter(isTemplateDir,
     glob(os.path.join('roundup', 'templates', '*'))))
-packagelist = [
-    'roundup',
-    'roundup.backends',
-    'roundup.scripts',
-    'roundup.templates'
-]
-installdatafiles = [
-    ('share/roundup/cgi-bin', ['cgi-bin/roundup.cgi']),
-] 
-
-for template in templates:
-    tdir = os.path.join('roundup', 'templates', template)
-    makeHtmlBase(tdir)
-
-    # add the template package and subpackage
-    packagelist.append('roundup.templates.%s' % template)
-    packagelist.append('roundup.templates.%s.detectors' % template)
-
-    # scan for data files
-    tfiles = glob(os.path.join(tdir, 'html', '*'))
-    tfiles = filter(os.path.isfile, tfiles)
-    installdatafiles.append(
-        ('share/roundup/templates/%s/html' % template, tfiles)
-    )
-
-
-setup(
-    name = "roundup", 
-    version = "0.4.0",
-    description = "Roundup issue tracking system.",
-    author = "Richard Jones",
-    author_email = "richard@users.sourceforge.net",
-    url = 'http://sourceforge.net/projects/roundup/',
-    packages = packagelist,
 
-    # Override certain command classes with our own ones
-    cmdclass = {
-        'build_scripts': build_scripts_roundup,
-    },
-    scripts = roundup_scripts,
-
-    data_files =  installdatafiles
-)
+def buildTemplates():
+    for template in templates:
+        tdir = os.path.join('roundup', 'templates', template)
+        makeHtmlBase(tdir)
+
+if __name__ == '__main__':
+    # build list of scripts from their implementation modules
+    roundup_scripts = map(scriptname, glob('roundup/scripts/[!_]*.py'))
+
+    # template munching
+    templates = map(os.path.basename, filter(isTemplateDir,
+        glob(os.path.join('roundup', 'templates', '*'))))
+    packagelist = [
+        'roundup',
+        'roundup.cgi',
+        'roundup.cgi.PageTemplates',
+        'roundup.cgi.TAL',
+        'roundup.cgi.ZTUtils',
+        'roundup.backends',
+        'roundup.scripts',
+        'roundup.templates'
+    ]
+    installdatafiles = [
+        ('share/roundup/cgi-bin', ['cgi-bin/roundup.cgi']),
+    ] 
+
+    # munge the template HTML into the htmlbase module
+    buildTemplates()
+
+    # add the templates to the setup packages and data files lists
+    for template in templates:
+        tdir = os.path.join('roundup', 'templates', template)
+
+        # add the template package and subpackage
+        packagelist.append('roundup.templates.%s' % template)
+        packagelist.append('roundup.templates.%s.detectors' % template)
+
+        # scan for data files
+        tfiles = glob(os.path.join(tdir, 'html', '*'))
+        tfiles = filter(os.path.isfile, tfiles)
+        installdatafiles.append(
+            ('share/roundup/templates/%s/html' % template, tfiles)
+        )
+
+    # perform the setup action
+    from roundup import __version__
+    setup(
+        name = "roundup", 
+        version = __version__,
+        description = "Roundup issue tracking system.",
+        author = "Richard Jones",
+        author_email = "richard@users.sourceforge.net",
+        url = 'http://sourceforge.net/projects/roundup/',
+        packages = packagelist,
+
+        # Override certain command classes with our own ones
+        cmdclass = {
+            'build_scripts': build_scripts_roundup,
+        },
+        scripts = roundup_scripts,
+
+        data_files =  installdatafiles
+    )
 
 
 #
 # $Log: not supported by cvs2svn $
+# Revision 1.36  2002/08/16 04:25:01  richard
+# cleanup: moved templatebuilder into templates.builder
+#
+# Revision 1.35  2002/06/17 23:14:44  richard
+# . #569415 ] {version}
+#
+# Revision 1.34  2002/05/29 01:16:16  richard
+# Sorry about this huge checkin! It's fixing a lot of related stuff in one go
+# though.
+#
+# . #541941 ] changing multilink properties by mail
+# . #526730 ] search for messages capability
+# . #505180 ] split MailGW.handle_Message
+#   - also changed cgi client since it was duplicating the functionality
+# . build htmlbase if tests are run using CVS checkout (removed note from
+#   installation.txt)
+# . don't create an empty message on email issue creation if the email is empty
+#
+# Revision 1.33  2002/04/03 05:53:03  richard
+# Didn't get around to committing these after the last release.
+#
+# Revision 1.32  2002/03/27 23:47:58  jhermann
+# Fix for scripts running under CMD.EXE
+#
+# Revision 1.31  2002/03/22 18:36:00  jhermann
+# chmod +x for scripts
+#
 # Revision 1.30  2002/01/29 20:07:15  jhermann
 # Conversion to generated script stubs
 #