[PythonReports-checkins] PythonReports setup.py,1.1,1.2
Brought to you by:
a1s
From: alexander s. <a1...@us...> - 2006-11-03 19:49:47
|
Update of /cvsroot/pythonreports/PythonReports In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17410 Modified Files: setup.py Log Message: read version number from the package sources; generate htmls automatically (skip if no docutils); added docs, scripts and package metadata Index: setup.py =================================================================== RCS file: /cvsroot/pythonreports/PythonReports/setup.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** setup.py 1 Nov 2006 11:28:32 -0000 1.1 --- setup.py 3 Nov 2006 19:49:45 -0000 1.2 *************** *** 1,5 **** --- 1,9 ---- """PythonReports setup script""" + # FIXME! generate_docs() must be reimplemented as a distutils command """History: + 03-nov-2006 [als] read version number from the package sources; + generate htmls automatically (skip if no docutils); + added docs, scripts and package metadata 03-oct-2006 [als] created """ *************** *** 9,20 **** from distutils.core import setup ! setup(name="PythonReports", ! version="0.0.1", ! description="Database report generator", ! author="alexander smishlajev", ! author_email="al...@ty...", ! packages=["PythonReports"], ! ) # vim: set et sts=4 sw=4 : --- 13,115 ---- from distutils.core import setup + import glob + import os ! try: ! from docutils.core import publish_cmdline ! except ImportError: ! publish_cmdline = None ! ! if os.name == "nt": ! DOC_DIR = "Lib\\site-packages\\PythonReports\\doc" ! SCRIPTS=["scripts/prd", "scripts/prd.bat"] ! else: ! DOC_DIR = "share/PythonReports/doc" ! SCRIPTS=["scripts/prd"] ! ! DESCRIPTION = """\ ! PythonReports is a toolkit aimed to build database reports ! in Python programs. The toolkit includes report template ! designer, report builder and several printout renderers ! for GUI and graphic file output. ! ! Report builder applies a template to a sequence of uniform ! data objects and produces a printout structure that can be ! saved to file and/or rendered by one of the front-end drivers ! to screen, printer, PDF etc. ! ! """ ! ! def get_version(): ! """Return package version string""" ! # don't use import to avoid fiddling with sys.path ! # and leaving behind compiled module file ! _vars = {} ! exec file("PythonReports/version.py") in _vars ! return _vars["__version__"] ! ! def rst2html(source, target, force=False): ! """Generate HTML document from RST source ! ! Parameters: ! source: source (rst) file name ! target: target (html) file name ! force: if set, generate html even if ! source file is not newer than target ! ! """ ! if not force: ! force = os.stat(source).st_mtime > os.stat(target).st_mtime ! if force: ! print "Generating %s => %s" % (source, target) ! publish_cmdline(writer_name='html', argv=[ ! "--stylesheet-path=doc/default.css", source, target]) ! ! def generate_docs(): ! """Generate HTML documentation from RST sources""" ! # make sure docutils are loaded ! if not publish_cmdline: ! return ! # use floating timestamps ! os.stat_float_times(True) ! for (_source, _target) in ( ! ("doc/prt.txt", "doc/prt.html"), ! ("doc/prp.txt", "doc/prp.html"), ! ("README", "doc/README.html"), ! ("CHANGES", "doc/CHANGES.html"), ! ): ! rst2html(_source, _target) ! ! def run(): ! if publish_cmdline: ! # docutitls available - generate htmls ! generate_docs() ! setup(name="PythonReports", ! version=get_version(), ! url="http://pythonreports.sourceforge.net/", ! description="Database report generator", ! long_description=DESCRIPTION, ! author="alexander smishlajev", ! author_email="al...@ty...", ! classifiers=[ ! "Development Status :: 3 - Alpha", ! "Environment :: Win32 (MS Windows)", ! "Environment :: X11 Applications", ! "Intended Audience :: Developers", ! "Intended Audience :: Information Technology", ! "License :: OSI Approved :: MIT License", ! "Operating System :: OS Independent", ! "Programming Language :: Python", ! "Topic :: Database :: Front-Ends", ! "Topic :: Printing", ! ], ! packages=["PythonReports"], ! scripts=SCRIPTS, ! data_files=[(DOC_DIR, ! ["README", "LICENSE", "CHANGES"] + glob.glob("doc/*.html"))], ! ) ! ! if __name__ == "__main__": ! run() # vim: set et sts=4 sw=4 : |