1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 17:56:30 +00:00

Overhauled dependency check

This commit is contained in:
Paweł Jastrzębski
2014-04-30 20:38:23 +02:00
parent e3ab28642d
commit df5ee1badf
4 changed files with 32 additions and 26 deletions

View File

@@ -41,7 +41,7 @@ You can find the latest released binary at the following links:
### For running from source: ### For running from source:
- Python 3.3+ - Python 3.3+
- [PyQt5](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.0+ - [PyQt5](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.1+
- [Pillow](http://pypi.python.org/pypi/Pillow/) 2.3.0+ - [Pillow](http://pypi.python.org/pypi/Pillow/) 2.3.0+
- [psutil](https://pypi.python.org/pypi/psutil) 2.0+ - [psutil](https://pypi.python.org/pypi/psutil) 2.0+
- [python-slugify](http://pypi.python.org/pypi/python-slugify) - [python-slugify](http://pypi.python.org/pypi/python-slugify)

View File

@@ -28,25 +28,27 @@ if sys.version_info[0] != 3:
print('ERROR: This is Python 3 script!') print('ERROR: This is Python 3 script!')
exit(1) exit(1)
# Dependiences check # Dependency check
missing = [] missing = []
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from psutil import virtual_memory, Popen import psutil
if tuple(map(int, ('2.0.0'.split(".")))) > tuple(map(int, psutil.version_info)):
missing.append('psutil 2.0.0+')
except ImportError: except ImportError:
missing.append('psutil') missing.append('psutil 2.0.0+')
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from slugify import slugify import PIL
except ImportError: if tuple(map(int, ('2.3.0'.split(".")))) > tuple(map(int, (PIL.PILLOW_VERSION.split(".")))):
missing.append('python-slugify')
try:
# noinspection PyUnresolvedReferences
from PIL import Image, ImageOps, ImageStat, ImageChops
if tuple(map(int, ('2.3.0'.split(".")))) > tuple(map(int, (Image.PILLOW_VERSION.split(".")))):
missing.append('Pillow 2.3.0+') missing.append('Pillow 2.3.0+')
except ImportError: except ImportError:
missing.append('Pillow 2.3.0+') missing.append('Pillow 2.3.0+')
try:
# noinspection PyUnresolvedReferences
import slugify
except ImportError:
missing.append('python-slugify')
if len(missing) > 0: if len(missing) > 0:
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences

View File

@@ -28,12 +28,12 @@ if sys.version_info[0] != 3:
print('ERROR: This is Python 3 script!') print('ERROR: This is Python 3 script!')
exit(1) exit(1)
# Dependiences check # Dependency check
missing = [] missing = []
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from PIL import Image, ImageOps, ImageStat, ImageChops import PIL
if tuple(map(int, ('2.3.0'.split(".")))) > tuple(map(int, (Image.PILLOW_VERSION.split(".")))): if tuple(map(int, ('2.3.0'.split(".")))) > tuple(map(int, (PIL.PILLOW_VERSION.split(".")))):
missing.append('Pillow 2.3.0+') missing.append('Pillow 2.3.0+')
except ImportError: except ImportError:
missing.append('Pillow 2.3.0+') missing.append('Pillow 2.3.0+')

28
kcc.py
View File

@@ -28,30 +28,34 @@ if sys.version_info[0] != 3:
print('ERROR: This is Python 3 script!') print('ERROR: This is Python 3 script!')
exit(1) exit(1)
# Dependiences check # Dependency check
missing = [] missing = []
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from PyQt5 import QtCore, QtGui, QtNetwork, QtWidgets from PyQt5 import QtCore, QtNetwork, QtWidgets
if tuple(map(int, ('5.2.1'.split(".")))) > tuple(map(int, (QtCore.qVersion().split(".")))):
missing.append('PyQt5 5.2.1+')
except ImportError: except ImportError:
missing.append('PyQt5') missing.append('PyQt5 5.2.1+')
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from psutil import virtual_memory, Popen import psutil
if tuple(map(int, ('2.0.0'.split(".")))) > tuple(map(int, psutil.version_info)):
missing.append('psutil 2.0.0+')
except ImportError: except ImportError:
missing.append('psutil') missing.append('psutil 2.0.0+')
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
from slugify import slugify import PIL
except ImportError: if tuple(map(int, ('2.3.0'.split(".")))) > tuple(map(int, (PIL.PILLOW_VERSION.split(".")))):
missing.append('python-slugify')
try:
# noinspection PyUnresolvedReferences
from PIL import Image, ImageOps, ImageStat, ImageChops
if tuple(map(int, ('2.3.0'.split(".")))) > tuple(map(int, (Image.PILLOW_VERSION.split(".")))):
missing.append('Pillow 2.3.0+') missing.append('Pillow 2.3.0+')
except ImportError: except ImportError:
missing.append('Pillow 2.3.0+') missing.append('Pillow 2.3.0+')
try:
# noinspection PyUnresolvedReferences
import slugify
except ImportError:
missing.append('python-slugify')
if len(missing) > 0: if len(missing) > 0:
try: try:
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences