jenkinsapi 0.3.14.dev5__tar.gz → 0.3.15.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/PKG-INFO +52 -81
  2. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/README.rst +50 -77
  3. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/__init__.py +8 -12
  4. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/build.py +1 -1
  5. jenkinsapi-0.3.15.dev2/jenkinsapi/command_line/jenkinsapi_version.py +12 -0
  6. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/fingerprint.py +1 -1
  7. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/node.py +50 -1
  8. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/queue.py +3 -2
  9. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/jsonp_to_json.py +0 -2
  10. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/manifest.py +11 -6
  11. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/requester.py +8 -7
  12. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/simple_post_logger.py +0 -1
  13. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/views.py +1 -2
  14. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/pyproject.toml +3 -4
  15. jenkinsapi-0.3.14.dev5/jenkinsapi/command_line/jenkinsapi_version.py +0 -13
  16. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/LICENSE +0 -0
  17. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/.gitignore +0 -0
  18. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/api.py +0 -0
  19. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/artifact.py +0 -0
  20. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/command_line/__init__.py +0 -0
  21. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/command_line/jenkins_invoke.py +0 -0
  22. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/config.py +0 -0
  23. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/constants.py +0 -0
  24. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/credential.py +0 -0
  25. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/credentials.py +0 -0
  26. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/custom_exceptions.py +0 -0
  27. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/executor.py +0 -0
  28. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/executors.py +0 -0
  29. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/jenkins.py +0 -0
  30. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/jenkinsbase.py +0 -0
  31. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/job.py +0 -0
  32. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/jobs.py +0 -0
  33. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/label.py +0 -0
  34. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/mutable_jenkins_thing.py +0 -0
  35. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/nodes.py +0 -0
  36. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/plugin.py +0 -0
  37. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/plugins.py +0 -0
  38. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/result.py +0 -0
  39. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/result_set.py +0 -0
  40. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/__init__.py +0 -0
  41. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/crumb_requester.py +0 -0
  42. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/jenkins_launcher.py +0 -0
  43. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/utils/krb_requester.py +0 -0
  44. {jenkinsapi-0.3.14.dev5 → jenkinsapi-0.3.15.dev2}/jenkinsapi/view.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: jenkinsapi
3
- Version: 0.3.14.dev5
3
+ Version: 0.3.15.dev2
4
4
  Summary: A Python API for accessing resources on a Jenkins continuous-integration server.
5
5
  Author-email: Salim Fadhley <salimfadhley@gmail.com>, Aleksey Maksimov <ctpeko3a@gmail.com>, Clinton Steiner <clintonsteiner@gmail.com>
6
6
  Maintainer-email: Aleksey Maksimov <ctpeko3a@gmail.com>, Clinton Steiner <clintonsteiner@gmail.com>
7
- Requires-Python: >=3.8
7
+ Requires-Python: >=3.9
8
8
  Description-Content-Type: text/x-rst
9
9
  Classifier: Development Status :: 5 - Production/Stable
10
10
  Classifier: Environment :: Console
@@ -16,7 +16,6 @@ Classifier: Natural Language :: English
16
16
  Classifier: Operating System :: OS Independent
17
17
  Classifier: Programming Language :: Python
18
18
  Classifier: Programming Language :: Python :: 3
19
- Classifier: Programming Language :: Python :: 3.8
20
19
  Classifier: Programming Language :: Python :: 3.9
21
20
  Classifier: Programming Language :: Python :: 3.10
22
21
  Classifier: Programming Language :: Python :: 3.11
@@ -27,9 +26,8 @@ Classifier: Topic :: Utilities
27
26
  License-File: LICENSE
28
27
  Requires-Dist: pytz>=2014.4
29
28
  Requires-Dist: requests>=2.3.0
30
- Requires-Dist: six>=1.10.0
31
29
 
32
- jenkinsapi
30
+ Jenkinsapi
33
31
  ==========
34
32
 
35
33
  .. image:: https://badge.fury.io/py/jenkinsapi.png
@@ -38,14 +36,31 @@ jenkinsapi
38
36
  .. image:: https://codecov.io/gh/pycontribs/jenkinsapi/branch/master/graph/badge.svg
39
37
  :target: https://codecov.io/gh/pycontribs/jenkinsapi
40
38
 
39
+ Installation
40
+ ------------
41
+
42
+ .. code-block:: bash
43
+
44
+ pip install jenkinsapi
45
+
46
+ Important Links
47
+ ---------------
48
+ * `Documentation <http://pycontribs.github.io/jenkinsapi/>`__
49
+ * `Source Code <https://github.com/pycontribs/jenkinsapi>`_
50
+ * `Support and bug-reports <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
51
+ * `Releases <https://pypi.org/project/jenkinsapi/#history>`_
52
+
53
+
41
54
  About this library
42
55
  -------------------
43
56
 
44
- Jenkins is the market leading continuous integration system, originally created by Kohsuke Kawaguchi.
57
+ Jenkins is the market leading continuous integration system.
45
58
 
46
59
  Jenkins (and its predecessor Hudson) are useful projects for automating common development tasks (e.g. unit-testing, production batches) - but they are somewhat Java-centric.
47
- | Jenkinsapi makes scripting Jenkins tasks a breeze by wrapping the REST api into familiar python objects.
48
- | Here is a list of some of the most commonly used functionality
60
+
61
+ Jenkinsapi makes scripting Jenkins tasks a breeze by wrapping the REST api into familiar python objects.
62
+
63
+ Here is a list of some of the most commonly used functionality
49
64
 
50
65
  * Add, remove, and query Jenkins jobs
51
66
  * Control pipeline execution
@@ -65,88 +80,44 @@ Jenkins (and its predecessor Hudson) are useful projects for automating common d
65
80
 
66
81
  Full library capabilities are outlined in the `Documentation <http://pycontribs.github.io/jenkinsapi/>`__
67
82
 
68
-
69
- Known issues
70
- ------------
71
- * Job deletion operations fail unless Cross-Site scripting protection is disabled.
72
-
73
- For other issues, please refer to the `support URL <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
74
-
75
- Important Links
76
- ---------------
77
- * `Support and bug-reports <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
78
- * `Source Code <https://github.com/pycontribs/jenkinsapi>`_
79
- * `Documentation <http://pycontribs.github.io/jenkinsapi/>`__
80
- * `Releases <http://pypi.python.org/pypi/jenkinsapi>`_
81
-
82
- Installation
83
- -------------
84
-
85
- Egg-files for this project are hosted on PyPi. Most Python users should be able to use pip or setuptools to automatically install this project.
86
-
87
- Using Pip or Setuptools
88
- ^^^^^^^^^^^^^^^^^^^^^^^
89
-
90
- Most users can do the following:
91
-
92
- .. code-block:: bash
93
-
94
- pip install jenkinsapi
95
-
96
- Or:
97
-
98
- .. code-block:: bash
99
-
100
- easy_install jenkinsapi
101
-
102
- Both of these techniques can be combined with virtualenv to create an application-specific installation.
103
-
104
- Using your operating-system's package manager
105
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
106
-
107
- Ubuntu users can now use apt to install this package:
108
-
109
- .. code-block:: bash
110
-
111
- apt-get install python-jenkinsapi
112
-
113
- Beware that this technique will get a somewhat older version of Jenkinsapi.
114
-
115
- Example
116
- -------
117
-
118
- JenkinsAPI is intended to map the objects in Jenkins (e.g. Builds, Views, Jobs) into easily managed Python objects:
83
+ Get details of jobs running on Jenkins server
84
+ ---------------------------------------------
119
85
 
120
86
  .. code-block:: python
121
87
 
122
- from jenkinsapi.jenkins import Jenkins
123
- J = Jenkins('http://localhost:8080')
124
- print(J.version) # 1.542
125
- print(J.keys()) # foo, test_jenkinsapi
126
- print(J.get('test_jenkinsapi')) # <jenkinsapi.job.Job test_jenkinsapi>
127
- print(J.get('test_jenkinsapi').get_last_good_build()) # <jenkinsapi.build.Build test_jenkinsapi #77>
128
-
129
- More examples available on `Github <https://github.com/pycontribs/jenkinsapi/tree/master/examples>`_
88
+ """Get job details of each job that is running on the Jenkins instance"""
89
+ def get_job_details():
90
+ # Refer Example #1 for definition of function 'get_server_instance'
91
+ server = get_server_instance()
92
+ for job_name, job_instance in server.get_jobs():
93
+ print 'Job Name:%s' % (job_instance.name)
94
+ print 'Job Description:%s' % (job_instance.get_description())
95
+ print 'Is Job running:%s' % (job_instance.is_running())
96
+ print 'Is Job enabled:%s' % (job_instance.is_enabled())
130
97
 
131
- Testing
132
- -------
98
+ Disable/Enable a Jenkins Job
99
+ ----------------------------
133
100
 
134
- If you have installed the test dependencies on your system already, you can run
135
- the testsuite with the following command:
101
+ .. code-block:: python
136
102
 
137
- .. code-block:: bash
103
+ def disable_job():
104
+ """Disable a Jenkins job"""
105
+ # Refer Example #1 for definition of function 'get_server_instance'
106
+ server = get_server_instance()
107
+ job_name = 'nightly-build-job'
108
+ if (server.has_job(job_name)):
109
+ job_instance = server.get_job(job_name)
110
+ job_instance.disable()
111
+ print 'Name:%s,Is Job Enabled ?:%s' % (job_name,job_instance.is_enabled())
138
112
 
139
- uv python sync
140
- uv run pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests
113
+ Use the call ``job_instance.enable()`` to enable a Jenkins Job.
141
114
 
142
- Otherwise using a virtualenv is recommended. Setuptools will automatically fetch
143
- missing test dependencies:
144
115
 
145
- .. code-block:: bash
116
+ Known issues
117
+ ------------
118
+ * Job deletion operations fail unless Cross-Site scripting protection is disabled.
146
119
 
147
- uv venv
148
- uv python install
149
- uv run pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests
120
+ For other issues, please refer to the `support URL <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
150
121
 
151
122
  Development
152
123
  -----------
@@ -171,7 +142,7 @@ Python versions
171
142
 
172
143
  The project has been tested against Python versions:
173
144
 
174
- * 3.8 - 3.13
145
+ * 3.9 - 3.13
175
146
 
176
147
  Jenkins versions
177
148
  ----------------
@@ -1,4 +1,4 @@
1
- jenkinsapi
1
+ Jenkinsapi
2
2
  ==========
3
3
 
4
4
  .. image:: https://badge.fury.io/py/jenkinsapi.png
@@ -7,14 +7,31 @@ jenkinsapi
7
7
  .. image:: https://codecov.io/gh/pycontribs/jenkinsapi/branch/master/graph/badge.svg
8
8
  :target: https://codecov.io/gh/pycontribs/jenkinsapi
9
9
 
10
+ Installation
11
+ ------------
12
+
13
+ .. code-block:: bash
14
+
15
+ pip install jenkinsapi
16
+
17
+ Important Links
18
+ ---------------
19
+ * `Documentation <http://pycontribs.github.io/jenkinsapi/>`__
20
+ * `Source Code <https://github.com/pycontribs/jenkinsapi>`_
21
+ * `Support and bug-reports <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
22
+ * `Releases <https://pypi.org/project/jenkinsapi/#history>`_
23
+
24
+
10
25
  About this library
11
26
  -------------------
12
27
 
13
- Jenkins is the market leading continuous integration system, originally created by Kohsuke Kawaguchi.
28
+ Jenkins is the market leading continuous integration system.
14
29
 
15
30
  Jenkins (and its predecessor Hudson) are useful projects for automating common development tasks (e.g. unit-testing, production batches) - but they are somewhat Java-centric.
16
- | Jenkinsapi makes scripting Jenkins tasks a breeze by wrapping the REST api into familiar python objects.
17
- | Here is a list of some of the most commonly used functionality
31
+
32
+ Jenkinsapi makes scripting Jenkins tasks a breeze by wrapping the REST api into familiar python objects.
33
+
34
+ Here is a list of some of the most commonly used functionality
18
35
 
19
36
  * Add, remove, and query Jenkins jobs
20
37
  * Control pipeline execution
@@ -34,88 +51,44 @@ Jenkins (and its predecessor Hudson) are useful projects for automating common d
34
51
 
35
52
  Full library capabilities are outlined in the `Documentation <http://pycontribs.github.io/jenkinsapi/>`__
36
53
 
37
-
38
- Known issues
39
- ------------
40
- * Job deletion operations fail unless Cross-Site scripting protection is disabled.
41
-
42
- For other issues, please refer to the `support URL <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
43
-
44
- Important Links
45
- ---------------
46
- * `Support and bug-reports <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
47
- * `Source Code <https://github.com/pycontribs/jenkinsapi>`_
48
- * `Documentation <http://pycontribs.github.io/jenkinsapi/>`__
49
- * `Releases <http://pypi.python.org/pypi/jenkinsapi>`_
50
-
51
- Installation
52
- -------------
53
-
54
- Egg-files for this project are hosted on PyPi. Most Python users should be able to use pip or setuptools to automatically install this project.
55
-
56
- Using Pip or Setuptools
57
- ^^^^^^^^^^^^^^^^^^^^^^^
58
-
59
- Most users can do the following:
60
-
61
- .. code-block:: bash
62
-
63
- pip install jenkinsapi
64
-
65
- Or:
66
-
67
- .. code-block:: bash
68
-
69
- easy_install jenkinsapi
70
-
71
- Both of these techniques can be combined with virtualenv to create an application-specific installation.
72
-
73
- Using your operating-system's package manager
74
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
75
-
76
- Ubuntu users can now use apt to install this package:
77
-
78
- .. code-block:: bash
79
-
80
- apt-get install python-jenkinsapi
81
-
82
- Beware that this technique will get a somewhat older version of Jenkinsapi.
83
-
84
- Example
85
- -------
86
-
87
- JenkinsAPI is intended to map the objects in Jenkins (e.g. Builds, Views, Jobs) into easily managed Python objects:
54
+ Get details of jobs running on Jenkins server
55
+ ---------------------------------------------
88
56
 
89
57
  .. code-block:: python
90
58
 
91
- from jenkinsapi.jenkins import Jenkins
92
- J = Jenkins('http://localhost:8080')
93
- print(J.version) # 1.542
94
- print(J.keys()) # foo, test_jenkinsapi
95
- print(J.get('test_jenkinsapi')) # <jenkinsapi.job.Job test_jenkinsapi>
96
- print(J.get('test_jenkinsapi').get_last_good_build()) # <jenkinsapi.build.Build test_jenkinsapi #77>
97
-
98
- More examples available on `Github <https://github.com/pycontribs/jenkinsapi/tree/master/examples>`_
59
+ """Get job details of each job that is running on the Jenkins instance"""
60
+ def get_job_details():
61
+ # Refer Example #1 for definition of function 'get_server_instance'
62
+ server = get_server_instance()
63
+ for job_name, job_instance in server.get_jobs():
64
+ print 'Job Name:%s' % (job_instance.name)
65
+ print 'Job Description:%s' % (job_instance.get_description())
66
+ print 'Is Job running:%s' % (job_instance.is_running())
67
+ print 'Is Job enabled:%s' % (job_instance.is_enabled())
99
68
 
100
- Testing
101
- -------
69
+ Disable/Enable a Jenkins Job
70
+ ----------------------------
102
71
 
103
- If you have installed the test dependencies on your system already, you can run
104
- the testsuite with the following command:
72
+ .. code-block:: python
105
73
 
106
- .. code-block:: bash
74
+ def disable_job():
75
+ """Disable a Jenkins job"""
76
+ # Refer Example #1 for definition of function 'get_server_instance'
77
+ server = get_server_instance()
78
+ job_name = 'nightly-build-job'
79
+ if (server.has_job(job_name)):
80
+ job_instance = server.get_job(job_name)
81
+ job_instance.disable()
82
+ print 'Name:%s,Is Job Enabled ?:%s' % (job_name,job_instance.is_enabled())
107
83
 
108
- uv python sync
109
- uv run pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests
84
+ Use the call ``job_instance.enable()`` to enable a Jenkins Job.
110
85
 
111
- Otherwise using a virtualenv is recommended. Setuptools will automatically fetch
112
- missing test dependencies:
113
86
 
114
- .. code-block:: bash
87
+ Known issues
88
+ ------------
89
+ * Job deletion operations fail unless Cross-Site scripting protection is disabled.
115
90
 
116
- uv venv
117
- uv python install
118
- uv run pytest -sv --cov=jenkinsapi --cov-report=term-missing --cov-report=xml jenkinsapi_tests
91
+ For other issues, please refer to the `support URL <https://github.com/pycontribs/jenkinsapi/issues?direction=desc&sort=comments&state=open>`_
119
92
 
120
93
  Development
121
94
  -----------
@@ -140,7 +113,7 @@ Python versions
140
113
 
141
114
  The project has been tested against Python versions:
142
115
 
143
- * 3.8 - 3.13
116
+ * 3.9 - 3.13
144
117
 
145
118
  Jenkins versions
146
119
  ----------------
@@ -4,7 +4,7 @@ About this library
4
4
 
5
5
  Jenkins is the market leading continuous integration system, originally created
6
6
  by Kohsuke Kawaguchi. This API makes Jenkins even easier to use by providing an
7
- easy to use conventional python interface.
7
+ easy to use conventional python interface.
8
8
 
9
9
  Jenkins (and It's predecessor Hudson) are fantastic projects - but they are
10
10
  somewhat Java-centric. Thankfully the designers have provided an excellent and
@@ -26,16 +26,7 @@ This library can help you:
26
26
  Installing JenkinsAPI
27
27
  =====================
28
28
 
29
- Egg-files for this project are hosted on PyPi. Most Python users should be able
30
- to use pip or distribute to automatically install this project.
31
-
32
- Most users can do the following:
33
-
34
- easy_install jenkinsapi
35
-
36
- If you'd like to install in multi-version mode:
37
-
38
- easy_install -m jenkinsapi
29
+ pip install jenkinsapi
39
30
 
40
31
  Project Authors
41
32
  ===============
@@ -43,11 +34,15 @@ Project Authors
43
34
  * Salim Fadhley (sal@stodge.org)
44
35
  * Ramon van Alteren (ramon@vanalteren.nl)
45
36
  * Ruslan Lutsenko (ruslan.lutcenko@gmail.com)
37
+ * Aleksey Maksimov
38
+ * Clinton Steiner
46
39
 
47
- Current code lives on github: https://github.com/salimfadhley/jenkinsapi
40
+ Current code lives on github: https://github.com/pycontribs/jenkinsapi
48
41
 
49
42
  """
50
43
 
44
+ from importlib.metadata import version
45
+
51
46
  from jenkinsapi import (
52
47
  # Modules
53
48
  command_line,
@@ -92,3 +87,4 @@ __all__ = [
92
87
  "view",
93
88
  ]
94
89
  __docformat__ = "epytext"
90
+ __version__ = version("jenkinsapi")
@@ -43,7 +43,7 @@ class Build(JenkinsBase):
43
43
 
44
44
  STR_TOTALCOUNT = "totalCount"
45
45
  STR_TPL_NOTESTS_ERR = (
46
- "%s has status %s, and does not have " "any test results"
46
+ "%s has status %s, and does not have any test results"
47
47
  )
48
48
 
49
49
  def __init__(
@@ -0,0 +1,12 @@
1
+ """jenkinsapi.command_line.jenkinsapi_version"""
2
+
3
+ import jenkinsapi
4
+ import sys
5
+
6
+
7
+ def main():
8
+ sys.stdout.write(jenkinsapi.__version__)
9
+
10
+
11
+ if __name__ == "__main__":
12
+ main()
@@ -26,7 +26,7 @@ class Fingerprint(JenkinsBase):
26
26
  def __init__(self, baseurl: str, id_: str, jenkins_obj: "Jenkins") -> None:
27
27
  self.jenkins_obj: "Jenkins" = jenkins_obj
28
28
  assert self.RE_MD5.search(id_), (
29
- "%s does not look like " "a valid id" % id_
29
+ "%s does not look like a valid id" % id_
30
30
  )
31
31
  url: str = f"{baseurl}/fingerprint/{id_}/"
32
32
 
@@ -379,7 +379,7 @@ class Node(JenkinsBase):
379
379
  if self.name == "Built-In Node":
380
380
  raise JenkinsAPIException("Built-In node does not have config.xml")
381
381
 
382
- self.jenkins.requester.post_and_confirm_status(
382
+ self.jenkins.requester.post_xml_and_confirm_status(
383
383
  "%(baseurl)s/config.xml" % self.__dict__, data=config_xml
384
384
  )
385
385
 
@@ -390,6 +390,55 @@ class Node(JenkinsBase):
390
390
  """
391
391
  return self.get_config_element("label")
392
392
 
393
+ def add_labels(self, labels: str | list, dryRun: bool = False) -> None:
394
+ """Adds new label(s) to a node"""
395
+ if isinstance(labels, str):
396
+ labels = labels.split()
397
+ current_labels = self.get_labels() or ""
398
+ log.info("Current Node Labels: %s", current_labels)
399
+ current_labels_set = set(current_labels.split())
400
+ updated_labels_set = current_labels_set.union(labels)
401
+ updated_labels = " ".join(sorted(updated_labels_set))
402
+ log.info("Updated Node Labels: %s", updated_labels)
403
+ if not dryRun:
404
+ self.set_config_element("label", updated_labels)
405
+ self.poll()
406
+
407
+ def modify_labels(
408
+ self, new_labels: str | list[str], dryRun: bool = False
409
+ ) -> None:
410
+ """
411
+ Replaces the current node labels with new label(s).
412
+
413
+ :param new_labels: A string of space-separated labels or a list of labels to set.
414
+ """
415
+ if isinstance(new_labels, list):
416
+ new_labels = " ".join(new_labels)
417
+ log.info("Setting node labels to: %s", new_labels)
418
+ if not dryRun:
419
+ self.set_config_element("label", new_labels)
420
+ self.poll()
421
+
422
+ def delete_labels(
423
+ self, labels_to_remove: str | list[str], dryRun: bool = False
424
+ ) -> None:
425
+ """
426
+ Removes label(s) from the node.
427
+
428
+ :param labels_to_remove: A string of space-separated labels or a list of labels to remove.
429
+ """
430
+ if isinstance(labels_to_remove, str):
431
+ labels_to_remove = labels_to_remove.split()
432
+ log.info("Removing labels %s from Node", labels_to_remove)
433
+ current_labels = self.get_labels() or ""
434
+ current_labels_set = set(current_labels.split())
435
+ updated_labels_set = current_labels_set.difference(labels_to_remove)
436
+ updated_labels = " ".join(sorted(updated_labels_set))
437
+ log.info("Updated Node Labels: %s", updated_labels)
438
+ if not dryRun:
439
+ self.set_config_element("label", updated_labels)
440
+ self.poll()
441
+
393
442
  def get_num_executors(self) -> str:
394
443
  try:
395
444
  return self.get_config_element("numExecutors")
@@ -38,8 +38,9 @@ class Queue(JenkinsBase):
38
38
  for item in self._data["items"]:
39
39
  queue_id = item["id"]
40
40
  item_baseurl = "%s/item/%i" % (self.baseurl, queue_id)
41
- yield item["id"], QueueItem(
42
- baseurl=item_baseurl, jenkins_obj=self.jenkins
41
+ yield (
42
+ item["id"],
43
+ QueueItem(baseurl=item_baseurl, jenkins_obj=self.jenkins),
43
44
  )
44
45
 
45
46
  def iterkeys(self) -> Iterator[str]:
@@ -2,8 +2,6 @@
2
2
  Module for converting jsonp to json.
3
3
  """
4
4
 
5
- from __future__ import print_function
6
-
7
5
 
8
6
  def jsonp_to_json(jsonp):
9
7
  try:
@@ -19,7 +19,8 @@ class InvalidJarError(Exception):
19
19
 
20
20
 
21
21
  class Manifest(object):
22
- """The parsed manifest from a jar file.
22
+ """
23
+ The parsed manifest from a jar file.
23
24
  Attributes:
24
25
  main_section: a dict representing the main (first)
25
26
  section of the manifest.
@@ -38,13 +39,16 @@ class Manifest(object):
38
39
 
39
40
 
40
41
  def read_manifest(jar_file_name):
41
- """Read and parse the manifest out of the given jar.
42
+ """
43
+ Read and parse the manifest out of the given jar.
42
44
  Args:
43
- jar_file_name: the name of the jar from which the manifest is to be read.
45
+ jar_file_name: the name of the jar from which the manifest is to be read.
46
+
44
47
  Returns:
45
- A parsed Manifest object, or None if the jar has no manifest.
48
+ A parsed Manifest object, or None if the jar has no manifest.
49
+
46
50
  Raises:
47
- IOError: if the jar does not exist or cannot be read.
51
+ IOError: if the jar does not exist or cannot be read.
48
52
  """
49
53
  with zipfile.ZipFile(jar_file_name) as jar:
50
54
  try:
@@ -55,7 +59,8 @@ def read_manifest(jar_file_name):
55
59
 
56
60
 
57
61
  def _parse_manifest(manifest_string):
58
- """Parse a Manifest object out of the given string.
62
+ """
63
+ Parse a Manifest object out of the given string.
59
64
  Args:
60
65
  manifest_string: a str or unicode that is the manifest contents.
61
66
  Returns:
@@ -49,6 +49,7 @@ class Requester(object):
49
49
  cert = None
50
50
  baseurl = None
51
51
  timeout = 10
52
+ max_retries = 3
52
53
 
53
54
  if len(args) == 1:
54
55
  (username,) = args
@@ -85,7 +86,7 @@ class Requester(object):
85
86
  self.cert = kwargs.get("cert", cert)
86
87
  self.timeout = kwargs.get("timeout", timeout)
87
88
  self.session = requests.Session()
88
- self.max_retries = kwargs.get("max_retries")
89
+ self.max_retries = kwargs.get("max_retries", max_retries)
89
90
  if self.max_retries is not None:
90
91
  retry_adapter = requests.adapters.HTTPAdapter(
91
92
  max_retries=self.max_retries
@@ -101,15 +102,15 @@ class Requester(object):
101
102
  requestKwargs["auth"] = (self.username, self.password)
102
103
 
103
104
  if params:
104
- assert isinstance(
105
- params, dict
106
- ), "Params must be a dict, got %s" % repr(params)
105
+ assert isinstance(params, dict), (
106
+ f"Params must be a dict, got {repr(params)}"
107
+ )
107
108
  requestKwargs["params"] = params
108
109
 
109
110
  if headers:
110
- assert isinstance(
111
- headers, dict
112
- ), "headers must be a dict, got %s" % repr(headers)
111
+ assert isinstance(headers, dict), (
112
+ f"headers must be a dict, got {repr(headers)}"
113
+ )
113
114
  requestKwargs["headers"] = headers
114
115
 
115
116
  if self.AUTH_COOKIE:
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python
2
- from __future__ import print_function
3
2
 
4
3
  try:
5
4
  from SimpleHTTPServer import SimpleHTTPRequestHandler
@@ -23,8 +23,7 @@ class Views(object):
23
23
  MY_VIEW = "hudson.model.MyView"
24
24
  DASHBOARD_VIEW = "hudson.plugins.view.dashboard.Dashboard"
25
25
  PIPELINE_VIEW = (
26
- "au.com.centrumsystems.hudson."
27
- "plugin.buildpipeline.BuildPipelineView"
26
+ "au.com.centrumsystems.hudson.plugin.buildpipeline.BuildPipelineView"
28
27
  )
29
28
 
30
29
  def __init__(self, jenkins):
@@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"
4
4
 
5
5
  [project]
6
6
  name = "jenkinsapi"
7
- version = "0.3.14dev5"
7
+ version = "0.3.15dev2"
8
8
  authors = [
9
9
  {name = "Salim Fadhley", email = "salimfadhley@gmail.com"},
10
10
  {name = "Aleksey Maksimov", email = "ctpeko3a@gmail.com"},
@@ -28,7 +28,6 @@ classifiers = [
28
28
  "Operating System :: OS Independent",
29
29
  "Programming Language :: Python",
30
30
  "Programming Language :: Python :: 3",
31
- "Programming Language :: Python :: 3.8",
32
31
  "Programming Language :: Python :: 3.9",
33
32
  "Programming Language :: Python :: 3.10",
34
33
  "Programming Language :: Python :: 3.11",
@@ -37,11 +36,10 @@ classifiers = [
37
36
  "Topic :: Software Development :: Testing",
38
37
  "Topic :: Utilities",
39
38
  ]
40
- requires-python = ">=3.8"
39
+ requires-python = ">=3.9"
41
40
  dependencies = [
42
41
  "pytz>=2014.4",
43
42
  "requests>=2.3.0",
44
- "six>=1.10.0",
45
43
  ]
46
44
 
47
45
  [tool.setuptools]
@@ -53,6 +51,7 @@ warnerrors = "True"
53
51
 
54
52
  [project.scripts]
55
53
  jenkins_invoke = "jenkinsapi.command_line.jenkins_invoke:main"
54
+ jenkinsapi_version = "jenkinsapi.command_line.jenkinsapi_version:main"
56
55
 
57
56
  [tool.build_sphinx]
58
57
  source-dir = "doc/source"
@@ -1,13 +0,0 @@
1
- """ jenkinsapi.command_line.jenkinsapi_version
2
- """
3
-
4
- from jenkinsapi import __version__ as version
5
- import sys
6
-
7
-
8
- def main():
9
- sys.stdout.write(version)
10
-
11
-
12
- if __name__ == "__main__":
13
- main()