Skip to content
Merged
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
32 changes: 17 additions & 15 deletions source/installer.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#installer.py
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2011-2019 NV Access Limited, Joseph Lee, Babbage B.V.
# -*- coding: UTF-8 -*-
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2011-2019 NV Access Limited, Joseph Lee, Babbage B.V., Łukasz Golonka

from ctypes import *
from ctypes.wintypes import *
Expand All @@ -23,7 +23,7 @@
import easeOfAccess
import COMRegistrationFixes
import winKernel
import importlib.machinery

_wsh=None
def _getWSH():
global _wsh
Expand Down Expand Up @@ -200,20 +200,22 @@ def removeOldProgramFiles(destPath):
else:
os.remove(fn)

# #4235: mpr.dll is a Windows system dll accidentally included with
# earlier versions of NVDA. Its presence causes problems in Windows Vista.
fn = os.path.join(destPath, "mpr.dll")
if os.path.isfile(fn):
tryRemoveFile(fn)

# #9960: If compiled python files from older versions aren't removed correctly,
# this could cause strange errors when Python tries to create tracebacks
# in a newer version of NVDA.
# However don't touch user and system config.
# Also remove old .dll and .manifest files.
for curDestDir,subDirs,files in os.walk(destPath):
if curDestDir == destPath:
subDirs[:] = [x for x in subDirs if os.path.basename(x).lower() not in (
'userconfig',
'systemconfig',
# Do not remove old libraries here. It is done by removeOldLibFiles.
'lib',
'lib64',
'libarm64')]
for f in files:
if f.endswith((".pyc", ".pyo", ".pyd")) and not f.endswith(importlib.machinery.EXTENSION_SUFFIXES[0]):
# This also removes compiled files from system config,
# but that is fine.
if f.endswith((".pyc", ".pyo", ".pyd", ".dll", ".manifest")):
path=os.path.join(curDestDir, f)
log.debug(f"Removing old byte compiled python file: {path!r}")
try:
Expand Down