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:
parent
9cbba31054
commit
0c012a93c4
@ -158,7 +158,7 @@ def setup_config_settings(options):
|
||||
if os.path.isfile(localconf):
|
||||
conf = localconf
|
||||
config = configparser.ConfigParser()
|
||||
## Load default config always
|
||||
# Load default config always
|
||||
config.readfp(StringIO(DEFAULT_CONF))
|
||||
if os.path.isfile(conf):
|
||||
logger.debug("Reading config from {0}".format(conf))
|
||||
|
@ -421,7 +421,7 @@ def trigger_builds(parser, xml_parent, data):
|
||||
parameterName = XML.SubElement(params, 'parameterName')
|
||||
parameterName.text = factory['parameter-name']
|
||||
if (factory['factory'] == 'filebuild' or
|
||||
factory['factory'] == 'binaryfile'):
|
||||
factory['factory'] == 'binaryfile'):
|
||||
filePattern = XML.SubElement(params, 'filePattern')
|
||||
filePattern.text = factory['file-pattern']
|
||||
noFilesFoundAction = XML.SubElement(
|
||||
@ -938,7 +938,7 @@ def conditional_step(parser, xml_parent, data):
|
||||
|
||||
br = XML.SubElement(ctag, 'bestResult')
|
||||
br_name = cdata['condition-best']
|
||||
if not br_name in hudson_model.THRESHOLDS:
|
||||
if br_name not in hudson_model.THRESHOLDS:
|
||||
raise JenkinsJobsException(
|
||||
"threshold must be one of %s" %
|
||||
", ".join(hudson_model.THRESHOLDS.keys()))
|
||||
|
@ -195,7 +195,7 @@ def throttle(parser, xml_parent, data):
|
||||
XML.SubElement(throttle, 'maxConcurrentTotal').text = str(
|
||||
data.get('max-total', '0'))
|
||||
# TODO: What's "categories"?
|
||||
#XML.SubElement(throttle, 'categories')
|
||||
# XML.SubElement(throttle, 'categories')
|
||||
if data.get('enabled', True):
|
||||
XML.SubElement(throttle, 'throttleEnabled').text = 'true'
|
||||
else:
|
||||
|
@ -209,14 +209,14 @@ def trigger_parameterized_builds(parser, xml_parent, data):
|
||||
'BuildTriggerConfig')
|
||||
tconfigs = XML.SubElement(tconfig, 'configs')
|
||||
if ('predefined-parameters' in project_def
|
||||
or 'git-revision' in project_def
|
||||
or 'property-file' in project_def
|
||||
or 'current-parameters' in project_def
|
||||
or 'node-parameters' in project_def
|
||||
or 'svn-revision' in project_def
|
||||
or 'restrict-matrix-project' in project_def
|
||||
or 'node-label-name' in project_def
|
||||
or 'node-label' in project_def):
|
||||
or 'git-revision' in project_def
|
||||
or 'property-file' in project_def
|
||||
or 'current-parameters' in project_def
|
||||
or 'node-parameters' in project_def
|
||||
or 'svn-revision' in project_def
|
||||
or 'restrict-matrix-project' in project_def
|
||||
or 'node-label-name' in project_def
|
||||
or 'node-label' in project_def):
|
||||
|
||||
if 'predefined-parameters' in project_def:
|
||||
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',
|
||||
False)).lower()
|
||||
if ('current-parameters' in project_def
|
||||
and project_def['current-parameters']):
|
||||
and project_def['current-parameters']):
|
||||
XML.SubElement(tconfigs,
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'CurrentBuildParameters')
|
||||
if ('node-parameters' in project_def
|
||||
and project_def['node-parameters']):
|
||||
and project_def['node-parameters']):
|
||||
XML.SubElement(tconfigs,
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'NodeParameters')
|
||||
@ -255,14 +255,14 @@ def trigger_parameterized_builds(parser, xml_parent, data):
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'SubversionRevisionBuildParameters')
|
||||
if ('restrict-matrix-project' in project_def
|
||||
and project_def['restrict-matrix-project']):
|
||||
and project_def['restrict-matrix-project']):
|
||||
subset = XML.SubElement(tconfigs,
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'matrix.MatrixSubsetBuildParameters')
|
||||
XML.SubElement(subset, 'filter').text = \
|
||||
project_def['restrict-matrix-project']
|
||||
if 'node-label-name' in project_def or \
|
||||
'node-label' in project_def:
|
||||
if ('node-label-name' in project_def or
|
||||
'node-label' in project_def):
|
||||
params = XML.SubElement(tconfigs,
|
||||
'org.jvnet.jenkins.plugins.'
|
||||
'nodelabelparameter.'
|
||||
@ -1041,23 +1041,22 @@ def violations(parser, xml_parent, data):
|
||||
configs = XML.SubElement(config, 'typeConfigs')
|
||||
XML.SubElement(configs, 'no-comparator')
|
||||
|
||||
for name in [
|
||||
'checkstyle',
|
||||
'codenarc',
|
||||
'cpd',
|
||||
'cpplint',
|
||||
'csslint',
|
||||
'findbugs',
|
||||
'fxcop',
|
||||
'gendarme',
|
||||
'jcreport',
|
||||
'jslint',
|
||||
'pep8',
|
||||
'perlcritic',
|
||||
'pmd',
|
||||
'pylint',
|
||||
'simian',
|
||||
'stylecop']:
|
||||
for name in ['checkstyle',
|
||||
'codenarc',
|
||||
'cpd',
|
||||
'cpplint',
|
||||
'csslint',
|
||||
'findbugs',
|
||||
'fxcop',
|
||||
'gendarme',
|
||||
'jcreport',
|
||||
'jslint',
|
||||
'pep8',
|
||||
'perlcritic',
|
||||
'pmd',
|
||||
'pylint',
|
||||
'simian',
|
||||
'stylecop']:
|
||||
_violations_add_entry(configs, name, data.get(name, {}))
|
||||
|
||||
XML.SubElement(config, 'limit').text = '100'
|
||||
@ -1294,7 +1293,7 @@ def pipeline(parser, xml_parent, data):
|
||||
properties.text = data['predefined-parameters']
|
||||
|
||||
if ('current-parameters' in data
|
||||
and data['current-parameters']):
|
||||
and data['current-parameters']):
|
||||
XML.SubElement(configs,
|
||||
'hudson.plugins.parameterizedtrigger.'
|
||||
'CurrentBuildParameters')
|
||||
@ -1496,7 +1495,7 @@ def email_ext(parser, xml_parent, data):
|
||||
'only-configurations': 'ONLY_CONFIGURATIONS',
|
||||
'only-parent': 'ONLY_PARENT'}
|
||||
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 not in matrix_dict:
|
||||
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
|
||||
detect_modules = str(data.get('detect-modules', False)).lower()
|
||||
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 = \
|
||||
str(not data.get('resolve-relative-paths', False)).lower()
|
||||
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_name = cdata['condition-best']
|
||||
if not br_name in hudson_model.THRESHOLDS:
|
||||
if br_name not in hudson_model.THRESHOLDS:
|
||||
raise JenkinsJobsException(
|
||||
"threshold must be one of %s" %
|
||||
", ".join(hudson_model.THRESHOLDS.keys()))
|
||||
|
@ -348,8 +348,8 @@ remoteName/\*')
|
||||
valid[-1]))
|
||||
if browser != 'auto':
|
||||
bc = XML.SubElement(scm, 'browser', {'class':
|
||||
'hudson.plugins.git.browser.' +
|
||||
browserdict[browser]})
|
||||
'hudson.plugins.git.browser.' +
|
||||
browserdict[browser]})
|
||||
XML.SubElement(bc, 'url').text = data['browser-url']
|
||||
if browser in ['gitblit', 'viewgit']:
|
||||
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.'
|
||||
'TeamFoundationServerScm'})
|
||||
tfs = XML.SubElement(xml_parent, 'scm',
|
||||
{'class': 'hudson.plugins.tfs.'
|
||||
'TeamFoundationServerScm'})
|
||||
XML.SubElement(tfs, 'serverUrl').text = str(
|
||||
data.get('server-url', ''))
|
||||
XML.SubElement(tfs, 'projectPath').text = str(
|
||||
@ -709,9 +710,9 @@ def tfs(parser, xml_parent, data):
|
||||
data.get('use-update', True))
|
||||
store = data.get('web-access', None)
|
||||
if 'web-access' in data and isinstance(store, list):
|
||||
web = XML.SubElement(tfs, 'repositoryBrowser', {'class': 'hudson.'
|
||||
'plugins.tfs.browsers.'
|
||||
'TeamSystemWebAccessBrowser'})
|
||||
web = XML.SubElement(tfs, 'repositoryBrowser',
|
||||
{'class': 'hudson.plugins.tfs.browsers.'
|
||||
'TeamSystemWebAccessBrowser'})
|
||||
XML.SubElement(web, 'url').text = str(store[0].get('web-url', None))
|
||||
elif 'web-access' in data and store is None:
|
||||
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 "
|
||||
"of: %s" % ", ".join(browserdict.keys()))
|
||||
if browser != 'auto':
|
||||
bc = XML.SubElement(scm, 'browser', {'class':
|
||||
'hudson.plugins.mercurial.browser.' +
|
||||
browserdict[browser]})
|
||||
bc = XML.SubElement(scm, 'browser',
|
||||
{'class': 'hudson.plugins.mercurial.browser.' +
|
||||
browserdict[browser]})
|
||||
if 'browser-url' in data:
|
||||
XML.SubElement(bc, 'url').text = data['browser-url']
|
||||
else:
|
||||
|
@ -162,7 +162,7 @@ class Zuul(jenkins_jobs.modules.base.Base):
|
||||
continue
|
||||
|
||||
if ('zuul' not in job.get('triggers', []) and
|
||||
'zuul-post' not in job.get('triggers', [])):
|
||||
'zuul-post' not in job.get('triggers', [])):
|
||||
continue
|
||||
if 'parameters' not in job:
|
||||
job['parameters'] = []
|
||||
|
@ -1,4 +1,4 @@
|
||||
hacking>=0.5.6,<0.8
|
||||
hacking>=0.5.6,<=10.1
|
||||
coverage>=3.6
|
||||
discover
|
||||
fixtures
|
||||
|
Loading…
Reference in New Issue
Block a user