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.

46 lines
1.6 KiB

  1. #!/usr/bin/env python2
  2. #-*- coding: utf-8 -*-
  3. # Copyright 2010 Calculate Ltd. http://www.calculate-linux.org
  4. #
  5. # Licensed under the Apache License, Version 2.0 (the "License");
  6. # you may not use this file except in compliance with the License.
  7. # You may obtain a copy of the License at
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  11. # Unless required by applicable law or agreed to in writing, software
  12. # distributed under the License is distributed on an "AS IS" BASIS,
  13. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. # See the License for the specific language governing permissions and
  15. # limitations under the License.
  16. import sys
  17. import os
  18. sys.path.insert(0,os.path.abspath('/usr/lib/calculate-2.2/calculate-lib/pym'))
  19. from update_config.cl_update_config_cmd import update_cmd
  20. import cl_lang
  21. # Перевод модуля
  22. tr = cl_lang.lang()
  23. tr.setLocalDomain('cl_lib')
  24. tr.setLanguage(sys.modules[__name__])
  25. if __name__ == "__main__":
  26. obj = update_cmd()
  27. ret = obj.optobj.parse_args()
  28. if ret is False:
  29. sys.exit(1)
  30. opts, args = ret
  31. programName = args[0]
  32. # Установка цвета печати сообщений
  33. obj.setPrintNoColor(opts)
  34. # Выполняем логику программы
  35. if opts.system:
  36. if not obj.updateSystemConfig(programName,opts.pkg_category,
  37. opts.pkg_version, opts.path):
  38. sys.exit(1)
  39. if opts.desktop:
  40. if not obj.updateUserConfig(programName, opts.pkg_category,
  41. opts.pkg_version):
  42. sys.exit(1)
  43. sys.exit(0)