Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions package_control/package_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,12 @@ def cleanup_python_environments(self):
cache2 = os.path.join(sys_path.cache_path(), "__pycache__", "data", "Lib", "python")

supported_versions = sys_path.python_versions()
if "3.3" not in supported_versions:
# Python folder is re-created at each startup, hence just clear it for now.
clear_directory(libdir + "33")
# Python 3.3 itself doesn't support nor create compiled cache modules,
# ST's fallback mechanism might however have created some py38 or py313 cache files
# in those directories, which need to be cleared out.
delete_directory(cache1 + "33")
delete_directory(cache2 + "33")

if "3.8" not in supported_versions:
# if 3.8 is not supported it is not present, delete all folders
delete_directory(libdir + "38")
delete_directory(cache1 + "38")
delete_directory(cache2 + "38")
for pyver in ("3.3", "3.8", "3.13", "3.14"):
if pyver not in supported_versions:
pyver = pyver.replace(".", "")
clear_directory(libdir + pyver)
delete_directory(cache1 + pyver)
delete_directory(cache2 + pyver)

def cleanup_pending_packages(self):
"""
Expand Down
35 changes: 17 additions & 18 deletions package_control/sys_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
if __installed_packages_path is None:
raise FileNotFoundError('Installed Packages')

assert __data_path

if PREFIX:
__data_path = PREFIX + __data_path
__default_packages_path = PREFIX + __default_packages_path
Expand Down Expand Up @@ -151,28 +153,25 @@ def lib_paths():
try:
return lib_paths.cache
except AttributeError:
assert __data_path
st_version = int(sublime.version())
if st_version > 4000:
root = os.path.dirname(__executable_path)
fext = ".exe" if sublime.platform() == "windows" else ""
if st_version >= 4203:
lib_paths.cache = {"3.14": os.path.join(__data_path, "Lib", "python314")}
elif st_version >= 4201:
lib_paths.cache = {"3.13": os.path.join(__data_path, "Lib", "python313")}
elif st_version >= 4000:
lib_paths.cache = {"3.8": os.path.join(__data_path, "Lib", "python38")}
else:
lib_paths.cache = {"3.3": os.path.join(__data_path, "Lib", "python3.3")}

if st_version >= 4194:
settings = sublime.load_settings("Preferences.sublime-settings")
data = (
("3.3", "python33", not settings.get('disable_plugin_host_3.3', False)),
("3.8", "python38", True),
("3.13", "python313", True),
("3.14", "python314", True),
)
lib_paths.cache = {
py_ver: os.path.join(__data_path, "Lib", py_dir)
for py_ver, py_dir, enable in data
if enable and os.path.isfile(os.path.join(root, "plugin_host-" + py_ver + fext))
}
if not settings.get("disable_plugin_host_3.3", False):
root = os.path.dirname(__executable_path)
fext = ".exe" if sublime.platform() == "windows" else ""
if os.path.isfile(os.path.join(root, "plugin_host-3.3" + fext)):
lib_paths.cache["3.3"] = os.path.join(__data_path, "Lib", "python33")

else:
lib_paths.cache = {
"3.3": os.path.join(__data_path, "Lib", "python3.3")
}
return lib_paths.cache


Expand Down
Loading