コード例 #1
0
ファイル: main.py プロジェクト: 07th-mod/python-patcher
def getModList(is_developer=True):
    if is_developer and os.path.exists('installData.json'):
        return common.getModList("installData.json", isURL=False)
    else:
        return common.getModList(common.Globals.GITHUB_MASTER_BASE_URL +
                                 "installData.json",
                                 isURL=True)
コード例 #2
0
def generateCachedDownloadSizes():
	#setup globals necessary for download
	common.Globals.scanForExecutables()

	modList = common.getModList("installData.json", isURL=False)

	allURLs = getAllURLsFromModList(modList)

	def queryAndPrint(url):
		res = common.DownloaderAndExtractor.getExtractableItem(url, '.')
		return url, res

	# Only works on python 3
	urlToFileSizeDict = {}
	with concurrent.futures.ThreadPoolExecutor(max_workers=10) as executor:
		results = executor.map(queryAndPrint, allURLs)

		for url, extractableItemList in results:
			totalSize = 0
			for extractableItem in extractableItemList:
				totalSize += extractableItem.length
			urlToFileSizeDict[url] = totalSize
			print(url, extractableItemList)

	with io.open('cachedDownloadSizes.json', 'w', encoding='utf-8') as file:
		file.write(json.dumps(urlToFileSizeDict, indent=4, sort_keys=True))
コード例 #3
0
	def getModListFromDummyJSON(self):
		tmpdir = tempfile.mkdtemp()
		tempJSONPath = os.path.join(tmpdir, "temp.json")
		with open(tempJSONPath, 'w', ) as tempJSON:
			tempJSON.write(self.testInstallDataString)

		print(tempJSONPath)

		modList = common.getModList(tempJSONPath, isURL=False)
		shutil.rmtree(tmpdir)
		return modList
コード例 #4
0
def pre_build_validation():
    import installConfiguration
    import common
    import fileVersionManagement
    print("Travis validation started")

    # Code is modified version of main.getSubModConfigList since I don't want to import/setup logger.py
    sub_mod_configs = []
    for mod in common.getModList("installData.json", isURL=False):
        for submod in mod['submods']:
            conf = installConfiguration.SubModConfig(mod, submod)
            sub_mod_configs.append(conf)

    fileVersionManagement.Developer_ValidateVersionDataJSON(sub_mod_configs)
    print("Travis validation success")