From 5b59a09e8d7774a6f18885a2f8435fbf585e4091 Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 19 May 2020 16:14:58 +0930 Subject: [PATCH] Deprecate running with Python 3.5 --- .travis.yml | 1 - gns3server/run.py | 6 +++--- gns3server/utils/asyncio/aiozipstream.py | 22 +++++++++------------- requirements.txt | 2 -- setup.py | 3 +-- 5 files changed, 13 insertions(+), 21 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0e439c97..1ccd8c38 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,6 @@ deploy: env: matrix: - - PYTHON_VERSION=3.5 - PYTHON_VERSION=3.6 - PYTHON_VERSION=3.7 - PYTHON_VERSION=3.8 diff --git a/gns3server/run.py b/gns3server/run.py index c2e72eb1..3dd2d1d3 100644 --- a/gns3server/run.py +++ b/gns3server/run.py @@ -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())) diff --git a/gns3server/utils/asyncio/aiozipstream.py b/gns3server/utils/asyncio/aiozipstream.py index f6062b5e..cbff3aff 100644 --- a/gns3server/utils/asyncio/aiozipstream.py +++ b/gns3server/utils/asyncio/aiozipstream.py @@ -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 diff --git a/requirements.txt b/requirements.txt index 57fbb793..336d15c3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py index d6dd4e48..8a04f992 100644 --- a/setup.py +++ b/setup.py @@ -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",