You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
2.9 KiB

  1. #!/usr/bin/env python2
  2. # -*- coding: utf-8 -*-
  3. # setup.py --- Setup script for calculate-lib
  4. # Copyright 2008-2010 Calculate Ltd. http://www.calculate-linux.org
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. import sys, os
  18. from distutils.core import setup
  19. from distutils.command.build_scripts import build_scripts
  20. from distutils.command.install_scripts import install_scripts
  21. __version__ = "2.2.30"
  22. __app__ = "calculate-lib"
  23. class cl_build_scripts(build_scripts):
  24. """Class for build scripts"""
  25. def run (self):
  26. scripts = ['./scripts/cl-update-config']
  27. backup_build_dir = self.build_dir
  28. backup_scripts = filter(lambda x: not x in scripts, self.scripts)
  29. self.scripts = scripts
  30. self.build_dir = self.build_dir + "-bin"
  31. build_scripts.run(self)
  32. if backup_scripts:
  33. self.scripts = backup_scripts
  34. self.build_dir = backup_build_dir
  35. build_scripts.run(self)
  36. class cl_install_scripts(install_scripts):
  37. """Class for install scripts"""
  38. def run (self):
  39. backup_install_dir = self.install_dir
  40. backup_build_dir = self.build_dir
  41. cl_cmd_obj = self.distribution.get_command_obj("install")
  42. self.build_dir = self.build_dir + "-bin"
  43. self.install_dir = os.path.join(cl_cmd_obj.install_platlib, __app__,
  44. "bin")
  45. install_scripts.run(self)
  46. if os.path.exists(backup_build_dir):
  47. self.build_dir = backup_build_dir
  48. self.install_dir = backup_install_dir
  49. install_scripts.run(self)
  50. setup(
  51. name = __app__,
  52. version = __version__,
  53. description = "The library for Calculate 2",
  54. author = "Mir Calculate Ltd.",
  55. author_email = "support@calculate.ru",
  56. url = "http://calculate-linux.org",
  57. license = "http://www.apache.org/licenses/LICENSE-2.0",
  58. package_dir = {'calculate-lib': "."},
  59. packages = ['calculate-lib.pym',
  60. 'calculate-lib.pym.format',
  61. 'calculate-lib.pym.server',
  62. 'calculate-lib.pym.client',
  63. 'calculate-lib.pym.update_config',
  64. 'calculate-lib.pym.utils',
  65. 'calculate-lib.pym.mod'],
  66. data_files = [("/etc/calculate", []),
  67. ("/var/calculate/remote", []),
  68. ("/var/log/calculate", [])],
  69. scripts=["./scripts/cl-update-config"],
  70. cmdclass={'build_scripts':cl_build_scripts,
  71. 'install_scripts':cl_install_scripts},
  72. )