mirror of
https://github.com/GNS3/gns3-server.git
synced 2024-11-16 16:54:51 +02:00
Deprecate running with Python 3.5
This commit is contained in:
parent
54bab7445c
commit
5b59a09e8d
@ -27,7 +27,6 @@ deploy:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- PYTHON_VERSION=3.5
|
|
||||||
- PYTHON_VERSION=3.6
|
- PYTHON_VERSION=3.6
|
||||||
- PYTHON_VERSION=3.7
|
- PYTHON_VERSION=3.7
|
||||||
- PYTHON_VERSION=3.8
|
- PYTHON_VERSION=3.8
|
||||||
|
@ -236,9 +236,9 @@ def run():
|
|||||||
return
|
return
|
||||||
log.info("HTTP authentication is enabled with username '{}'".format(user))
|
log.info("HTTP authentication is enabled with username '{}'".format(user))
|
||||||
|
|
||||||
# we only support Python 3 version >= 3.5.3
|
# we only support Python 3 version >= 3.6
|
||||||
if sys.version_info < (3, 5, 3):
|
if sys.version_info < (3, 6, 0):
|
||||||
raise SystemExit("Python 3.5.3 or higher is required")
|
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],
|
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()))
|
micro=sys.version_info[2], pid=os.getpid()))
|
||||||
|
@ -31,7 +31,6 @@ import zipfile
|
|||||||
import asyncio
|
import asyncio
|
||||||
import aiofiles
|
import aiofiles
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
from async_generator import async_generator, yield_
|
|
||||||
|
|
||||||
from zipfile import (structCentralDir, structEndArchive64, structEndArchive, structEndArchive64Locator,
|
from zipfile import (structCentralDir, structEndArchive64, structEndArchive, structEndArchive64Locator,
|
||||||
stringCentralDir, stringEndArchive64, stringEndArchive, stringEndArchive64Locator)
|
stringCentralDir, stringEndArchive64, stringEndArchive, stringEndArchive64Locator)
|
||||||
@ -162,7 +161,6 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
self._comment = comment
|
self._comment = comment
|
||||||
self._didModify = True
|
self._didModify = True
|
||||||
|
|
||||||
@async_generator
|
|
||||||
async def data_generator(self, path):
|
async def data_generator(self, path):
|
||||||
|
|
||||||
async with aiofiles.open(path, "rb") as f:
|
async with aiofiles.open(path, "rb") as f:
|
||||||
@ -170,7 +168,7 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
part = await f.read(self._chunksize)
|
part = await f.read(self._chunksize)
|
||||||
if not part:
|
if not part:
|
||||||
break
|
break
|
||||||
await yield_(part)
|
yield part
|
||||||
return
|
return
|
||||||
|
|
||||||
async def _run_in_executor(self, task, *args, **kwargs):
|
async def _run_in_executor(self, task, *args, **kwargs):
|
||||||
@ -181,14 +179,13 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
return await loop.run_in_executor(futures.ThreadPoolExecutor(max_workers=1), task, *args, **kwargs)
|
return await loop.run_in_executor(futures.ThreadPoolExecutor(max_workers=1), task, *args, **kwargs)
|
||||||
|
|
||||||
@async_generator
|
|
||||||
async def _stream(self):
|
async def _stream(self):
|
||||||
|
|
||||||
for kwargs in self.paths_to_write:
|
for kwargs in self.paths_to_write:
|
||||||
async for chunk in self._write(**kwargs):
|
async for chunk in self._write(**kwargs):
|
||||||
await yield_(chunk)
|
yield chunk
|
||||||
for chunk in self._close():
|
for chunk in self._close():
|
||||||
await yield_(chunk)
|
yield chunk
|
||||||
|
|
||||||
def write(self, filename, arcname=None, compress_type=None):
|
def write(self, filename, arcname=None, compress_type=None):
|
||||||
"""
|
"""
|
||||||
@ -215,7 +212,6 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
yield data
|
yield data
|
||||||
return self.write_iter(arcname, _iterable(), compress_type=compress_type)
|
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):
|
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`.
|
Put the bytes from filename into the archive under the name `arcname`.
|
||||||
@ -272,7 +268,7 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
zinfo.CRC = 0
|
zinfo.CRC = 0
|
||||||
self.filelist.append(zinfo)
|
self.filelist.append(zinfo)
|
||||||
self.NameToInfo[zinfo.filename] = zinfo
|
self.NameToInfo[zinfo.filename] = zinfo
|
||||||
await yield_(self.fp.write(zinfo.FileHeader(False)))
|
yield self.fp.write(zinfo.FileHeader(False))
|
||||||
return
|
return
|
||||||
|
|
||||||
cmpr = _get_compressor(zinfo.compress_type)
|
cmpr = _get_compressor(zinfo.compress_type)
|
||||||
@ -282,7 +278,7 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
zinfo.compress_size = compress_size = 0
|
zinfo.compress_size = compress_size = 0
|
||||||
# Compressed size can be larger than uncompressed size
|
# Compressed size can be larger than uncompressed size
|
||||||
zip64 = self._allowZip64 and zinfo.file_size * 1.05 > zipfile.ZIP64_LIMIT
|
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
|
file_size = 0
|
||||||
if filename:
|
if filename:
|
||||||
@ -292,7 +288,7 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
if cmpr:
|
if cmpr:
|
||||||
buf = await self._run_in_executor(cmpr.compress, buf)
|
buf = await self._run_in_executor(cmpr.compress, buf)
|
||||||
compress_size = compress_size + len(buf)
|
compress_size = compress_size + len(buf)
|
||||||
await yield_(self.fp.write(buf))
|
yield self.fp.write(buf)
|
||||||
else: # we have an iterable
|
else: # we have an iterable
|
||||||
for buf in iterable:
|
for buf in iterable:
|
||||||
file_size = file_size + len(buf)
|
file_size = file_size + len(buf)
|
||||||
@ -300,12 +296,12 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
if cmpr:
|
if cmpr:
|
||||||
buf = await self._run_in_executor(cmpr.compress, buf)
|
buf = await self._run_in_executor(cmpr.compress, buf)
|
||||||
compress_size = compress_size + len(buf)
|
compress_size = compress_size + len(buf)
|
||||||
await yield_(self.fp.write(buf))
|
yield self.fp.write(buf)
|
||||||
|
|
||||||
if cmpr:
|
if cmpr:
|
||||||
buf = cmpr.flush()
|
buf = cmpr.flush()
|
||||||
compress_size = compress_size + len(buf)
|
compress_size = compress_size + len(buf)
|
||||||
await yield_(self.fp.write(buf))
|
yield self.fp.write(buf)
|
||||||
zinfo.compress_size = compress_size
|
zinfo.compress_size = compress_size
|
||||||
else:
|
else:
|
||||||
zinfo.compress_size = file_size
|
zinfo.compress_size = file_size
|
||||||
@ -317,7 +313,7 @@ class ZipFile(zipfile.ZipFile):
|
|||||||
if compress_size > zipfile.ZIP64_LIMIT:
|
if compress_size > zipfile.ZIP64_LIMIT:
|
||||||
raise RuntimeError('Compressed size larger than uncompressed size')
|
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.filelist.append(zinfo)
|
||||||
self.NameToInfo[zinfo.filename] = zinfo
|
self.NameToInfo[zinfo.filename] = zinfo
|
||||||
|
|
||||||
|
@ -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==3.2.0; python_version >= '3.8' # pyup: ignore
|
||||||
jsonschema==2.6.0; python_version < '3.8' # pyup: ignore
|
jsonschema==2.6.0; python_version < '3.8' # pyup: ignore
|
||||||
aiohttp==3.6.2
|
aiohttp==3.6.2
|
||||||
aiohttp-cors==0.7.0
|
aiohttp-cors==0.7.0
|
||||||
aiofiles==0.4.0
|
aiofiles==0.4.0
|
||||||
async_generator>=1.10
|
|
||||||
Jinja2>=2.7.3
|
Jinja2>=2.7.3
|
||||||
raven>=5.23.0
|
raven>=5.23.0
|
||||||
psutil==5.6.6
|
psutil==5.6.6
|
||||||
|
3
setup.py
3
setup.py
@ -61,7 +61,7 @@ setup(
|
|||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
platforms="any",
|
platforms="any",
|
||||||
python_requires='>=3.5.3',
|
python_requires='>=3.6.0',
|
||||||
setup_requires=["setuptools>=17.1"],
|
setup_requires=["setuptools>=17.1"],
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 5 - Production/Stable",
|
"Development Status :: 5 - Production/Stable",
|
||||||
@ -75,7 +75,6 @@ setup(
|
|||||||
"Operating System :: Microsoft :: Windows",
|
"Operating System :: Microsoft :: Windows",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"Programming Language :: Python :: 3.5",
|
|
||||||
"Programming Language :: Python :: 3.6",
|
"Programming Language :: Python :: 3.6",
|
||||||
"Programming Language :: Python :: 3.7",
|
"Programming Language :: Python :: 3.7",
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
|
Loading…
Reference in New Issue
Block a user