Python Build Reasonableness
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.

67 lines
2.4KB

  1. # Copyright 2013 Hewlett-Packard Development Company, L.P.
  2. # All Rights Reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License"); you may
  5. # not use this file except in compliance with the License. You may obtain
  6. # a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. # License for the specific language governing permissions and limitations
  14. # under the License.
  15. import os
  16. from setuptools.command import easy_install
  17. from pbr.hooks import base
  18. from pbr import options
  19. from pbr import packaging
  20. class CommandsConfig(base.BaseConfig):
  21. section = 'global'
  22. def __init__(self, config):
  23. super(CommandsConfig, self).__init__(config)
  24. self.commands = self.config.get('commands', "")
  25. def save(self):
  26. self.config['commands'] = self.commands
  27. super(CommandsConfig, self).save()
  28. def add_command(self, command):
  29. self.commands = "%s\n%s" % (self.commands, command)
  30. def hook(self):
  31. self.add_command('pbr.packaging.LocalEggInfo')
  32. self.add_command('pbr.packaging.LocalSDist')
  33. self.add_command('pbr.packaging.LocalInstallScripts')
  34. self.add_command('pbr.packaging.LocalDevelop')
  35. self.add_command('pbr.packaging.LocalRPMVersion')
  36. self.add_command('pbr.packaging.LocalDebVersion')
  37. if os.name != 'nt':
  38. easy_install.get_script_args = packaging.override_get_script_args
  39. if packaging.have_sphinx():
  40. self.add_command('pbr.builddoc.LocalBuildDoc')
  41. if os.path.exists('.testr.conf') and packaging.have_testr():
  42. # There is a .testr.conf file. We want to use it.
  43. self.add_command('pbr.packaging.TestrTest')
  44. elif self.config.get('nosetests', False) and packaging.have_nose():
  45. # We seem to still have nose configured
  46. self.add_command('pbr.packaging.NoseTest')
  47. use_egg = options.get_boolean_option(
  48. self.pbr_config, 'use-egg', 'PBR_USE_EGG')
  49. # We always want non-egg install unless explicitly requested
  50. if 'manpages' in self.pbr_config or not use_egg:
  51. self.add_command('pbr.packaging.LocalInstall')
  52. else:
  53. self.add_command('pbr.packaging.InstallWithGit')