We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Migrate to celery 5
after #2056 

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/setup.py`
Content:
```
1 #
2 # This file is part of pretix (Community Edition).
3 #
4 # Copyright (C) 2014-2020 Raphael Michel and contributors
5 # Copyright (C) 2020-2021 rami.io GmbH and contributors
6 #
7 # This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General
8 # Public License as published by the Free Software Foundation in version 3 of the License.
9 #
10 # ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are
11 # applicable granting you additional permissions and placing additional restrictions on your usage of this software.
12 # Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive
13 # this file, see <https://pretix.eu/about/en/license>.
14 #
15 # This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
16 # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
17 # details.
18 #
19 # You should have received a copy of the GNU Affero General Public License along with this program.  If not, see
20 # <https://www.gnu.org/licenses/>.
21 #
22 
23 # This file is based on an earlier version of pretix which was released under the Apache License 2.0. The full text of
24 # the Apache License 2.0 can be obtained at <http://www.apache.org/licenses/LICENSE-2.0>.
25 #
26 # This file may have since been changed and any changes are released under the terms of AGPLv3 as described above. A
27 # full history of changes and contributors is available at <https://github.com/pretix/pretix>.
28 #
29 # This file contains Apache-licensed contributions copyrighted by: Claudio Luck, FlaviaBastos, Katharina Bogad, Laura
30 # Klünder, Lukas Bockstaller, Matthew Emerson, Tobias Kunze, jasonwaiting@live.hk
31 #
32 # Unless required by applicable law or agreed to in writing, software distributed under the Apache License 2.0 is
33 # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
34 # License for the specific language governing permissions and limitations under the License.
35 
36 import os
37 import subprocess
38 import sys
39 from codecs import open
40 from distutils.command.build import build
41 from distutils.command.build_ext import build_ext
42 from distutils.dir_util import copy_tree
43 from os import path
44 
45 from setuptools import find_packages, setup
46 
47 try:
48     from pretix import __version__
49 except:
50     if "PRETIX_DOCKER_BUILD" in os.environ:
51         __version__ = "0.0.0"  # this is a hack to allow calling this file early in our docker build to make use of caching
52     else:
53         raise
54 
55 CURRENT_PYTHON = sys.version_info[:2]
56 REQUIRED_PYTHON = (3, 6)
57 if CURRENT_PYTHON < REQUIRED_PYTHON:
58     sys.stderr.write("""
59 ==========================
60 Unsupported Python version
61 ==========================
62 This version of pretix requires Python {}.{}, but you're trying to
63 install it on Python {}.{}.
64 This may be because you are using a version of pip that doesn't
65 understand the python_requires classifier. Make sure you
66 have pip >= 9.0 and setuptools >= 24.2, then try again:
67     $ python -m pip install --upgrade pip setuptools
68     $ python -m pip install pretix
69 This will install the latest version of pretix which works on your
70 version of Python. If you can't upgrade your pip (or Python), request
71 an older version of pretix:
72     $ python -m pip install "pretix<2"
73 """.format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))
74     sys.exit(1)
75 
76 here = path.abspath(path.dirname(__file__))
77 npm_installed = False
78 
79 # Get the long description from the relevant file
80 try:
81     with open(path.join(here, '../README.rst'), encoding='utf-8') as f:
82         long_description = f.read()
83 except:
84     long_description = ''
85 
86 
87 def npm_install():
88     global npm_installed
89 
90     if not npm_installed:
91         # keep this in sync with Makefile!
92         node_prefix = os.path.join(here, 'pretix', 'static.dist', 'node_prefix')
93         os.makedirs(node_prefix, exist_ok=True)
94         copy_tree(os.path.join(here, 'pretix', 'static', 'npm_dir'), node_prefix)
95         subprocess.check_call('npm install', shell=True, cwd=node_prefix)
96         npm_installed = True
97 
98 
99 class CustomBuild(build):
100     def run(self):
101         if "PRETIX_DOCKER_BUILD" in os.environ:
102             return  # this is a hack to allow calling this file early in our docker build to make use of caching
103         os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pretix.settings")
104         os.environ.setdefault("PRETIX_IGNORE_CONFLICTS", "True")
105         import django
106         django.setup()
107         from django.conf import settings
108         from django.core import management
109 
110         settings.COMPRESS_ENABLED = True
111         settings.COMPRESS_OFFLINE = True
112 
113         npm_install()
114         management.call_command('compilemessages', verbosity=1)
115         management.call_command('compilejsi18n', verbosity=1)
116         management.call_command('collectstatic', verbosity=1, interactive=False)
117         management.call_command('compress', verbosity=1)
118 
119         build.run(self)
120 
121 
122 class CustomBuildExt(build_ext):
123     def run(self):
124         if "PRETIX_DOCKER_BUILD" in os.environ:
125             return  # this is a hack to allow calling this file early in our docker build to make use of caching
126         npm_install()
127         build_ext.run(self)
128 
129 
130 cmdclass = {
131     'build': CustomBuild,
132     'build_ext': CustomBuildExt,
133 }
134 
135 
136 setup(
137     name='pretix',
138     version=__version__,
139     python_requires='>={}.{}'.format(*REQUIRED_PYTHON),
140     description='Reinventing presales, one ticket at a time',
141     long_description=long_description,
142     url='https://pretix.eu',
143     author='Raphael Michel',
144     author_email='support@pretix.eu',
145     license='GNU Affero General Public License v3 with Additional Terms',
146     classifiers=[
147         'Development Status :: 5 - Production/Stable',
148         'Intended Audience :: Developers',
149         'Intended Audience :: Other Audience',
150         'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
151         'Environment :: Web Environment',
152         'License :: OSI Approved :: GNU Affero General Public License v3',
153         'Programming Language :: Python :: 3.7',
154         'Programming Language :: Python :: 3.8',
155         'Programming Language :: Python :: 3.9',
156         'Framework :: Django :: 3.2'
157     ],
158 
159     keywords='tickets web shop ecommerce',
160     install_requires=[
161         'arabic-reshaper==2.1.4',  # Support for Arabic in reportlab
162         'babel',
163         'BeautifulSoup4==4.11.*',
164         'bleach==5.0.*',
165         'celery==4.4.*',
166         'chardet==5.1.*',
167         'cryptography>=3.4.2',
168         'css-inline==0.8.*',
169         'defusedcsv>=1.1.0',
170         'dj-static',
171         'Django==3.2.*',
172         'django-bootstrap3==22.2.*',
173         'django-compressor==4.1.*',
174         'django-countries==7.5.*',
175         'django-filter==22.1',
176         'django-formset-js-improved==0.5.0.3',
177         'django-formtools==2.4',
178         'django-hierarkey==1.1.*',
179         'django-hijack==3.2.*',
180         'django-i18nfield==1.9.*,>=1.9.4',
181         'django-libsass==0.9',
182         'django-localflavor==3.1',
183         'django-markup',
184         'django-mysql',
185         'django-oauth-toolkit==1.2.*',
186         'django-otp==1.1.*',
187         'django-phonenumber-field==7.0.*',
188         'django-redis==5.2.*',
189         'django-scopes==1.2.*',
190         'django-statici18n==2.3.*',
191         'djangorestframework==3.14.*',
192         'dnspython<2.0',  # do not upgrade, causes issues with eventlet / gunicorn 19 and we cannot upgrade gunicorn right now
193         'drf_ujson2==1.7.*',
194         'isoweek',
195         'jsonschema',
196         'kombu==4.6.*',
197         'libsass==0.22.*',
198         'lxml',
199         'markdown==3.3.4',  # 3.3.5 requires importlib-metadata>=4.4, but django-bootstrap3 requires importlib-metadata<3.
200         # We can upgrade markdown again once django-bootstrap3 upgrades or once we drop Python 3.6 and 3.7
201         'mt-940==4.23.*',
202         'oauthlib==3.2.*',
203         'openpyxl==3.0.*',
204         'packaging',
205         'paypalrestsdk==1.13.*',
206         'paypal-checkout-serversdk==1.0.*',
207         'PyJWT==2.6.*',
208         'phonenumberslite==8.13.*',
209         'Pillow==9.3.*',
210         'protobuf==4.21.*',
211         'psycopg2-binary',
212         'pycountry',
213         'pycparser==2.21',
214         'pycryptodome==3.16.*',
215         'PyPDF2==2.11.*',
216         'python-bidi==0.4.*',  # Support for Arabic in reportlab
217         'python-dateutil==2.8.*',
218         'python-u2flib-server==4.*',
219         'pytz',
220         'pyuca',
221         'redis==4.4.*',
222         'reportlab==3.6.*',
223         'requests==2.28.*',
224         'sentry-sdk==1.10.*',  # when upgrading, check https://github.com/getsentry/sentry-python/issues/1700
225         'sepaxml==2.6.*',
226         'slimit',
227         'static3==0.7.*',
228         'stripe==5.0.*',
229         'text-unidecode==1.*',
230         'tlds>=2020041600',
231         'tqdm==4.*',
232         'vat_moss_forked==2020.3.20.0.11.0',
233         'vobject==0.9.*',
234         'webauthn==0.4.*',
235         'zeep==4.2.*'
236     ],
237     extras_require={
238         'dev': [
239             'coverage',
240             'coveralls',
241             'django-debug-toolbar==3.7.*',
242             'flake8==6.0.*',
243             'freezegun',
244             'isort==5.10.*',
245             'pep8-naming==0.12.*',
246             'potypo',
247             'pycodestyle==2.10.*',
248             'pyflakes==3.0.*',
249             'pytest-cache',
250             'pytest-cov',
251             'pytest-django==4.*',
252             'pytest-mock==3.10.*',
253             'pytest-rerunfailures==10.*',
254             'pytest-sugar',
255             'pytest-xdist==3.1.*',
256             'pytest==7.2.*',
257             'responses',
258         ],
259         'memcached': ['pylibmc'],
260         'mysql': ['mysqlclient'],
261     },
262     setup_requires=['setuptools-rust'],
263 
264     packages=find_packages(exclude=['tests', 'tests.*']),
265     include_package_data=True,
266     cmdclass=cmdclass,
267 )
268
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/setup.py b/src/setup.py
--- a/src/setup.py
+++ b/src/setup.py
@@ -162,7 +162,7 @@
         'babel',
         'BeautifulSoup4==4.11.*',
         'bleach==5.0.*',
-        'celery==4.4.*',
+        'celery==5.2.*',
         'chardet==5.1.*',
         'cryptography>=3.4.2',
         'css-inline==0.8.*',
@@ -193,7 +193,7 @@
         'drf_ujson2==1.7.*',
         'isoweek',
         'jsonschema',
-        'kombu==4.6.*',
+        'kombu==5.2.*',
         'libsass==0.22.*',
         'lxml',
         'markdown==3.3.4',  # 3.3.5 requires importlib-metadata>=4.4, but django-bootstrap3 requires importlib-metadata<3.

{"golden_diff": "diff --git a/src/setup.py b/src/setup.py\n--- a/src/setup.py\n+++ b/src/setup.py\n@@ -162,7 +162,7 @@\n         'babel',\n         'BeautifulSoup4==4.11.*',\n         'bleach==5.0.*',\n-        'celery==4.4.*',\n+        'celery==5.2.*',\n         'chardet==5.1.*',\n         'cryptography>=3.4.2',\n         'css-inline==0.8.*',\n@@ -193,7 +193,7 @@\n         'drf_ujson2==1.7.*',\n         'isoweek',\n         'jsonschema',\n-        'kombu==4.6.*',\n+        'kombu==5.2.*',\n         'libsass==0.22.*',\n         'lxml',\n         'markdown==3.3.4',  # 3.3.5 requires importlib-metadata>=4.4, but django-bootstrap3 requires importlib-metadata<3.\n", "issue": "Migrate to celery 5\nafter #2056 \n", "before_files": [{"content": "#\n# This file is part of pretix (Community Edition).\n#\n# Copyright (C) 2014-2020 Raphael Michel and contributors\n# Copyright (C) 2020-2021 rami.io GmbH and contributors\n#\n# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General\n# Public License as published by the Free Software Foundation in version 3 of the License.\n#\n# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are\n# applicable granting you additional permissions and placing additional restrictions on your usage of this software.\n# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive\n# this file, see <https://pretix.eu/about/en/license>.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\n# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more\n# details.\n#\n# You should have received a copy of the GNU Affero General Public License along with this program.  If not, see\n# <https://www.gnu.org/licenses/>.\n#\n\n# This file is based on an earlier version of pretix which was released under the Apache License 2.0. The full text of\n# the Apache License 2.0 can be obtained at <http://www.apache.org/licenses/LICENSE-2.0>.\n#\n# This file may have since been changed and any changes are released under the terms of AGPLv3 as described above. A\n# full history of changes and contributors is available at <https://github.com/pretix/pretix>.\n#\n# This file contains Apache-licensed contributions copyrighted by: Claudio Luck, FlaviaBastos, Katharina Bogad, Laura\n# Kl\u00fcnder, Lukas Bockstaller, Matthew Emerson, Tobias Kunze, jasonwaiting@live.hk\n#\n# Unless required by applicable law or agreed to in writing, software distributed under the Apache License 2.0 is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations under the License.\n\nimport os\nimport subprocess\nimport sys\nfrom codecs import open\nfrom distutils.command.build import build\nfrom distutils.command.build_ext import build_ext\nfrom distutils.dir_util import copy_tree\nfrom os import path\n\nfrom setuptools import find_packages, setup\n\ntry:\n    from pretix import __version__\nexcept:\n    if \"PRETIX_DOCKER_BUILD\" in os.environ:\n        __version__ = \"0.0.0\"  # this is a hack to allow calling this file early in our docker build to make use of caching\n    else:\n        raise\n\nCURRENT_PYTHON = sys.version_info[:2]\nREQUIRED_PYTHON = (3, 6)\nif CURRENT_PYTHON < REQUIRED_PYTHON:\n    sys.stderr.write(\"\"\"\n==========================\nUnsupported Python version\n==========================\nThis version of pretix requires Python {}.{}, but you're trying to\ninstall it on Python {}.{}.\nThis may be because you are using a version of pip that doesn't\nunderstand the python_requires classifier. Make sure you\nhave pip >= 9.0 and setuptools >= 24.2, then try again:\n    $ python -m pip install --upgrade pip setuptools\n    $ python -m pip install pretix\nThis will install the latest version of pretix which works on your\nversion of Python. If you can't upgrade your pip (or Python), request\nan older version of pretix:\n    $ python -m pip install \"pretix<2\"\n\"\"\".format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))\n    sys.exit(1)\n\nhere = path.abspath(path.dirname(__file__))\nnpm_installed = False\n\n# Get the long description from the relevant file\ntry:\n    with open(path.join(here, '../README.rst'), encoding='utf-8') as f:\n        long_description = f.read()\nexcept:\n    long_description = ''\n\n\ndef npm_install():\n    global npm_installed\n\n    if not npm_installed:\n        # keep this in sync with Makefile!\n        node_prefix = os.path.join(here, 'pretix', 'static.dist', 'node_prefix')\n        os.makedirs(node_prefix, exist_ok=True)\n        copy_tree(os.path.join(here, 'pretix', 'static', 'npm_dir'), node_prefix)\n        subprocess.check_call('npm install', shell=True, cwd=node_prefix)\n        npm_installed = True\n\n\nclass CustomBuild(build):\n    def run(self):\n        if \"PRETIX_DOCKER_BUILD\" in os.environ:\n            return  # this is a hack to allow calling this file early in our docker build to make use of caching\n        os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"pretix.settings\")\n        os.environ.setdefault(\"PRETIX_IGNORE_CONFLICTS\", \"True\")\n        import django\n        django.setup()\n        from django.conf import settings\n        from django.core import management\n\n        settings.COMPRESS_ENABLED = True\n        settings.COMPRESS_OFFLINE = True\n\n        npm_install()\n        management.call_command('compilemessages', verbosity=1)\n        management.call_command('compilejsi18n', verbosity=1)\n        management.call_command('collectstatic', verbosity=1, interactive=False)\n        management.call_command('compress', verbosity=1)\n\n        build.run(self)\n\n\nclass CustomBuildExt(build_ext):\n    def run(self):\n        if \"PRETIX_DOCKER_BUILD\" in os.environ:\n            return  # this is a hack to allow calling this file early in our docker build to make use of caching\n        npm_install()\n        build_ext.run(self)\n\n\ncmdclass = {\n    'build': CustomBuild,\n    'build_ext': CustomBuildExt,\n}\n\n\nsetup(\n    name='pretix',\n    version=__version__,\n    python_requires='>={}.{}'.format(*REQUIRED_PYTHON),\n    description='Reinventing presales, one ticket at a time',\n    long_description=long_description,\n    url='https://pretix.eu',\n    author='Raphael Michel',\n    author_email='support@pretix.eu',\n    license='GNU Affero General Public License v3 with Additional Terms',\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Intended Audience :: Developers',\n        'Intended Audience :: Other Audience',\n        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',\n        'Environment :: Web Environment',\n        'License :: OSI Approved :: GNU Affero General Public License v3',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: 3.8',\n        'Programming Language :: Python :: 3.9',\n        'Framework :: Django :: 3.2'\n    ],\n\n    keywords='tickets web shop ecommerce',\n    install_requires=[\n        'arabic-reshaper==2.1.4',  # Support for Arabic in reportlab\n        'babel',\n        'BeautifulSoup4==4.11.*',\n        'bleach==5.0.*',\n        'celery==4.4.*',\n        'chardet==5.1.*',\n        'cryptography>=3.4.2',\n        'css-inline==0.8.*',\n        'defusedcsv>=1.1.0',\n        'dj-static',\n        'Django==3.2.*',\n        'django-bootstrap3==22.2.*',\n        'django-compressor==4.1.*',\n        'django-countries==7.5.*',\n        'django-filter==22.1',\n        'django-formset-js-improved==0.5.0.3',\n        'django-formtools==2.4',\n        'django-hierarkey==1.1.*',\n        'django-hijack==3.2.*',\n        'django-i18nfield==1.9.*,>=1.9.4',\n        'django-libsass==0.9',\n        'django-localflavor==3.1',\n        'django-markup',\n        'django-mysql',\n        'django-oauth-toolkit==1.2.*',\n        'django-otp==1.1.*',\n        'django-phonenumber-field==7.0.*',\n        'django-redis==5.2.*',\n        'django-scopes==1.2.*',\n        'django-statici18n==2.3.*',\n        'djangorestframework==3.14.*',\n        'dnspython<2.0',  # do not upgrade, causes issues with eventlet / gunicorn 19 and we cannot upgrade gunicorn right now\n        'drf_ujson2==1.7.*',\n        'isoweek',\n        'jsonschema',\n        'kombu==4.6.*',\n        'libsass==0.22.*',\n        'lxml',\n        'markdown==3.3.4',  # 3.3.5 requires importlib-metadata>=4.4, but django-bootstrap3 requires importlib-metadata<3.\n        # We can upgrade markdown again once django-bootstrap3 upgrades or once we drop Python 3.6 and 3.7\n        'mt-940==4.23.*',\n        'oauthlib==3.2.*',\n        'openpyxl==3.0.*',\n        'packaging',\n        'paypalrestsdk==1.13.*',\n        'paypal-checkout-serversdk==1.0.*',\n        'PyJWT==2.6.*',\n        'phonenumberslite==8.13.*',\n        'Pillow==9.3.*',\n        'protobuf==4.21.*',\n        'psycopg2-binary',\n        'pycountry',\n        'pycparser==2.21',\n        'pycryptodome==3.16.*',\n        'PyPDF2==2.11.*',\n        'python-bidi==0.4.*',  # Support for Arabic in reportlab\n        'python-dateutil==2.8.*',\n        'python-u2flib-server==4.*',\n        'pytz',\n        'pyuca',\n        'redis==4.4.*',\n        'reportlab==3.6.*',\n        'requests==2.28.*',\n        'sentry-sdk==1.10.*',  # when upgrading, check https://github.com/getsentry/sentry-python/issues/1700\n        'sepaxml==2.6.*',\n        'slimit',\n        'static3==0.7.*',\n        'stripe==5.0.*',\n        'text-unidecode==1.*',\n        'tlds>=2020041600',\n        'tqdm==4.*',\n        'vat_moss_forked==2020.3.20.0.11.0',\n        'vobject==0.9.*',\n        'webauthn==0.4.*',\n        'zeep==4.2.*'\n    ],\n    extras_require={\n        'dev': [\n            'coverage',\n            'coveralls',\n            'django-debug-toolbar==3.7.*',\n            'flake8==6.0.*',\n            'freezegun',\n            'isort==5.10.*',\n            'pep8-naming==0.12.*',\n            'potypo',\n            'pycodestyle==2.10.*',\n            'pyflakes==3.0.*',\n            'pytest-cache',\n            'pytest-cov',\n            'pytest-django==4.*',\n            'pytest-mock==3.10.*',\n            'pytest-rerunfailures==10.*',\n            'pytest-sugar',\n            'pytest-xdist==3.1.*',\n            'pytest==7.2.*',\n            'responses',\n        ],\n        'memcached': ['pylibmc'],\n        'mysql': ['mysqlclient'],\n    },\n    setup_requires=['setuptools-rust'],\n\n    packages=find_packages(exclude=['tests', 'tests.*']),\n    include_package_data=True,\n    cmdclass=cmdclass,\n)\n", "path": "src/setup.py"}], "after_files": [{"content": "#\n# This file is part of pretix (Community Edition).\n#\n# Copyright (C) 2014-2020 Raphael Michel and contributors\n# Copyright (C) 2020-2021 rami.io GmbH and contributors\n#\n# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General\n# Public License as published by the Free Software Foundation in version 3 of the License.\n#\n# ADDITIONAL TERMS APPLY: Pursuant to Section 7 of the GNU Affero General Public License, additional terms are\n# applicable granting you additional permissions and placing additional restrictions on your usage of this software.\n# Please refer to the pretix LICENSE file to obtain the full terms applicable to this work. If you did not receive\n# this file, see <https://pretix.eu/about/en/license>.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied\n# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more\n# details.\n#\n# You should have received a copy of the GNU Affero General Public License along with this program.  If not, see\n# <https://www.gnu.org/licenses/>.\n#\n\n# This file is based on an earlier version of pretix which was released under the Apache License 2.0. The full text of\n# the Apache License 2.0 can be obtained at <http://www.apache.org/licenses/LICENSE-2.0>.\n#\n# This file may have since been changed and any changes are released under the terms of AGPLv3 as described above. A\n# full history of changes and contributors is available at <https://github.com/pretix/pretix>.\n#\n# This file contains Apache-licensed contributions copyrighted by: Claudio Luck, FlaviaBastos, Katharina Bogad, Laura\n# Kl\u00fcnder, Lukas Bockstaller, Matthew Emerson, Tobias Kunze, jasonwaiting@live.hk\n#\n# Unless required by applicable law or agreed to in writing, software distributed under the Apache License 2.0 is\n# distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations under the License.\n\nimport os\nimport subprocess\nimport sys\nfrom codecs import open\nfrom distutils.command.build import build\nfrom distutils.command.build_ext import build_ext\nfrom distutils.dir_util import copy_tree\nfrom os import path\n\nfrom setuptools import find_packages, setup\n\ntry:\n    from pretix import __version__\nexcept:\n    if \"PRETIX_DOCKER_BUILD\" in os.environ:\n        __version__ = \"0.0.0\"  # this is a hack to allow calling this file early in our docker build to make use of caching\n    else:\n        raise\n\nCURRENT_PYTHON = sys.version_info[:2]\nREQUIRED_PYTHON = (3, 6)\nif CURRENT_PYTHON < REQUIRED_PYTHON:\n    sys.stderr.write(\"\"\"\n==========================\nUnsupported Python version\n==========================\nThis version of pretix requires Python {}.{}, but you're trying to\ninstall it on Python {}.{}.\nThis may be because you are using a version of pip that doesn't\nunderstand the python_requires classifier. Make sure you\nhave pip >= 9.0 and setuptools >= 24.2, then try again:\n    $ python -m pip install --upgrade pip setuptools\n    $ python -m pip install pretix\nThis will install the latest version of pretix which works on your\nversion of Python. If you can't upgrade your pip (or Python), request\nan older version of pretix:\n    $ python -m pip install \"pretix<2\"\n\"\"\".format(*(REQUIRED_PYTHON + CURRENT_PYTHON)))\n    sys.exit(1)\n\nhere = path.abspath(path.dirname(__file__))\nnpm_installed = False\n\n# Get the long description from the relevant file\ntry:\n    with open(path.join(here, '../README.rst'), encoding='utf-8') as f:\n        long_description = f.read()\nexcept:\n    long_description = ''\n\n\ndef npm_install():\n    global npm_installed\n\n    if not npm_installed:\n        # keep this in sync with Makefile!\n        node_prefix = os.path.join(here, 'pretix', 'static.dist', 'node_prefix')\n        os.makedirs(node_prefix, exist_ok=True)\n        copy_tree(os.path.join(here, 'pretix', 'static', 'npm_dir'), node_prefix)\n        subprocess.check_call('npm install', shell=True, cwd=node_prefix)\n        npm_installed = True\n\n\nclass CustomBuild(build):\n    def run(self):\n        if \"PRETIX_DOCKER_BUILD\" in os.environ:\n            return  # this is a hack to allow calling this file early in our docker build to make use of caching\n        os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"pretix.settings\")\n        os.environ.setdefault(\"PRETIX_IGNORE_CONFLICTS\", \"True\")\n        import django\n        django.setup()\n        from django.conf import settings\n        from django.core import management\n\n        settings.COMPRESS_ENABLED = True\n        settings.COMPRESS_OFFLINE = True\n\n        npm_install()\n        management.call_command('compilemessages', verbosity=1)\n        management.call_command('compilejsi18n', verbosity=1)\n        management.call_command('collectstatic', verbosity=1, interactive=False)\n        management.call_command('compress', verbosity=1)\n\n        build.run(self)\n\n\nclass CustomBuildExt(build_ext):\n    def run(self):\n        if \"PRETIX_DOCKER_BUILD\" in os.environ:\n            return  # this is a hack to allow calling this file early in our docker build to make use of caching\n        npm_install()\n        build_ext.run(self)\n\n\ncmdclass = {\n    'build': CustomBuild,\n    'build_ext': CustomBuildExt,\n}\n\n\nsetup(\n    name='pretix',\n    version=__version__,\n    python_requires='>={}.{}'.format(*REQUIRED_PYTHON),\n    description='Reinventing presales, one ticket at a time',\n    long_description=long_description,\n    url='https://pretix.eu',\n    author='Raphael Michel',\n    author_email='support@pretix.eu',\n    license='GNU Affero General Public License v3 with Additional Terms',\n    classifiers=[\n        'Development Status :: 5 - Production/Stable',\n        'Intended Audience :: Developers',\n        'Intended Audience :: Other Audience',\n        'Topic :: Internet :: WWW/HTTP :: Dynamic Content',\n        'Environment :: Web Environment',\n        'License :: OSI Approved :: GNU Affero General Public License v3',\n        'Programming Language :: Python :: 3.7',\n        'Programming Language :: Python :: 3.8',\n        'Programming Language :: Python :: 3.9',\n        'Framework :: Django :: 3.2'\n    ],\n\n    keywords='tickets web shop ecommerce',\n    install_requires=[\n        'arabic-reshaper==2.1.4',  # Support for Arabic in reportlab\n        'babel',\n        'BeautifulSoup4==4.11.*',\n        'bleach==5.0.*',\n        'celery==5.2.*',\n        'chardet==5.1.*',\n        'cryptography>=3.4.2',\n        'css-inline==0.8.*',\n        'defusedcsv>=1.1.0',\n        'dj-static',\n        'Django==3.2.*',\n        'django-bootstrap3==22.2.*',\n        'django-compressor==4.1.*',\n        'django-countries==7.5.*',\n        'django-filter==22.1',\n        'django-formset-js-improved==0.5.0.3',\n        'django-formtools==2.4',\n        'django-hierarkey==1.1.*',\n        'django-hijack==3.2.*',\n        'django-i18nfield==1.9.*,>=1.9.4',\n        'django-libsass==0.9',\n        'django-localflavor==3.1',\n        'django-markup',\n        'django-mysql',\n        'django-oauth-toolkit==1.2.*',\n        'django-otp==1.1.*',\n        'django-phonenumber-field==7.0.*',\n        'django-redis==5.2.*',\n        'django-scopes==1.2.*',\n        'django-statici18n==2.3.*',\n        'djangorestframework==3.14.*',\n        'dnspython<2.0',  # do not upgrade, causes issues with eventlet / gunicorn 19 and we cannot upgrade gunicorn right now\n        'drf_ujson2==1.7.*',\n        'isoweek',\n        'jsonschema',\n        'kombu==5.2.*',\n        'libsass==0.22.*',\n        'lxml',\n        'markdown==3.3.4',  # 3.3.5 requires importlib-metadata>=4.4, but django-bootstrap3 requires importlib-metadata<3.\n        # We can upgrade markdown again once django-bootstrap3 upgrades or once we drop Python 3.6 and 3.7\n        'mt-940==4.23.*',\n        'oauthlib==3.2.*',\n        'openpyxl==3.0.*',\n        'packaging',\n        'paypalrestsdk==1.13.*',\n        'paypal-checkout-serversdk==1.0.*',\n        'PyJWT==2.6.*',\n        'phonenumberslite==8.13.*',\n        'Pillow==9.3.*',\n        'protobuf==4.21.*',\n        'psycopg2-binary',\n        'pycountry',\n        'pycparser==2.21',\n        'pycryptodome==3.16.*',\n        'PyPDF2==2.11.*',\n        'python-bidi==0.4.*',  # Support for Arabic in reportlab\n        'python-dateutil==2.8.*',\n        'python-u2flib-server==4.*',\n        'pytz',\n        'pyuca',\n        'redis==4.4.*',\n        'reportlab==3.6.*',\n        'requests==2.28.*',\n        'sentry-sdk==1.10.*',  # when upgrading, check https://github.com/getsentry/sentry-python/issues/1700\n        'sepaxml==2.6.*',\n        'slimit',\n        'static3==0.7.*',\n        'stripe==5.0.*',\n        'text-unidecode==1.*',\n        'tlds>=2020041600',\n        'tqdm==4.*',\n        'vat_moss_forked==2020.3.20.0.11.0',\n        'vobject==0.9.*',\n        'webauthn==0.4.*',\n        'zeep==4.2.*'\n    ],\n    extras_require={\n        'dev': [\n            'coverage',\n            'coveralls',\n            'django-debug-toolbar==3.7.*',\n            'flake8==6.0.*',\n            'freezegun',\n            'isort==5.10.*',\n            'pep8-naming==0.12.*',\n            'potypo',\n            'pycodestyle==2.10.*',\n            'pyflakes==3.0.*',\n            'pytest-cache',\n            'pytest-cov',\n            'pytest-django==4.*',\n            'pytest-mock==3.10.*',\n            'pytest-rerunfailures==10.*',\n            'pytest-sugar',\n            'pytest-xdist==3.1.*',\n            'pytest==7.2.*',\n            'responses',\n        ],\n        'memcached': ['pylibmc'],\n        'mysql': ['mysqlclient'],\n    },\n    setup_requires=['setuptools-rust'],\n\n    packages=find_packages(exclude=['tests', 'tests.*']),\n    include_package_data=True,\n    cmdclass=cmdclass,\n)\n", "path": "src/setup.py"}]}