From 4eea8ae7ec7489bb10535a904d7406c653a924c9 Mon Sep 17 00:00:00 2001 From: ondrejrozsypal <> Date: Wed, 13 Jan 2021 16:11:08 +0100 Subject: [PATCH 1/3] update setup.py --- setup.py | 123 +++++-------------------------------------------------- 1 file changed, 11 insertions(+), 112 deletions(-) diff --git a/setup.py b/setup.py index 4b40f50a9..c5e1e5509 100755 --- a/setup.py +++ b/setup.py @@ -1,10 +1,16 @@ #!/usr/bin/env python # import codecs + + import os import sys import warnings -from pip.req import parse_requirements +# try: # for pip >= 10 +# from pip._internal.req import parse_requirements +# except ImportError: # for pip <= 9.0.3 +# from pip.req import parse_requirements + from setuptools import find_packages, setup NAME = "jira" @@ -13,7 +19,6 @@ if base_path not in sys.path: sys.path.insert(0, base_path) - # this should help getting annoying warnings from inside distutils warnings.simplefilter('ignore', UserWarning) @@ -50,117 +55,11 @@ def read(fname): def get_requirements(*path): req_path = os.path.join(*path) - reqs = parse_requirements(req_path, session=False) - return [str(ir.req) for ir in reqs] - -# class PyTest(TestCommand): -# user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")] -# -# def initialize_options(self): -# TestCommand.initialize_options(self) -# self.pytest_args = [] -# -# logging.basicConfig(format='%(levelname)-10s %(message)s') -# logging.getLogger("jira").setLevel(logging.INFO) -# -# # if we have pytest-cache module we enable the test failures first mode -# try: -# import pytest_cache # noqa -# self.pytest_args.append("--ff") -# except ImportError: -# pass -# -# if sys.stdout.isatty(): -# # when run manually we enable fail fast -# self.pytest_args.append("--maxfail=1") -# try: -# import coveralls # noqa -# self.pytest_args.append("--cov=%s" % NAME) -# self.pytest_args.extend(["--cov-report", "term"]) -# self.pytest_args.extend(["--cov-report", "xml"]) -# -# except ImportError: -# pass -# -# def finalize_options(self): -# TestCommand.finalize_options(self) -# self.test_args = [] -# self.test_suite = True -# -# def run_tests(self): -# # before running tests we need to run autopep8 -# try: -# saved_argv = sys.argv -# sys.argv = "-r --in-place jira/ tests/ examples/".split(" ") -# runpy.run_module('autopep8') -# sys.argv = saved_argv # restore sys.argv -# except subprocess.CalledProcessError: -# logging.warning('autopep8 is not installed so ' -# 'it will not be run') -# # import here, cause outside the eggs aren't loaded -# import pytest -# errno = pytest.main(self.pytest_args) -# sys.exit(errno) - - -# class Release(Command): -# user_options = [] -# -# def initialize_options(self): -# # Command.initialize_options(self) -# pass -# -# def finalize_options(self): -# # Command.finalize_options(self) -# pass -# -# def run(self): -# import json -# try: -# from urllib.request import urlopen -# except ImportError: -# from urllib2 import urlopen -# response = urlopen( -# "https://pypi.python.org/pypi/%s/json" % NAME) -# data = json.load(codecs.getreader("utf-8")(response)) -# released_version = data['info']['version'] -# if released_version == __version__: -# raise RuntimeError( -# "This version was already released, remove it from PyPi if you want " -# "to release it again or increase the version number. https://pypi.python.org/pypi/%s/" % NAME) -# elif released_version > __version__: -# raise RuntimeError("Cannot release a version (%s) smaller than the PyPI current release (%s)." % ( -# __version__, released_version)) -# -# -# class PreRelease(Command): -# user_options = [] -# -# def initialize_options(self): -# # Command.initialize_options(self) -# pass -# -# def finalize_options(self): -# # Command.finalize_options(self) -# pass -# -# def run(self): -# import json -# try: -# from urllib.request import urlopen -# except ImportError: -# from urllib2 import urlopen -# response = urlopen( -# "https://pypi.python.org/pypi/%s/json" % NAME) -# data = json.load(codecs.getreader("utf-8")(response)) -# released_version = data['info']['version'] -# if released_version >= __version__: -# raise RuntimeError( -# "Current version of the package is equal or lower than the " -# "already published ones (PyPi). Increse version to be able to pass prerelease stage.") + with open(req_path) as f: + return f.read().strip().split('\n') -if __name__ == '__main__': +if __name__ == '__main__': setup( name=NAME, # cmdclass={'release': Release, 'prerelease': PreRelease}, @@ -176,7 +75,7 @@ def get_requirements(*path): 'shell': ['ipython>=0.13']}, entry_points={ 'console_scripts': - ['jirashell = jira.jirashell:main']}, + ['jirashell = jira.jirashell:main']}, long_description=open("README.rst").read(), provides=[NAME], From 0f420e985fba9585639c9901ebfca45950f7c01b Mon Sep 17 00:00:00 2001 From: Dominik J Date: Wed, 13 Jan 2021 16:43:13 +0100 Subject: [PATCH 2/3] rename async param --- jira/client.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/jira/client.py b/jira/client.py index 7c24ff71b..701da56ea 100755 --- a/jira/client.py +++ b/jira/client.py @@ -189,7 +189,7 @@ class JIRA(object): AGILE_BASE_URL = GreenHopperResource.AGILE_BASE_URL def __init__(self, server=None, options=None, basic_auth=None, oauth=None, jwt=None, kerberos=False, - validate=False, get_server_info=True, async=False, logging=True, max_retries=3, proxies=None): + validate=False, get_server_info=True, use_async=False, logging=True, max_retries=3, proxies=None): """ Construct a JIRA client instance. @@ -234,7 +234,7 @@ def __init__(self, server=None, options=None, basic_auth=None, oauth=None, jwt=N as anononymous it will fail to instanciate. :param get_server_info: If true it will fetch server version info first to determine if some API calls are available. - :param async: To enable async requests for those actions where we implemented it, like issue update() or delete(). + :param use_async: To enable async requests for those actions where we implemented it, like issue update() or delete(). Obviously this means that you cannot rely on the return code when this is enabled. """ # force a copy of the tuple to be used in __del__() because @@ -252,8 +252,8 @@ def __init__(self, server=None, options=None, basic_auth=None, oauth=None, jwt=N if server: options['server'] = server - if async: - options['async'] = async + if use_async: + options['async'] = use_async self.logging = logging @@ -3171,8 +3171,8 @@ def move_to_backlog(self, issue_keys): class GreenHopper(JIRA): - def __init__(self, options=None, basic_auth=None, oauth=None, async=None): + def __init__(self, options=None, basic_auth=None, oauth=None, use_async=None): warnings.warn( "GreenHopper() class is deprecated, just use JIRA() instead.", DeprecationWarning) JIRA.__init__( - self, options=options, basic_auth=basic_auth, oauth=oauth, async=async) + self, options=options, basic_auth=basic_auth, oauth=oauth, use_async=use_async) From 2fb13a16512f77e5468f3dc7341d3f1f53479c4a Mon Sep 17 00:00:00 2001 From: Dominik J Date: Wed, 13 Jan 2021 16:55:03 +0100 Subject: [PATCH 3/3] rename async param --- jira/resources.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/jira/resources.py b/jira/resources.py index 5a4120dbb..93d6fe58b 100644 --- a/jira/resources.py +++ b/jira/resources.py @@ -172,7 +172,7 @@ def _get_url(self, path): options.update({'path': path}) return self._base_url.format(**options) - def update(self, fields=None, async=None, jira=None, notify=True, **kwargs): + def update(self, fields=None, use_async=None, jira=None, notify=True, **kwargs): """ Update this resource on the server. Keyword arguments are marshalled into a dict before being sent. If this resource doesn't support ``PUT``, a :py:exc:`.JIRAError` will be raised; subclasses that specialize this method @@ -180,8 +180,8 @@ def update(self, fields=None, async=None, jira=None, notify=True, **kwargs): :param async: if true the request will be added to the queue so it can be executed later using async_run() """ - if async is None: - async = self._options['async'] + if use_async is None: + use_async = self._options['async'] data = {} if fields is not None: @@ -250,7 +250,7 @@ def update(self, fields=None, async=None, jira=None, notify=True, **kwargs): # data['fields']['assignee'] = {'name': self._options['autofix']} # EXPERIMENTAL ---> # import grequests - if async: + if use_async: if not hasattr(self._session, '_async_jobs'): self._session._async_jobs = set() self._session._async_jobs.add(threaded_requests.put( @@ -404,7 +404,7 @@ def __init__(self, options, session, raw=None): if raw: self._parse_raw(raw) - def update(self, fields=None, update=None, async=None, jira=None, notify=True, **fieldargs): + def update(self, fields=None, update=None, use_async=None, jira=None, notify=True, **fieldargs): """ Update this issue on the server. @@ -453,7 +453,7 @@ def update(self, fields=None, update=None, async=None, jira=None, notify=True, * else: fields_dict[field] = value - super(Issue, self).update(async=async, jira=jira, notify=notify, fields=data) + super(Issue, self).update(use_async=use_async, jira=jira, notify=notify, fields=data) def add_field_value(self, field, value): """ @@ -492,7 +492,7 @@ def __init__(self, options, session, raw=None): if raw: self._parse_raw(raw) - def update(self, fields=None, async=None, jira=None, body='', visibility=None): + def update(self, fields=None, use_async=None, jira=None, body='', visibility=None): # TODO: fix the Resource.update() override mess data = {} if body: