MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / version_precheck

Function version_precheck

service/prereqsCheck.py:28–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26
27
28def version_precheck():
29 global version_block
30
31 version_block += "\nOS version: {}".format(platform.platform())
32 version_block += "\nPython version: {}".format(sys.version)
33
34 if sys.version_info < (3, 6):
35 msg = "pyfa requires python 3.6"
36 raise PreCheckException(msg)
37
38 try:
39 # the way that the version string is imported in wx is odd, causing us to have to split out the imports like this. :(
40 from wx.__version__ import VERSION, VERSION_STRING
41
42 if VERSION[0] < 4:
43 raise Exception()
44 if VERSION[3] != '':
45 if VERSION[3][0] == 'b' and int(VERSION[3][-1]) < 2:
46 raise Exception()
47
48 import wx
49 version_block += "\nwxPython version: {} ({})".format(VERSION_STRING, wx.wxWidgets_version)
50 except (KeyboardInterrupt, SystemExit):
51 raise
52 except:
53 msg = "pyfa requires wxPython v4.0.0b2+. You can download wxPython from https://wxpython.org/pages/downloads/"
54 raise PreCheckException(msg)
55
56 try:
57 import sqlalchemy
58 saMatch = re.match(r"([0-9]+).([0-9]+).([0-9]+)(([b\.])([0-9]+))?", sqlalchemy.__version__)
59 version_block += "\nSQLAlchemy version: {}".format(sqlalchemy.__version__)
60
61 if (int(saMatch.group(1)), int(saMatch.group(2)), int(saMatch.group(3))) < (1, 0, 5):
62 raise Exception()
63 except (KeyboardInterrupt, SystemExit):
64 raise
65 except:
66 msg = "pyfa requires SQLAlchemy v1.0.5+. You can download SQLAlchemy from https://www.sqlalchemy.org/download.html"
67 raise PreCheckException(msg)
68
69 try:
70 import logbook
71 logVersion = logbook.__version__.split('.')
72 version_block += "\nLogbook version: {}".format(logbook.__version__)
73
74 if int(logVersion[0]) < 1:
75 raise Exception()
76 except (KeyboardInterrupt, SystemExit):
77 raise
78 except:
79 raise PreCheckException("pyfa requires Logbook version 1.0.0+. You can download Logbook from https://pypi.python.org/pypi/Logbook")
80
81 try:
82 import requests
83 version_block += "\nRequests version: {}".format(requests.__version__)
84 except (KeyboardInterrupt, SystemExit):
85 raise

Callers 1

pyfa.pyFile · 0.90

Calls 1

PreCheckExceptionClass · 0.85

Tested by

no test coverage detected