Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

90 wiersze
3.4 KiB

  1. #!/usr/bin/env python2
  2. # -*- coding: utf-8 -*-
  3. # setup.py --- Setup script for calculate-update
  4. # Copyright 2012-2016 Mir Calculate. 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. __app__ = "calculate-update"
  18. __version__ = "3.2.2"
  19. import os
  20. from glob import glob
  21. from distutils.core import setup
  22. from distutils.command import install_data as module_install_data
  23. from distutils.util import change_root, convert_path
  24. class install_data(module_install_data.install_data):
  25. def run (self):
  26. self.mkpath(self.install_dir)
  27. for f in self.data_files:
  28. if isinstance(f, str):
  29. # it's a simple file, so copy it
  30. f = convert_path(f)
  31. if self.warn_dir:
  32. self.warn("setup script did not provide a directory for "
  33. "'%s' -- installing right in '%s'" %
  34. (f, self.install_dir))
  35. (out, _) = self.copy_file(f, self.install_dir)
  36. self.outfiles.append(out)
  37. else:
  38. # it's a tuple with path to install to and a list of files
  39. dir = convert_path(f[0])
  40. if not os.path.isabs(dir):
  41. dir = os.path.join(self.install_dir, dir)
  42. elif self.root:
  43. dir = change_root(self.root, dir)
  44. self.mkpath(dir)
  45. if f[1] == []:
  46. # If there are no files listed, the user must be
  47. # trying to create an empty directory, so add the
  48. # directory to the list of output files.
  49. self.outfiles.append(dir)
  50. else:
  51. # Copy files, adding them to the list of output files.
  52. for data in f[1]:
  53. # is's a simple filename without chmod
  54. if isinstance(data,str):
  55. chmod = None
  56. else:
  57. data, chmod = data
  58. data = convert_path(data)
  59. (out, _) = self.copy_file(data, dir)
  60. if chmod and os.stat(out).st_mode != chmod:
  61. os.chmod(out,chmod)
  62. self.outfiles.append(out)
  63. data_files = [('/usr/libexec/calculate', [('data/cl-git-wrapper', 0755)])]
  64. packages = [
  65. "calculate."+str('.'.join(root.split(os.sep)[1:]))
  66. for root, dirs, files in os.walk('pym/update')
  67. if '__init__.py' in files
  68. ]
  69. setup(
  70. name=__app__,
  71. version=__version__,
  72. description="Update system utilities",
  73. author="Calculate Ltd.",
  74. author_email="support@calculate.ru",
  75. url="http://calculate-linux.org",
  76. license="http://www.apache.org/licenses/LICENSE-2.0",
  77. package_dir = {'calculate.update': "pym/update"},
  78. packages = packages,
  79. data_files=data_files,
  80. cmdclass={'install_data': install_data})