src/eric7/SystemUtilities/PythonUtilities.py

branch
eric7
changeset 10431
64157aeb0312
parent 10359
de0420dac60e
child 10439
21c28b0f9e41
equal deleted inserted replaced
10430:e440aaf179ce 10431:64157aeb0312
53 53
54 def getPythonLibPath(): 54 def getPythonLibPath():
55 """ 55 """
56 Function to determine the path to Python's library. 56 Function to determine the path to Python's library.
57 57
58 @return path to the Python library (string) 58 @return path to the Python library
59 @rtype str
59 """ 60 """
60 return sysconfig.get_path("platstdlib") 61 return sysconfig.get_path("platstdlib")
61 62
62 63
63 def getPythonVersion(): 64 def getPythonVersion():
64 """ 65 """
65 Function to get the Python version (major, minor) as an integer value. 66 Function to get the Python version (major, minor) as an integer value.
66 67
67 @return An integer representing major and minor version number (integer) 68 @return integer representing major and minor version number
69 @rtype int
68 """ 70 """
69 return sys.hexversion >> 16 71 return sys.hexversion >> 16
70 72
71 73
72 def determinePythonVersion(filename, source, editor=None): 74 def determinePythonVersion(filename, source, editor=None):
73 """ 75 """
74 Function to determine the python version of a given file. 76 Function to determine the python version of a given file.
75 77
76 @param filename name of the file with extension (str) 78 @param filename name of the file with extension
77 @param source of the file (str) 79 @type str
78 @param editor reference to the editor, if the file is opened 80 @param source of the file
79 already (Editor object) 81 @type str
80 @return Python version if file is Python3 (int) 82 @param editor reference to the editor, if the file is opened already
83 @type Editor
84 @return Python version if file is Python3
85 @rtype int
81 """ 86 """
82 from eric7 import Preferences, Utilities 87 from eric7 import Preferences, Utilities
83 from eric7.EricWidgets.EricApplication import ericApp 88 from eric7.EricWidgets.EricApplication import ericApp
84 89
85 pyAssignment = { 90 pyAssignment = {

eric ide

mercurial