root / pykota / trunk / setup.py @ 3214

Revision 3214, 5.9 kB (checked in by jerome, 17 years ago)

Added qa-assistant stuff.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
RevLine 
[695]1#! /usr/bin/env python
[1144]2# -*- coding: ISO-8859-15 -*-
[695]3#
4# PyKota
5#
[952]6# PyKota : Print Quotas for CUPS and LPRng
[695]7#
[3133]8# (c) 2003, 2004, 2005, 2006, 2007 Jerome Alet <alet@librelogiciel.com>
[873]9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 2 of the License, or
12# (at your option) any later version.
[695]13#
[873]14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program; if not, write to the Free Software
[2303]21# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
[695]22#
23# $Id$
24#
[2028]25#
[695]26
27import sys
28import glob
29import os
[3005]30import stat
[884]31import shutil
[996]32try :
33    from distutils.core import setup
[3005]34    from distutils.command.install_data import install_data
[997]35except ImportError, msg :   
36    sys.stderr.write("%s\n" % msg)
[996]37    sys.stderr.write("You need the DistUtils Python module.\nunder Debian, you may have to install the python-dev package.\nOf course, YMMV.\n")
38    sys.exit(-1)
[695]39
40sys.path.insert(0, "pykota")
41from pykota.version import __version__, __doc__
42
43data_files = []
44mofiles = glob.glob(os.sep.join(["po", "*", "*.mo"]))
45for mofile in mofiles :
46    lang = mofile.split(os.sep)[1]
47    directory = os.sep.join(["share", "locale", lang, "LC_MESSAGES"])
48    data_files.append((directory, [ mofile ]))
[839]49   
[1592]50docdir = "share/doc/pykota"   
[3156]51docfiles = ["README", "FAQ", "SECURITY", "COPYING", "LICENSE", "CREDITS", "TODO"]
52if os.path.exists("ChangeLog") :
53    docfiles.append("ChangeLog")
[1297]54data_files.append((docdir, docfiles))
[1279]55
[1307]56docfiles = glob.glob(os.sep.join(["docs", "*.pdf"]))
[1658]57docfiles += glob.glob(os.sep.join(["docs", "*.sx?"]))
[1307]58data_files.append((docdir, docfiles))
59
60docfiles = glob.glob(os.sep.join(["docs", "pykota", "*.html"]))
61data_files.append((os.path.join(docdir, "html"), docfiles))
62
[1658]63docfiles = glob.glob(os.sep.join(["openoffice", "*.sx?"]))
[1307]64docfiles += glob.glob(os.sep.join(["openoffice", "*.png"]))
65docfiles += glob.glob(os.sep.join(["openoffice", "README"]))
66data_files.append((os.path.join(docdir, "openoffice"), docfiles))
67
[3214]68docfiles = glob.glob(os.sep.join(["qa-assistant", "*.xml"]))
69docfiles += glob.glob(os.sep.join(["qa-assistant", "README"]))
70data_files.append((os.path.join(docdir, "qa-assistant"), docfiles))
71
[839]72directory = os.sep.join(["share", "man", "man1"])
73manpages = glob.glob(os.sep.join(["man", "*.1"]))   
74data_files.append((directory, manpages))
[695]75
[1829]76modirs = [ os.path.split(os.path.split(mof)[0])[1] for mof in mofiles ]
77for dir in modirs :
78    directory = os.sep.join(["share", "man", dir, "man1"])
79    manpages = glob.glob(os.sep.join(["man", dir, "*.1"]))   
80    data_files.append((directory, manpages))
81
[1345]82directory = os.sep.join(["share", "pykota"])
[2383]83data_files.append((directory, ["checkdeps.py", "bin/cupspykota", \
[2469]84                               "bin/waitprinter.sh", \
[2383]85                               "bin/papwaitprinter.sh", \
86                               "bin/mailandpopup.sh", \
87                               "untested/pjl/pagecount.pjl", \
88                               "untested/pjl/status.pjl", \
89                               "untested/netatalk/netatalk.sh", \
90                               "untested/netatalk/pagecount.ps"]))
[1345]91
[1905]92data_files.append((os.sep.join([directory, "conf"]), ["conf/README", "conf/pykota.conf.sample", "conf/pykotadmin.conf.sample"]))
93
[2175]94data_files.append((os.sep.join([directory, "cgi-bin"]), ["cgi-bin/README", "cgi-bin/printquota.cgi", "cgi-bin/dumpykota.cgi", "cgi-bin/pykotme.cgi"]))
[1905]95
[1911]96data_files.append((os.sep.join([directory, "logos"]), glob.glob(os.sep.join(["logos", "*.jpeg"])) + glob.glob(os.sep.join(["logos", "*.png"])) + glob.glob(os.sep.join(["logos", "*.xcf"]))))
[1907]97
[2508]98data_files.append((os.sep.join([directory, "stylesheets"]), glob.glob(os.sep.join(["stylesheets", "*.css"])) + [ "stylesheets/README" ]))
99
[1905]100pgdirectory = os.sep.join([directory, "postgresql"])
101data_files.append((pgdirectory, ["initscripts/postgresql/README.postgresql", "initscripts/postgresql/pykota-postgresql.sql"]))
102
103ldapdirectory = os.sep.join([directory, "ldap"])
104data_files.append((ldapdirectory, ["initscripts/ldap/README.ldap", "initscripts/ldap/pykota.schema", "initscripts/ldap/pykota-sample.ldif"]))
105
[2638]106mysqldirectory = os.sep.join([directory, "mysql"])
107data_files.append((mysqldirectory, ["initscripts/mysql/README.mysql", "initscripts/mysql/pykota-mysql.sql"]))
108
[2748]109sqlitedirectory = os.sep.join([directory, "sqlite"])
110data_files.append((sqlitedirectory, ["initscripts/sqlite/README.sqlite", "initscripts/sqlite/pykota-sqlite.sql"]))
111
[3005]112class MyInstallData(install_data) :
113    """A special class to ensure permissions are OK on the cupspykota backend."""
114    def run(self) :
115        """Launches the normal installation and then tweaks permissions."""
116        install_data.run(self)
117        if not self.dry_run :
118            cupspykota = [ filename for filename in self.get_outputs() if filename.endswith("cupspykota") ][0]
119            os.chmod(cupspykota, stat.S_IRWXU)
120   
[2434]121os.umask(022)
[695]122setup(name = "pykota", version = __version__,
123      license = "GNU GPL",
124      description = __doc__,
125      author = "Jerome Alet",
126      author_email = "alet@librelogiciel.com",
[2909]127      url = "http://www.pykota.com",
[1483]128      packages = [ "pykota", "pykota.storages", "pykota.loggers", "pykota.accounters", "pykota.reporters" ],
[3033]129      scripts = [ "bin/pknotify", "bin/pkusers", "bin/pkinvoice", "bin/pksetup", \
[3063]130                  "bin/pkrefund", "bin/pkturnkey", "bin/pkbcodes", "bin/pkmail", \
[2699]131                  "bin/pkbanner", "bin/autopykota", "bin/dumpykota", \
132                  "bin/pykosd", "bin/edpykota", "bin/repykota", \
133                  "bin/warnpykota", "bin/pykotme", "bin/pkprinters" ],
[3005]134      data_files = data_files,
135      cmdclass = { "install_data" : MyInstallData })
Note: See TracBrowser for help on using the browser.