Example #1
0
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)
Example #2
0
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.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)
Example #4
0
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)
Example #5
0
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)
Example #6
0
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)