1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
|
From: Denis Zhdanov <denis.zhdanov@gmail.com>
Date: Sun, 11 Sep 2022 19:33:57 +0200
Subject: [PATCH] Preparing master to Django 3.2 (#2766)
Applied-Upstream: commit:e7d08e6af65c47c5a5dd6421c5b352d7ac3d381c
Forwarded: not-needed
Notably:
* Adding autofield to settings
* fix build with Python 3.12
---
.github/workflows/tests.yml | 2 +-
requirements.txt | 5 +---
setup.cfg | 2 +-
setup.py | 48 ++++++++++++---------------------
tox.ini | 16 +++--------
webapp/graphite/app_settings.py | 1 +
webapp/graphite/render/glyph.py | 4 +--
webapp/graphite/settings.py | 2 +-
8 files changed, 28 insertions(+), 52 deletions(-)
--- graphite-web.orig/setup.cfg 2024-02-13 14:49:49.462911970 +0100
+++ graphite-web/setup.cfg 2024-02-13 14:51:09.172393756 +0100
@@ -11,7 +11,9 @@
pytz
pyparsing
scandir;python_version<"3.5"
-post-install = distro/redhat/misc/postinstall
+
+post_install = distro/redhat/misc/postinstall
+
provides = graphite
obsoletes = graphite <= 0.9.9
@@ -58,7 +60,7 @@
[install]
prefix = /opt/graphite
-install-lib = %(prefix)s/webapp
+install_lib = %(prefix)s/webapp
[egg_info]
tag_build =
--- graphite-web.orig/setup.py 2024-02-13 14:49:49.462911970 +0100
+++ graphite-web/setup.py 2024-02-13 14:49:49.458911895 +0100
@@ -3,20 +3,11 @@
from __future__ import with_statement
import os
-try:
- from ConfigParser import ConfigParser, DuplicateSectionError # Python 2
-except ImportError:
- from configparser import ConfigParser, DuplicateSectionError # Python 3
+from configparser import ConfigParser, DuplicateSectionError # Python 3
from glob import glob
from collections import defaultdict
-
-# io.StringIO is strictly unicode only. Python 2 StringIO.StringIO accepts
-# bytes, so we'll conveniently ignore decoding and reencoding the file there.
-try:
- from StringIO import StringIO # Python 2
-except ImportError:
- from io import StringIO # Python 3
+from io import StringIO # Python 3
# Graphite historically has an install prefix set in setup.cfg. Being in a
# configuration file, it's not easy to override it or unset it (for installing
@@ -30,7 +21,7 @@
with open('setup.cfg', 'r') as f:
orig_setup_cfg = f.read()
cf = ConfigParser()
-cf.readfp(StringIO(orig_setup_cfg), 'setup.cfg')
+cf.read_file(StringIO(orig_setup_cfg), 'setup.cfg')
if os.environ.get('GRAPHITE_NO_PREFIX') or os.environ.get('READTHEDOCS'):
cf.remove_section('install')
@@ -42,19 +33,18 @@
if not cf.has_option('install', 'prefix'):
cf.set('install', 'prefix', '/opt/graphite')
if not cf.has_option('install', 'install-lib'):
- cf.set('install', 'install-lib', '%(prefix)s/webapp')
+ cf.set('install', 'install_lib', '%(prefix)s/webapp')
with open('setup.cfg', 'w') as f:
cf.write(f)
-if os.environ.get('USE_SETUPTOOLS'):
- from setuptools import setup
- setup_kwargs = dict(zip_safe=0)
-
-else:
+if os.environ.get('USE_DISTUTILS'):
+ # skipcq: PYL-W0402
from distutils.core import setup
setup_kwargs = dict()
-
+else:
+ from setuptools import setup
+ setup_kwargs = dict(zip_safe=0)
storage_dirs = []
@@ -68,11 +58,12 @@
filepath = os.path.join(root, filename)
webapp_content[root].append(filepath)
-conf_files = [ ('conf', glob('conf/*.example')) ]
-examples = [ ('examples', glob('examples/example-*')) ]
+conf_files = [('conf', glob('conf/*.example'))]
+examples = [('examples', glob('examples/example-*'))]
def read(fname):
+ # skipcq: PTC-W6004
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
return f.read()
@@ -113,26 +104,21 @@
'graphite.whitelist',
'graphite.worker_pool',
],
- package_data={'graphite' :
- ['templates/*', 'local_settings.py.example']},
+ package_data={'graphite': ['templates/*', 'local_settings.py.example']},
scripts=glob('bin/*'),
data_files=list(webapp_content.items()) + storage_dirs + conf_files + examples,
- install_requires=['Django>=1.8,<3.1', 'django-tagging==0.4.3', 'pytz',
- 'pyparsing', 'cairocffi', 'urllib3',
- 'scandir;python_version<"3.5"', 'six'],
+ install_requires=['Django>=3.2,<4', 'django-tagging==0.4.3', 'pytz',
+ 'pyparsing', 'cairocffi', 'urllib3', 'six'],
classifiers=[
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python',
- 'Programming Language :: Python :: 2',
- 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
- 'Programming Language :: Python :: 3.4',
- 'Programming Language :: Python :: 3.5',
- 'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
+ 'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
--- graphite-web.orig/webapp/graphite/app_settings.py 2024-02-13 14:49:49.462911970 +0100
+++ graphite-web/webapp/graphite/app_settings.py 2024-02-13 14:49:49.458911895 +0100
@@ -53,6 +53,7 @@
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
+ 'django.template.context_processors.request',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
--- graphite-web.orig/webapp/graphite/render/glyph.py 2024-02-13 14:49:49.462911970 +0100
+++ graphite-web/webapp/graphite/render/glyph.py 2024-02-13 14:49:49.458911895 +0100
@@ -19,7 +19,7 @@
from six.moves import range, zip
from six.moves.urllib.parse import unquote_plus
-from six.moves.configparser import SafeConfigParser
+from six.moves.configparser import ConfigParser
from django.conf import settings
import pytz
import six
@@ -811,7 +811,7 @@
self.ctx.restore()
def loadTemplate(self,template):
- conf = SafeConfigParser()
+ conf = ConfigParser()
if conf.read(settings.GRAPHTEMPLATES_CONF):
defaults = defaultGraphOptions
# If a graphTemplates.conf exists, read in
--- graphite-web.orig/webapp/graphite/settings.py 2024-02-13 14:49:49.462911970 +0100
+++ graphite-web/webapp/graphite/settings.py 2024-02-13 14:49:49.458911895 +0100
@@ -169,7 +169,7 @@
# Function plugins
FUNCTION_PLUGINS = []
-
+DEFAULT_AUTO_FIELD='django.db.models.AutoField'
MIDDLEWARE = ()
if DJANGO_VERSION < (1, 10):
MIDDLEWARE_CLASSES = MIDDLEWARE
|