From 3693bc933d64d49a2eaf26fe9b9a3f53c0e6db4f Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Tue, 1 Sep 2009 19:09:11 +0200 Subject: [PATCH] Python distutils setup file --- setup.py | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100755 setup.py diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..2ff8d3a --- /dev/null +++ b/setup.py @@ -0,0 +1,78 @@ +#!/usr/bin/python +# -*- coding: utf-8; indent-tabs-mode: nil; -*- +# +# This file is part of Radicale Server - Calendar Server +# Copyright © 2008-2009 Guillaume Ayoub +# Copyright © 2008 Nicolas Kandel +# Copyright © 2008 Pascal Halter +# +# This library is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Radicale. If not, see . + +import os +import shutil + +from distutils.core import setup, Command +from distutils.command.build_scripts import build_scripts + +class BuildScripts(build_scripts): + def run(self): + self.mkpath(self.build_dir) + for script in self.scripts: + root, ext = os.path.splitext(script) + self.copy_file(script, os.path.join(self.build_dir, root)) + +class Clean(Command): + description = "clean up package temporary files" + user_options = [] + + def initialize_options(self): + pass + + def finalize_options(self): + pass + + def run(self): + path = os.path.abspath(os.path.dirname(__file__)) + for pathname, _, files in os.walk(path): + for filename in filter(self._should_remove, files): + os.unlink(os.path.join(pathname, filename)) + + for folder in ("build", "dist"): + if os.path.isdir(os.path.join(path, folder)): + shutil.rmtree(os.path.join(path, folder)) + + if os.path.isfile(os.path.join(path, "MANIFEST")): + os.unlink(os.path.join(path, "MANIFEST")) + + @staticmethod + def _should_remove(filename): + return (os.path.splitext(filename) == ".pyc" or + os.path.splitext(filename) == ".pyo" or + filename.endswith("~") or + (filename.startswith("#") and filename.endswith("#"))) + + +setup( + name="Radicale", + version="0.0", + description="Radicale CalDAV Server", + author="Guillaume Ayoub", + author_email="guillaume.ayoub@kozea.fr", + url="http://www.radicale.org/", + license="GNU GPL v3", + requires=["twisted.web"], + packages=["radicale", "radicale.acl", "radicale.support"], + scripts=["radicale.py"], + cmdclass={'clean': Clean, + "build_scripts": BuildScripts})