Support hacking module <= 0.10.1

Update version restrictions to allow hacking module <= 0.10.1 and fix
any style errors reported by the latest version.

Change-Id: Ia608096342b11e411e56a86e8f289f9891077895
This commit is contained in:
Darragh Bailey 2015-02-21 20:12:08 +00:00
parent 9cbba31054
commit 0c012a93c4
7 changed files with 50 additions and 50 deletions

View File

@ -158,7 +158,7 @@ def setup_config_settings(options):
if os.path.isfile(localconf): if os.path.isfile(localconf):
conf = localconf conf = localconf
config = configparser.ConfigParser() config = configparser.ConfigParser()
## Load default config always # Load default config always
config.readfp(StringIO(DEFAULT_CONF)) config.readfp(StringIO(DEFAULT_CONF))
if os.path.isfile(conf): if os.path.isfile(conf):
logger.debug("Reading config from {0}".format(conf)) logger.debug("Reading config from {0}".format(conf))

View File

@ -421,7 +421,7 @@ def trigger_builds(parser, xml_parent, data):
parameterName = XML.SubElement(params, 'parameterName') parameterName = XML.SubElement(params, 'parameterName')
parameterName.text = factory['parameter-name'] parameterName.text = factory['parameter-name']
if (factory['factory'] == 'filebuild' or if (factory['factory'] == 'filebuild' or
factory['factory'] == 'binaryfile'): factory['factory'] == 'binaryfile'):
filePattern = XML.SubElement(params, 'filePattern') filePattern = XML.SubElement(params, 'filePattern')
filePattern.text = factory['file-pattern'] filePattern.text = factory['file-pattern']
noFilesFoundAction = XML.SubElement( noFilesFoundAction = XML.SubElement(
@ -938,7 +938,7 @@ def conditional_step(parser, xml_parent, data):
br = XML.SubElement(ctag, 'bestResult') br = XML.SubElement(ctag, 'bestResult')
br_name = cdata['condition-best'] br_name = cdata['condition-best']
if not br_name in hudson_model.THRESHOLDS: if br_name not in hudson_model.THRESHOLDS:
raise JenkinsJobsException( raise JenkinsJobsException(
"threshold must be one of %s" % "threshold must be one of %s" %
", ".join(hudson_model.THRESHOLDS.keys())) ", ".join(hudson_model.THRESHOLDS.keys()))

View File

@ -195,7 +195,7 @@ def throttle(parser, xml_parent, data):
XML.SubElement(throttle, 'maxConcurrentTotal').text = str( XML.SubElement(throttle, 'maxConcurrentTotal').text = str(
data.get('max-total', '0')) data.get('max-total', '0'))
# TODO: What's "categories"? # TODO: What's "categories"?
#XML.SubElement(throttle, 'categories') # XML.SubElement(throttle, 'categories')
if data.get('enabled', True): if data.get('enabled', True):
XML.SubElement(throttle, 'throttleEnabled').text = 'true' XML.SubElement(throttle, 'throttleEnabled').text = 'true'
else: else:

View File

@ -209,14 +209,14 @@ def trigger_parameterized_builds(parser, xml_parent, data):
'BuildTriggerConfig') 'BuildTriggerConfig')
tconfigs = XML.SubElement(tconfig, 'configs') tconfigs = XML.SubElement(tconfig, 'configs')
if ('predefined-parameters' in project_def if ('predefined-parameters' in project_def
or 'git-revision' in project_def or 'git-revision' in project_def
or 'property-file' in project_def or 'property-file' in project_def
or 'current-parameters' in project_def or 'current-parameters' in project_def
or 'node-parameters' in project_def or 'node-parameters' in project_def
or 'svn-revision' in project_def or 'svn-revision' in project_def
or 'restrict-matrix-project' in project_def or 'restrict-matrix-project' in project_def
or 'node-label-name' in project_def or 'node-label-name' in project_def
or 'node-label' in project_def): or 'node-label' in project_def):
if 'predefined-parameters' in project_def: if 'predefined-parameters' in project_def:
params = XML.SubElement(tconfigs, params = XML.SubElement(tconfigs,
@ -241,12 +241,12 @@ def trigger_parameterized_builds(parser, xml_parent, data):
failOnMissing.text = str(project_def.get('fail-on-missing', failOnMissing.text = str(project_def.get('fail-on-missing',
False)).lower() False)).lower()
if ('current-parameters' in project_def if ('current-parameters' in project_def
and project_def['current-parameters']): and project_def['current-parameters']):
XML.SubElement(tconfigs, XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.' 'hudson.plugins.parameterizedtrigger.'
'CurrentBuildParameters') 'CurrentBuildParameters')
if ('node-parameters' in project_def if ('node-parameters' in project_def
and project_def['node-parameters']): and project_def['node-parameters']):
XML.SubElement(tconfigs, XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.' 'hudson.plugins.parameterizedtrigger.'
'NodeParameters') 'NodeParameters')
@ -255,14 +255,14 @@ def trigger_parameterized_builds(parser, xml_parent, data):
'hudson.plugins.parameterizedtrigger.' 'hudson.plugins.parameterizedtrigger.'
'SubversionRevisionBuildParameters') 'SubversionRevisionBuildParameters')
if ('restrict-matrix-project' in project_def if ('restrict-matrix-project' in project_def
and project_def['restrict-matrix-project']): and project_def['restrict-matrix-project']):
subset = XML.SubElement(tconfigs, subset = XML.SubElement(tconfigs,
'hudson.plugins.parameterizedtrigger.' 'hudson.plugins.parameterizedtrigger.'
'matrix.MatrixSubsetBuildParameters') 'matrix.MatrixSubsetBuildParameters')
XML.SubElement(subset, 'filter').text = \ XML.SubElement(subset, 'filter').text = \
project_def['restrict-matrix-project'] project_def['restrict-matrix-project']
if 'node-label-name' in project_def or \ if ('node-label-name' in project_def or
'node-label' in project_def: 'node-label' in project_def):
params = XML.SubElement(tconfigs, params = XML.SubElement(tconfigs,
'org.jvnet.jenkins.plugins.' 'org.jvnet.jenkins.plugins.'
'nodelabelparameter.' 'nodelabelparameter.'
@ -1041,23 +1041,22 @@ def violations(parser, xml_parent, data):
configs = XML.SubElement(config, 'typeConfigs') configs = XML.SubElement(config, 'typeConfigs')
XML.SubElement(configs, 'no-comparator') XML.SubElement(configs, 'no-comparator')
for name in [ for name in ['checkstyle',
'checkstyle', 'codenarc',
'codenarc', 'cpd',
'cpd', 'cpplint',
'cpplint', 'csslint',
'csslint', 'findbugs',
'findbugs', 'fxcop',
'fxcop', 'gendarme',
'gendarme', 'jcreport',
'jcreport', 'jslint',
'jslint', 'pep8',
'pep8', 'perlcritic',
'perlcritic', 'pmd',
'pmd', 'pylint',
'pylint', 'simian',
'simian', 'stylecop']:
'stylecop']:
_violations_add_entry(configs, name, data.get(name, {})) _violations_add_entry(configs, name, data.get(name, {}))
XML.SubElement(config, 'limit').text = '100' XML.SubElement(config, 'limit').text = '100'
@ -1294,7 +1293,7 @@ def pipeline(parser, xml_parent, data):
properties.text = data['predefined-parameters'] properties.text = data['predefined-parameters']
if ('current-parameters' in data if ('current-parameters' in data
and data['current-parameters']): and data['current-parameters']):
XML.SubElement(configs, XML.SubElement(configs,
'hudson.plugins.parameterizedtrigger.' 'hudson.plugins.parameterizedtrigger.'
'CurrentBuildParameters') 'CurrentBuildParameters')
@ -1496,7 +1495,7 @@ def email_ext(parser, xml_parent, data):
'only-configurations': 'ONLY_CONFIGURATIONS', 'only-configurations': 'ONLY_CONFIGURATIONS',
'only-parent': 'ONLY_PARENT'} 'only-parent': 'ONLY_PARENT'}
matrix_trigger = data.get('matrix-trigger', None) matrix_trigger = data.get('matrix-trigger', None)
## If none defined, then do not create entry # If none defined, then do not create entry
if matrix_trigger is not None: if matrix_trigger is not None:
if matrix_trigger not in matrix_dict: if matrix_trigger not in matrix_dict:
raise JenkinsJobsException("matrix-trigger entered is not valid, " raise JenkinsJobsException("matrix-trigger entered is not valid, "
@ -2802,7 +2801,7 @@ def warnings(parser, xml_parent, data):
XML.SubElement(warnings, 'canRunOnFailed').text = run_always XML.SubElement(warnings, 'canRunOnFailed').text = run_always
detect_modules = str(data.get('detect-modules', False)).lower() detect_modules = str(data.get('detect-modules', False)).lower()
XML.SubElement(warnings, 'shouldDetectModules').text = detect_modules XML.SubElement(warnings, 'shouldDetectModules').text = detect_modules
#Note the logic reversal (included here to match the GUI) # Note the logic reversal (included here to match the GUI)
XML.SubElement(warnings, 'doNotResolveRelativePaths').text = \ XML.SubElement(warnings, 'doNotResolveRelativePaths').text = \
str(not data.get('resolve-relative-paths', False)).lower() str(not data.get('resolve-relative-paths', False)).lower()
health_threshold_high = str(data.get('health-threshold-high', '')) health_threshold_high = str(data.get('health-threshold-high', ''))
@ -4148,7 +4147,7 @@ def conditional_publisher(parser, xml_parent, data):
br = XML.SubElement(ctag, 'bestResult') br = XML.SubElement(ctag, 'bestResult')
br_name = cdata['condition-best'] br_name = cdata['condition-best']
if not br_name in hudson_model.THRESHOLDS: if br_name not in hudson_model.THRESHOLDS:
raise JenkinsJobsException( raise JenkinsJobsException(
"threshold must be one of %s" % "threshold must be one of %s" %
", ".join(hudson_model.THRESHOLDS.keys())) ", ".join(hudson_model.THRESHOLDS.keys()))

View File

@ -348,8 +348,8 @@ remoteName/\*')
valid[-1])) valid[-1]))
if browser != 'auto': if browser != 'auto':
bc = XML.SubElement(scm, 'browser', {'class': bc = XML.SubElement(scm, 'browser', {'class':
'hudson.plugins.git.browser.' + 'hudson.plugins.git.browser.' +
browserdict[browser]}) browserdict[browser]})
XML.SubElement(bc, 'url').text = data['browser-url'] XML.SubElement(bc, 'url').text = data['browser-url']
if browser in ['gitblit', 'viewgit']: if browser in ['gitblit', 'viewgit']:
XML.SubElement(bc, 'projectName').text = str( XML.SubElement(bc, 'projectName').text = str(
@ -689,8 +689,9 @@ def tfs(parser, xml_parent, data):
""" """
tfs = XML.SubElement(xml_parent, 'scm', {'class': 'hudson.plugins.tfs.' tfs = XML.SubElement(xml_parent, 'scm',
'TeamFoundationServerScm'}) {'class': 'hudson.plugins.tfs.'
'TeamFoundationServerScm'})
XML.SubElement(tfs, 'serverUrl').text = str( XML.SubElement(tfs, 'serverUrl').text = str(
data.get('server-url', '')) data.get('server-url', ''))
XML.SubElement(tfs, 'projectPath').text = str( XML.SubElement(tfs, 'projectPath').text = str(
@ -709,9 +710,9 @@ def tfs(parser, xml_parent, data):
data.get('use-update', True)) data.get('use-update', True))
store = data.get('web-access', None) store = data.get('web-access', None)
if 'web-access' in data and isinstance(store, list): if 'web-access' in data and isinstance(store, list):
web = XML.SubElement(tfs, 'repositoryBrowser', {'class': 'hudson.' web = XML.SubElement(tfs, 'repositoryBrowser',
'plugins.tfs.browsers.' {'class': 'hudson.plugins.tfs.browsers.'
'TeamSystemWebAccessBrowser'}) 'TeamSystemWebAccessBrowser'})
XML.SubElement(web, 'url').text = str(store[0].get('web-url', None)) XML.SubElement(web, 'url').text = str(store[0].get('web-url', None))
elif 'web-access' in data and store is None: elif 'web-access' in data and store is None:
XML.SubElement(tfs, 'repositoryBrowser', {'class': 'hudson.' XML.SubElement(tfs, 'repositoryBrowser', {'class': 'hudson.'
@ -848,9 +849,9 @@ def hg(self, xml_parent, data):
raise JenkinsJobsException("Browser entered is not valid must be one " raise JenkinsJobsException("Browser entered is not valid must be one "
"of: %s" % ", ".join(browserdict.keys())) "of: %s" % ", ".join(browserdict.keys()))
if browser != 'auto': if browser != 'auto':
bc = XML.SubElement(scm, 'browser', {'class': bc = XML.SubElement(scm, 'browser',
'hudson.plugins.mercurial.browser.' + {'class': 'hudson.plugins.mercurial.browser.' +
browserdict[browser]}) browserdict[browser]})
if 'browser-url' in data: if 'browser-url' in data:
XML.SubElement(bc, 'url').text = data['browser-url'] XML.SubElement(bc, 'url').text = data['browser-url']
else: else:

View File

@ -162,7 +162,7 @@ class Zuul(jenkins_jobs.modules.base.Base):
continue continue
if ('zuul' not in job.get('triggers', []) and if ('zuul' not in job.get('triggers', []) and
'zuul-post' not in job.get('triggers', [])): 'zuul-post' not in job.get('triggers', [])):
continue continue
if 'parameters' not in job: if 'parameters' not in job:
job['parameters'] = [] job['parameters'] = []

View File

@ -1,4 +1,4 @@
hacking>=0.5.6,<0.8 hacking>=0.5.6,<=10.1
coverage>=3.6 coverage>=3.6
discover discover
fixtures fixtures