1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-25 00:08:11 +00:00

Deprecate running with Python 3.5

This commit is contained in:
grossmj 2020-05-19 16:14:58 +09:30
parent 54bab7445c
commit 5b59a09e8d
5 changed files with 13 additions and 21 deletions

View File

@ -27,7 +27,6 @@ deploy:
env:
matrix:
- PYTHON_VERSION=3.5
- PYTHON_VERSION=3.6
- PYTHON_VERSION=3.7
- PYTHON_VERSION=3.8

View File

@ -236,9 +236,9 @@ def run():
return
log.info("HTTP authentication is enabled with username '{}'".format(user))
# we only support Python 3 version >= 3.5.3
if sys.version_info < (3, 5, 3):
raise SystemExit("Python 3.5.3 or higher is required")
# we only support Python 3 version >= 3.6
if sys.version_info < (3, 6, 0):
raise SystemExit("Python 3.6 or higher is required")
user_log.info("Running with Python {major}.{minor}.{micro} and has PID {pid}".format(major=sys.version_info[0], minor=sys.version_info[1],
micro=sys.version_info[2], pid=os.getpid()))

View File

@ -31,7 +31,6 @@ import zipfile
import asyncio
import aiofiles
from concurrent import futures
from async_generator import async_generator, yield_
from zipfile import (structCentralDir, structEndArchive64, structEndArchive, structEndArchive64Locator,
stringCentralDir, stringEndArchive64, stringEndArchive, stringEndArchive64Locator)
@ -162,7 +161,6 @@ class ZipFile(zipfile.ZipFile):
self._comment = comment
self._didModify = True
@async_generator
async def data_generator(self, path):
async with aiofiles.open(path, "rb") as f:
@ -170,7 +168,7 @@ class ZipFile(zipfile.ZipFile):
part = await f.read(self._chunksize)
if not part:
break
await yield_(part)
yield part
return
async def _run_in_executor(self, task, *args, **kwargs):
@ -181,14 +179,13 @@ class ZipFile(zipfile.ZipFile):
loop = asyncio.get_event_loop()
return await loop.run_in_executor(futures.ThreadPoolExecutor(max_workers=1), task, *args, **kwargs)
@async_generator
async def _stream(self):
for kwargs in self.paths_to_write:
async for chunk in self._write(**kwargs):
await yield_(chunk)
yield chunk
for chunk in self._close():
await yield_(chunk)
yield chunk
def write(self, filename, arcname=None, compress_type=None):
"""
@ -215,7 +212,6 @@ class ZipFile(zipfile.ZipFile):
yield data
return self.write_iter(arcname, _iterable(), compress_type=compress_type)
@async_generator
async def _write(self, filename=None, iterable=None, arcname=None, compress_type=None):
"""
Put the bytes from filename into the archive under the name `arcname`.
@ -272,7 +268,7 @@ class ZipFile(zipfile.ZipFile):
zinfo.CRC = 0
self.filelist.append(zinfo)
self.NameToInfo[zinfo.filename] = zinfo
await yield_(self.fp.write(zinfo.FileHeader(False)))
yield self.fp.write(zinfo.FileHeader(False))
return
cmpr = _get_compressor(zinfo.compress_type)
@ -282,7 +278,7 @@ class ZipFile(zipfile.ZipFile):
zinfo.compress_size = compress_size = 0
# Compressed size can be larger than uncompressed size
zip64 = self._allowZip64 and zinfo.file_size * 1.05 > zipfile.ZIP64_LIMIT
await yield_(self.fp.write(zinfo.FileHeader(zip64)))
yield self.fp.write(zinfo.FileHeader(zip64))
file_size = 0
if filename:
@ -292,7 +288,7 @@ class ZipFile(zipfile.ZipFile):
if cmpr:
buf = await self._run_in_executor(cmpr.compress, buf)
compress_size = compress_size + len(buf)
await yield_(self.fp.write(buf))
yield self.fp.write(buf)
else: # we have an iterable
for buf in iterable:
file_size = file_size + len(buf)
@ -300,12 +296,12 @@ class ZipFile(zipfile.ZipFile):
if cmpr:
buf = await self._run_in_executor(cmpr.compress, buf)
compress_size = compress_size + len(buf)
await yield_(self.fp.write(buf))
yield self.fp.write(buf)
if cmpr:
buf = cmpr.flush()
compress_size = compress_size + len(buf)
await yield_(self.fp.write(buf))
yield self.fp.write(buf)
zinfo.compress_size = compress_size
else:
zinfo.compress_size = file_size
@ -317,7 +313,7 @@ class ZipFile(zipfile.ZipFile):
if compress_size > zipfile.ZIP64_LIMIT:
raise RuntimeError('Compressed size larger than uncompressed size')
await yield_(self.fp.write(zinfo.DataDescriptor()))
yield self.fp.write(zinfo.DataDescriptor())
self.filelist.append(zinfo)
self.NameToInfo[zinfo.filename] = zinfo

View File

@ -1,10 +1,8 @@
yarl==1.3.0 # yarl 1.4+ requires Python 3.6+ (needed by aiohttp and aiohttp-cors)
jsonschema==3.2.0; python_version >= '3.8' # pyup: ignore
jsonschema==2.6.0; python_version < '3.8' # pyup: ignore
aiohttp==3.6.2
aiohttp-cors==0.7.0
aiofiles==0.4.0
async_generator>=1.10
Jinja2>=2.7.3
raven>=5.23.0
psutil==5.6.6

View File

@ -61,7 +61,7 @@ setup(
include_package_data=True,
zip_safe=False,
platforms="any",
python_requires='>=3.5.3',
python_requires='>=3.6.0',
setup_requires=["setuptools>=17.1"],
classifiers=[
"Development Status :: 5 - Production/Stable",
@ -75,7 +75,6 @@ setup(
"Operating System :: Microsoft :: Windows",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",