From 876d19070394d38e4b9f47737e3229b5094d5364 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Mon, 23 Jan 2023 20:50:13 +0100 Subject: [PATCH] Ignore python3.11 cgi deprecation warning The cgi module is marked as deprecated and will be removed in python3.13. servefile uses the module for its FieldStorage class used in the upload functionality. For now I will just ignore this, so servefile doesn't print out the warning each time it is run, but soon this will require either a rewrite of FieldStorage or an external library. With this commit we also now officially support python3.10 and python3.11. --- .github/workflows/run-tox.yml | 2 +- servefile/servefile.py | 7 ++++++- setup.py | 2 ++ tox.ini | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tox.yml b/.github/workflows/run-tox.yml index e054a07..4b03442 100644 --- a/.github/workflows/run-tox.yml +++ b/.github/workflows/run-tox.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: [2.7, 3.6, 3.7, 3.8, 3.9] + python: [2.7, 3.6, 3.7, 3.8, 3.9, "3.10", 3.11] steps: - uses: actions/checkout@v2 diff --git a/servefile/servefile.py b/servefile/servefile.py index d830d5d..8775e89 100755 --- a/servefile/servefile.py +++ b/servefile/servefile.py @@ -11,7 +11,6 @@ __version__ = '0.5.3' import argparse import base64 -import cgi import datetime import io import mimetypes @@ -23,6 +22,7 @@ from subprocess import Popen, PIPE import sys import tempfile import time +import warnings # fix imports for python2/python3 try: @@ -43,6 +43,11 @@ try: except ImportError: pass +with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=DeprecationWarning) + # scheduled for removal in python3.13, used for FieldStorage + import cgi + def getDateStrNow(): """ Get the current time formatted for HTTP header """ diff --git a/setup.py b/setup.py index ebad996..1b2d6ef 100755 --- a/setup.py +++ b/setup.py @@ -42,6 +42,8 @@ setup( 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'Programming Language :: Python :: 3.11', 'Topic :: Communications', 'Topic :: Communications :: File Sharing', 'Topic :: Internet', diff --git a/tox.ini b/tox.ini index f45e701..7887c52 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27,py36,py37,py38,py39,pep8 +envlist = py27,py36,py37,py38,py39,py310,py311,pep8 [testenv] deps =