1 # Copyright 2013 Hewlett-Packard Development Company, L.P.
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
8 # http://www.apache.org/licenses/LICENSE-2.0
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
18 from setuptools.command import easy_install
20 from pbr.hooks import base
21 from pbr import options
22 from pbr import packaging
25 class CommandsConfig(base.BaseConfig):
29 def __init__(self, config):
30 super(CommandsConfig, self).__init__(config)
31 self.commands = self.config.get('commands', "")
34 self.config['commands'] = self.commands
35 super(CommandsConfig, self).save()
37 def add_command(self, command):
38 self.commands = "%s\n%s" % (self.commands, command)
41 self.add_command('pbr.packaging.LocalEggInfo')
42 self.add_command('pbr.packaging.LocalSDist')
43 self.add_command('pbr.packaging.LocalInstallScripts')
44 self.add_command('pbr.packaging.LocalDevelop')
45 self.add_command('pbr.packaging.LocalRPMVersion')
46 self.add_command('pbr.packaging.LocalDebVersion')
48 easy_install.get_script_args = packaging.override_get_script_args
50 if packaging.have_sphinx():
51 self.add_command('pbr.builddoc.LocalBuildDoc')
53 if os.path.exists('.testr.conf') and packaging.have_testr():
54 # There is a .testr.conf file. We want to use it.
55 self.add_command('pbr.packaging.TestrTest')
56 elif self.config.get('nosetests', False) and packaging.have_nose():
57 # We seem to still have nose configured
58 self.add_command('pbr.packaging.NoseTest')
60 use_egg = options.get_boolean_option(
61 self.pbr_config, 'use-egg', 'PBR_USE_EGG')
62 # We always want non-egg install unless explicitly requested
63 if 'manpages' in self.pbr_config or not use_egg:
64 self.add_command('pbr.packaging.LocalInstall')
66 self.add_command('pbr.packaging.InstallWithGit')