use pycryptodome instead of pycrypto

This commit is contained in:
Izalia Mae 2019-11-19 22:08:14 -05:00
parent 132cd1ea42
commit 544d790ef2
2 changed files with 25 additions and 1 deletions

View file

@ -1,9 +1,32 @@
import asyncio import asyncio
import aiohttp.web import aiohttp.web
import logging import logging
import platform
import sys
import Crypto
import time
from . import app, CONFIG from . import app, CONFIG
def crypto_check():
vers_split = platform.python_version().split('.')
pip_command = 'pip3 uninstall pycrypto && pip3 install pycryptodome'
if Crypto.__version__ != '2.6.1':
return
if int(vers_split[1]) > 7 and Crypto.__version__ == '2.6.1':
logging.error('PyCrypto is broken on Python 3.8+. Please replace it with pycryptodome before running again. Exiting in 10 sec...')
logging.error(pip_command)
time.sleep(10)
sys.exit()
else:
logging.warning('PyCrypto is old and should be replaced with pycryptodome')
logging.warning(pip_command)
async def start_webserver(): async def start_webserver():
runner = aiohttp.web.AppRunner(app) runner = aiohttp.web.AppRunner(app)
await runner.setup() await runner.setup()
@ -28,4 +51,5 @@ def main():
if __name__ == '__main__': if __name__ == '__main__':
crypto_check()
main() main()

View file

@ -5,7 +5,7 @@ chardet==3.0.4
idna==2.7 idna==2.7
idna-ssl==1.1.0 idna-ssl==1.1.0
multidict==4.3.1 multidict==4.3.1
pycrypto==2.6.1 pycryptodome==3.9.4
PyYAML==3.13 PyYAML==3.13
simplejson==3.16.0 simplejson==3.16.0
yarl==1.2.6 yarl==1.2.6