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.

101 lines
3.8 KiB

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