2 # -*- coding: utf-8; indent-tabs-mode: nil; -*-
4 # This file is part of Radicale Server - Calendar Server
5 # Copyright © 2009 Guillaume Ayoub
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.
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.
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/>.
23 from distutils.core import setup, Command
24 from distutils.command.build_scripts import build_scripts
26 class BuildScripts(build_scripts):
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))
34 description = "clean up package temporary files"
37 def initialize_options(self):
40 def finalize_options(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))
49 for folder in ("build", "dist"):
50 if os.path.isdir(os.path.join(path, folder)):
51 shutil.rmtree(os.path.join(path, folder))
53 if os.path.isfile(os.path.join(path, "MANIFEST")):
54 os.unlink(os.path.join(path, "MANIFEST"))
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("#")))
67 description="Radicale CalDAV Server",
68 author="Guillaume Ayoub",
69 author_email="guillaume.ayoub@kozea.fr",
70 url="http://www.radicale.org/",
72 packages=["radicale", "radicale.acl", "radicale.support"],
73 scripts=["radicale.py"],
74 cmdclass={'clean': Clean,
75 "build_scripts": BuildScripts})