setup.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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 © 2008-2009 Guillaume Ayoub
  6. # Copyright © 2008 Nicolas Kandel
  7. # Copyright © 2008 Pascal Halter
  8. #
  9. # This library 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 3 of the License, or
  12. # (at your option) any later version.
  13. #
  14. # This library 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 Radicale. If not, see <http://www.gnu.org/licenses/>.
  21. import os
  22. import shutil
  23. from distutils.core import setup, Command
  24. from distutils.command.build_scripts import build_scripts
  25. class BuildScripts(build_scripts):
  26. def run(self):
  27. self.mkpath(self.build_dir)
  28. for script in self.scripts:
  29. root, ext = os.path.splitext(script)
  30. self.copy_file(script, os.path.join(self.build_dir, root))
  31. class Clean(Command):
  32. description = "clean up package temporary files"
  33. user_options = []
  34. def initialize_options(self):
  35. pass
  36. def finalize_options(self):
  37. pass
  38. def run(self):
  39. path = os.path.abspath(os.path.dirname(__file__))
  40. for pathname, _, files in os.walk(path):
  41. for filename in filter(self._should_remove, files):
  42. os.unlink(os.path.join(pathname, filename))
  43. for folder in ("build", "dist"):
  44. if os.path.isdir(os.path.join(path, folder)):
  45. shutil.rmtree(os.path.join(path, folder))
  46. if os.path.isfile(os.path.join(path, "MANIFEST")):
  47. os.unlink(os.path.join(path, "MANIFEST"))
  48. @staticmethod
  49. def _should_remove(filename):
  50. return (os.path.splitext(filename) == ".pyc" or
  51. os.path.splitext(filename) == ".pyo" or
  52. filename.endswith("~") or
  53. (filename.startswith("#") and filename.endswith("#")))
  54. setup(
  55. name="Radicale",
  56. version="0.0",
  57. description="Radicale CalDAV Server",
  58. author="Guillaume Ayoub",
  59. author_email="guillaume.ayoub@kozea.fr",
  60. url="http://www.radicale.org/",
  61. license="GNU GPL v3",
  62. requires=["twisted.web"],
  63. packages=["radicale", "radicale.acl", "radicale.support"],
  64. scripts=["radicale.py"],
  65. cmdclass={'clean': Clean,
  66. "build_scripts": BuildScripts})