Skip to content

Commit e7d08e6

Browse files
deniszhfrh-ivuDanCechparrotpockUbuntu
authored
Preparing master to Django 3.2 (graphite-project#2766)
* Revert "Add CodeSee architecture diagram workflow to repository" This reverts commit 217ad6f. * Fix dependency issue for usage as Grafana data source. * Add pyparsing version restriction to tox tests. * Update CHANGELOG.md * Correct carbon-relay-ng url (graphite-project#2723) * maxStep in requestContext for Finder (graphite-project#2724) * Revert "Add CodeSee architecture diagram workflow to repository" This reverts commit 217ad6f. * populate maxStep from URL parameter * populate serialized targets if enabled * Fixing lint * Fix dependency issue for usage as Grafana data source. * Add pyparsing version restriction to tox tests. * Update CHANGELOG.md * Correct carbon-relay-ng url (graphite-project#2723) * Removing "targets_serialized" * Removing "targets_serialized" Co-authored-by: Henk Freimuth <[email protected]> Co-authored-by: Dan Cech <[email protected]> * Update CHANGELOG.md * Fix pyparsing > 3.0 compatibility issue. (graphite-project#2727) * Fix bool() issue in recursion termination check. The behaviour of ParsedResults seems to have changed in the way that the usage of pop() along with the bool() check on the object interact wrt checking if there are further elements in the parsed structure to consume. In version > 3.0 bool() checks whether either the internal _toklist or _tokdict members contain items left to consume and returns True if either do, whereas pop with no arguments will only consume from the underlying list. That means that we would get a True in the if condition in this code, whereas a subsequent call to pop() would throw an exception. Calling asList() forces the use of the list representation in the bool check here and so fixes this issue. * Fix pyparsing backwards compatibility issue. * Remove upper-bound on pin. * Add pyparsing3 test target for versions >= 3.0.6 * Remove try/except, use dictionary key index syntax Co-authored-by: Ubuntu <[email protected]> * Update CHANGELOG.md * Update CHANGELOG.md * Actualizing Django version * fix deprecations / DeepSource warns * argh * Adding autofield to settings * Fix admin.W411 * Master support only new Django Co-authored-by: Henk Freimuth <[email protected]> Co-authored-by: Dan Cech <[email protected]> Co-authored-by: parrotpock <[email protected]> Co-authored-by: Ubuntu <[email protected]>
1 parent ed08fa4 commit e7d08e6

File tree

8 files changed

+28
-52
lines changed

8 files changed

+28
-52
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
strategy:
3939
matrix:
40-
python-version: ['2.7', 'pypy-2.7', '3.7', '3.8', '3.9', '3.10']
40+
python-version: ['3.7', '3.8', '3.9', '3.10']
4141

4242
steps:
4343
- uses: actions/checkout@v1

requirements.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# This is a PIP requirements file.
22
# To setup a dev environment:
33
#
4-
# Use Python 2.7
5-
#
64
# If you use virtualenvwrapper, you can use the misc/virtualenvwrapper hook scripts to
75
# automate most of the following commands
86
#
@@ -37,7 +35,7 @@
3735
# deactivate
3836
#
3937

40-
Django>=1.8,<3.1
38+
Django>=3.2,<4
4139
python-memcached==1.58
4240
txAMQP==0.8
4341
django-tagging==0.4.6
@@ -49,6 +47,5 @@ git+https://github.com/graphite-project/whisper.git#egg=whisper
4947
# Ceres is optional
5048
# git+https://github.com/graphite-project/ceres.git#egg=ceres
5149
whitenoise==4.1.4
52-
scandir;python_version<"3.5"
5350
urllib3
5451
six

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ requires = Django => 1.8
1212
pyparsing
1313
scandir;python_version<"3.5"
1414

15-
post-install = distro/redhat/misc/postinstall
15+
post_install = distro/redhat/misc/postinstall
1616

1717
provides = graphite
1818
obsoletes = graphite <= 0.9.9

setup.py

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,11 @@
33
from __future__ import with_statement
44

55
import os
6-
try:
7-
from ConfigParser import ConfigParser, DuplicateSectionError # Python 2
8-
except ImportError:
9-
from configparser import ConfigParser, DuplicateSectionError # Python 3
6+
from configparser import ConfigParser, DuplicateSectionError # Python 3
107

118
from glob import glob
129
from collections import defaultdict
13-
14-
# io.StringIO is strictly unicode only. Python 2 StringIO.StringIO accepts
15-
# bytes, so we'll conveniently ignore decoding and reencoding the file there.
16-
try:
17-
from StringIO import StringIO # Python 2
18-
except ImportError:
19-
from io import StringIO # Python 3
10+
from io import StringIO # Python 3
2011

2112
# Graphite historically has an install prefix set in setup.cfg. Being in a
2213
# configuration file, it's not easy to override it or unset it (for installing
@@ -30,7 +21,7 @@
3021
with open('setup.cfg', 'r') as f:
3122
orig_setup_cfg = f.read()
3223
cf = ConfigParser()
33-
cf.readfp(StringIO(orig_setup_cfg), 'setup.cfg')
24+
cf.read_file(StringIO(orig_setup_cfg), 'setup.cfg')
3425

3526
if os.environ.get('GRAPHITE_NO_PREFIX') or os.environ.get('READTHEDOCS'):
3627
cf.remove_section('install')
@@ -42,19 +33,18 @@
4233
if not cf.has_option('install', 'prefix'):
4334
cf.set('install', 'prefix', '/opt/graphite')
4435
if not cf.has_option('install', 'install-lib'):
45-
cf.set('install', 'install-lib', '%(prefix)s/webapp')
36+
cf.set('install', 'install_lib', '%(prefix)s/webapp')
4637

4738
with open('setup.cfg', 'w') as f:
4839
cf.write(f)
4940

50-
if os.environ.get('USE_SETUPTOOLS'):
51-
from setuptools import setup
52-
setup_kwargs = dict(zip_safe=0)
53-
54-
else:
41+
if os.environ.get('USE_DISTUTILS'):
42+
# skipcq: PYL-W0402
5543
from distutils.core import setup
5644
setup_kwargs = dict()
57-
45+
else:
46+
from setuptools import setup
47+
setup_kwargs = dict(zip_safe=0)
5848

5949
storage_dirs = []
6050

@@ -68,11 +58,12 @@
6858
filepath = os.path.join(root, filename)
6959
webapp_content[root].append(filepath)
7060

71-
conf_files = [ ('conf', glob('conf/*.example')) ]
72-
examples = [ ('examples', glob('examples/example-*')) ]
61+
conf_files = [('conf', glob('conf/*.example'))]
62+
examples = [('examples', glob('examples/example-*'))]
7363

7464

7565
def read(fname):
66+
# skipcq: PTC-W6004
7667
with open(os.path.join(os.path.dirname(__file__), fname)) as f:
7768
return f.read()
7869

@@ -113,26 +104,21 @@ def read(fname):
113104
'graphite.whitelist',
114105
'graphite.worker_pool',
115106
],
116-
package_data={'graphite' :
117-
['templates/*', 'local_settings.py.example']},
107+
package_data={'graphite': ['templates/*', 'local_settings.py.example']},
118108
scripts=glob('bin/*'),
119109
data_files=list(webapp_content.items()) + storage_dirs + conf_files + examples,
120-
install_requires=['Django>=1.8,<3.1', 'django-tagging==0.4.3', 'pytz',
121-
'pyparsing', 'cairocffi', 'urllib3',
122-
'scandir;python_version<"3.5"', 'six'],
110+
install_requires=['Django>=3.2,<4', 'django-tagging==0.4.3', 'pytz',
111+
'pyparsing', 'cairocffi', 'urllib3', 'six'],
123112
classifiers=[
124113
'Intended Audience :: Developers',
125114
'Natural Language :: English',
126115
'License :: OSI Approved :: Apache Software License',
127116
'Programming Language :: Python',
128-
'Programming Language :: Python :: 2',
129-
'Programming Language :: Python :: 2.7',
130117
'Programming Language :: Python :: 3',
131-
'Programming Language :: Python :: 3.4',
132-
'Programming Language :: Python :: 3.5',
133-
'Programming Language :: Python :: 3.6',
134118
'Programming Language :: Python :: 3.7',
135119
'Programming Language :: Python :: 3.8',
120+
'Programming Language :: Python :: 3.9',
121+
'Programming Language :: Python :: 3.10',
136122
'Programming Language :: Python :: Implementation :: CPython',
137123
'Programming Language :: Python :: Implementation :: PyPy',
138124
],

tox.ini

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
[gh-actions]
22
python =
3-
2.7: py27
4-
pypy-2.7: pypy
53
3.7: py37
64
3.8: py38
75
3.9: py39
86
3.10: py310
97

108
[tox]
119
envlist =
12-
py{27,py}-django111-pyparsing2{,-msgpack,-pyhash},
13-
py{37,38,39}-django{111,22,30}-pyparsing{2,3}{,-msgpack},
14-
py310-django30-pyparsing3{,-msgpack},
10+
py{37,38,39,310}-django32-pyparsing3{,-msgpack},
1511
lint, docs
1612

1713
[testenv]
@@ -37,12 +33,8 @@ deps =
3733
mock
3834
git+https://github.com/graphite-project/whisper.git#egg=whisper
3935
git+https://github.com/graphite-project/ceres.git#egg=ceres
40-
pyparsing2: pyparsing==2.4.7
4136
pyparsing3: pyparsing>=3.0.6
42-
django111: Django>=1.11,<1.11.99
43-
django22: Django>=2.2,<2.2.99
44-
django30: Django>=3.0,<3.0.99
45-
scandir; python_version<"3.5"
37+
django32: Django>=3.2,<4
4638
urllib3
4739
redis
4840
rrdtool
@@ -60,8 +52,8 @@ deps =
6052
pytz
6153
git+https://github.com/graphite-project/whisper.git#egg=whisper
6254
git+https://github.com/graphite-project/ceres.git#egg=ceres
63-
Django<3.1
64-
pyparsing: pyparsing>=2.3.0,<3.0.0
55+
Django<4
56+
pyparsing3: pyparsing>=3.0.6
6557
Sphinx<1.4
6658
jinja2<3.1.0
6759
sphinx_rtd_theme

webapp/graphite/app_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
'django.template.context_processors.debug',
5454
'django.template.context_processors.i18n',
5555
'django.template.context_processors.media',
56+
'django.template.context_processors.request',
5657
'django.template.context_processors.static',
5758
'django.template.context_processors.tz',
5859
'django.contrib.messages.context_processors.messages',

webapp/graphite/render/glyph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
from six.moves import range, zip
2121
from six.moves.urllib.parse import unquote_plus
22-
from six.moves.configparser import SafeConfigParser
22+
from six.moves.configparser import ConfigParser
2323
from django.conf import settings
2424
import pytz
2525
import six
@@ -811,7 +811,7 @@ def encodeHeader(self,text):
811811
self.ctx.restore()
812812

813813
def loadTemplate(self,template):
814-
conf = SafeConfigParser()
814+
conf = ConfigParser()
815815
if conf.read(settings.GRAPHTEMPLATES_CONF):
816816
defaults = defaultGraphOptions
817817
# If a graphTemplates.conf exists, read in

webapp/graphite/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
# Function plugins
167167
FUNCTION_PLUGINS = []
168168

169-
169+
DEFAULT_AUTO_FIELD='django.db.models.AutoField'
170170
MIDDLEWARE = ()
171171
if DJANGO_VERSION < (1, 10):
172172
MIDDLEWARE_CLASSES = MIDDLEWARE

0 commit comments

Comments
 (0)