def _setSystemConfig(fromPath): import installer toPath=os.path.join(sys.prefix.decode('mbcs'),'systemConfig') log.debug("Copying config to systemconfig dir: %s", toPath) if os.path.isdir(toPath): installer.tryRemoveFile(toPath) for curSourceDir, subDirs, files in os.walk(fromPath): if curSourceDir == fromPath: curDestDir = toPath # Don't copy from top-level config dirs we know will be ignored due to security risks. removeSubs = set(SCRATCH_PAD_ONLY_DIRS).intersection(subDirs) for subPath in removeSubs: log.debug("Ignored folder that may contain unpackaged addons: %s", subPath) subDirs.remove(subPath) else: relativePath = os.path.relpath(curSourceDir, fromPath) curDestDir = os.path.join(toPath, relativePath) if not os.path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: # Do not copy executables to the system configuration, as this may cause security risks. # This will also exclude pending updates. if f.endswith(".exe"): log.debug("Ignored file %s while copying current user configuration to system configuration"%f) continue sourceFilePath=os.path.join(curSourceDir,f) destFilePath=os.path.join(curDestDir,f) installer.tryCopyFile(sourceFilePath,destFilePath)
def _setSystemConfig(fromPath): import installer toPath=os.path.join(sys.prefix,'systemConfig') log.debug("Copying config to systemconfig dir: %s", toPath) if os.path.isdir(toPath): installer.tryRemoveFile(toPath) for curSourceDir, subDirs, files in os.walk(fromPath): if curSourceDir == fromPath: curDestDir = toPath # Don't copy from top-level config dirs we know will be ignored due to security risks. removeSubs = set(SCRATCH_PAD_ONLY_DIRS).intersection(subDirs) for subPath in removeSubs: log.debug("Ignored folder that may contain unpackaged addons: %s", subPath) subDirs.remove(subPath) else: relativePath = os.path.relpath(curSourceDir, fromPath) curDestDir = os.path.join(toPath, relativePath) if not os.path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: # Do not copy executables to the system configuration, as this may cause security risks. # This will also exclude pending updates. if f.endswith(".exe"): log.debug("Ignored file %s while copying current user configuration to system configuration"%f) continue sourceFilePath=os.path.join(curSourceDir,f) destFilePath=os.path.join(curDestDir,f) installer.tryCopyFile(sourceFilePath,destFilePath)
def copyTtsFiles(self): import installer fp = self._ttsPath.GetValue() tp = path.abspath( path.join(path.abspath(path.dirname(__file__)), r"..\..\eciLibraries")) for curSourceDir, subDirs, files in os.walk(fp): if curSourceDir == fp: curDestDir = tp else: curDestDir = path.join(tp, path.relpath(curSourceDir, fp)) if not path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: sourceFilePath = path.join(curSourceDir, f) destFilePath = path.join(curDestDir, f) installer.tryCopyFile(sourceFilePath, destFilePath) # Create a manifest, so NVDA recognizes the folder as an add-on with open(path.join(tp, "manifest.ini"), "w") as f: f.write('''name = eciLibraries summary = IBMTTS libraries description = """You can put the libraries for IBMTTS driver here.""" author = NVDA User version = 0.1 url = None minimumNVDAVersion = 2012.1.1 lastTestedNVDAVersion = 2030.1.1 updateChannel = None''')
def copyTtsFiles(self): import installer fp = self._ttsPath.GetValue() tp = path.join(path.abspath(path.join(path.dirname(path.abspath(__file__)), "..")), r"synthDrivers\ibmtts") for curSourceDir,subDirs,files in os.walk(fp): if curSourceDir == fp: curDestDir=tp else: curDestDir=path.join(tp,path.relpath(curSourceDir,fp)) if not path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: sourceFilePath=path.join(curSourceDir,f) destFilePath=path.join(curDestDir,f) installer.tryCopyFile(sourceFilePath,destFilePath)
def _setSystemConfig(fromPath): import installer toPath=os.path.join(sys.prefix.decode('mbcs'),'systemConfig') if os.path.isdir(toPath): installer.tryRemoveFile(toPath) for curSourceDir,subDirs,files in os.walk(fromPath): if curSourceDir==fromPath: curDestDir=toPath else: curDestDir=os.path.join(toPath,os.path.relpath(curSourceDir,fromPath)) if not os.path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: sourceFilePath=os.path.join(curSourceDir,f) destFilePath=os.path.join(curDestDir,f) installer.tryCopyFile(sourceFilePath,destFilePath)
def _setSystemConfig(fromPath): import installer toPath=os.path.join(sys.prefix.decode('mbcs'),'systemConfig') if os.path.isdir(toPath): installer.tryRemoveFile(toPath) for curSourceDir,subDirs,files in os.walk(fromPath): if curSourceDir==fromPath: curDestDir=toPath else: curDestDir=os.path.join(toPath,os.path.relpath(curSourceDir,fromPath)) if not os.path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: sourceFilePath=os.path.join(curSourceDir,f) destFilePath=os.path.join(curDestDir,f) installer.tryCopyFile(sourceFilePath,destFilePath)
def _setSystemConfig(fromPath): import installer toPath=os.path.join(sys.prefix.decode('mbcs'),'systemConfig') if os.path.isdir(toPath): installer.tryRemoveFile(toPath) for curSourceDir,subDirs,files in os.walk(fromPath): if curSourceDir==fromPath: curDestDir=toPath else: curDestDir=os.path.join(toPath,os.path.relpath(curSourceDir,fromPath)) if not os.path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: # Do not copy executables to the system configuration, as this may cause security risks. # This will also exclude pending updates. if f.endswith(".exe"): log.debug("Ignored file %s while copying current user configuration to system configuration"%f) continue sourceFilePath=os.path.join(curSourceDir,f) destFilePath=os.path.join(curDestDir,f) installer.tryCopyFile(sourceFilePath,destFilePath)
def _setSystemConfig(fromPath): import installer toPath=os.path.join(sys.prefix.decode('mbcs'),'systemConfig') if os.path.isdir(toPath): installer.tryRemoveFile(toPath) for curSourceDir,subDirs,files in os.walk(fromPath): if curSourceDir==fromPath: curDestDir=toPath else: curDestDir=os.path.join(toPath,os.path.relpath(curSourceDir,fromPath)) if not os.path.isdir(curDestDir): os.makedirs(curDestDir) for f in files: # Do not copy executables to the system configuration, as this may cause security risks. # This will also exclude pending updates. if f.endswith(".exe"): log.debug("Ignored file %s while copying current user configuration to system configuration"%f) continue sourceFilePath=os.path.join(curSourceDir,f) destFilePath=os.path.join(curDestDir,f) installer.tryCopyFile(sourceFilePath,destFilePath)