Remove Twisted dependency.
[jelmer/calypso.git] / setup.py
1 #!/usr/bin/python
2 # -*- coding: utf-8; indent-tabs-mode: nil; -*-
3 #
4 # This file is part of Radicale Server - Calendar Server
5 # Copyright © 2009 Guillaume Ayoub
6 #
7 # This library is free software: you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation, either version 3 of the License, or
10 # (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with Radicale.  If not, see <http://www.gnu.org/licenses/>.
19
20 import os
21 import shutil
22
23 from distutils.core import setup, Command
24 from distutils.command.build_scripts import build_scripts
25
26 class BuildScripts(build_scripts):
27     def run(self):
28         self.mkpath(self.build_dir)
29         for script in self.scripts:
30             root, _ = os.path.splitext(script)
31             self.copy_file(script, os.path.join(self.build_dir, root))
32
33 class Clean(Command):
34     description = "clean up package temporary files"
35     user_options = []
36
37     def initialize_options(self):
38         pass
39
40     def finalize_options(self):
41         pass
42
43     def run(self):
44         path = os.path.abspath(os.path.dirname(__file__))
45         for pathname, _, files in os.walk(path):
46             for filename in filter(self._should_remove, files):
47                 os.unlink(os.path.join(pathname, filename))
48
49         for folder in ("build", "dist"):
50             if os.path.isdir(os.path.join(path, folder)):
51                 shutil.rmtree(os.path.join(path, folder))
52
53         if os.path.isfile(os.path.join(path, "MANIFEST")):
54             os.unlink(os.path.join(path, "MANIFEST"))
55
56     @staticmethod
57     def _should_remove(filename):
58         return (os.path.splitext(filename)[1] == ".pyc" or
59                 os.path.splitext(filename)[1] == ".pyo" or
60                 filename.endswith("~") or
61                 (filename.startswith("#") and filename.endswith("#")))
62         
63
64 setup(
65     name="Radicale",
66     version="0.1",
67     description="Radicale CalDAV Server",
68     author="Guillaume Ayoub",
69     author_email="guillaume.ayoub@kozea.fr",
70     url="http://www.radicale.org/",
71     license="GNU GPL v3",
72     packages=["radicale", "radicale.acl", "radicale.support"],
73     scripts=["radicale.py"],
74     cmdclass={'clean': Clean,
75               "build_scripts": BuildScripts})