Use deep copies instead of copies
This commit is contained in:
parent
e2da6e189d
commit
7b25aacf8c
@ -24,6 +24,7 @@ import hashlib
|
||||
import platform
|
||||
import urllib.request
|
||||
import re
|
||||
import copy
|
||||
|
||||
class coloramaFallback:
|
||||
class Fore:
|
||||
@ -121,7 +122,7 @@ def findArgument(args,searchFor):
|
||||
def findInChain(versionsPath,version,path):
|
||||
versionPath = p(versionsPath,version)
|
||||
clientJson = readJsonFile(p(versionPath,version + ".json"))
|
||||
curPath = clientJson.copy()
|
||||
curPath = copy.deepcopy(clientJson)
|
||||
success = True
|
||||
for dir in path:
|
||||
if dir in curPath:
|
||||
@ -139,7 +140,7 @@ def findInChainDeepest(versionsPath,version,path):
|
||||
while True:
|
||||
versionPath = p(versionsPath,version)
|
||||
clientJson = readJsonFile(p(versionPath,version + ".json"))
|
||||
curPath = clientJson.copy()
|
||||
curPath = copy.deepcopy(clientJson)
|
||||
for dir in path:
|
||||
if dir in curPath:
|
||||
curPath = curPath[dir]
|
||||
@ -240,7 +241,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||
if "downloads" in library: # not dumb
|
||||
if "classifiers" in library["downloads"]: # classifiers (usually for natives, their sources and their documentation)
|
||||
for classifier in library["downloads"]["classifiers"]:
|
||||
l = lBase.copy()
|
||||
l = copy.deepcopy(lBase)
|
||||
native = library["downloads"]["classifiers"][classifier]
|
||||
if classifier.startswith("natives-"):
|
||||
l["type"] = "native"
|
||||
@ -255,7 +256,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||
libraries.append(l)
|
||||
|
||||
if "artifact" in library["downloads"]: # artifact (usually for libraries)
|
||||
l = lBase.copy()
|
||||
l = copy.deepcopy(lBase)
|
||||
if "path" in library["downloads"]["artifact"]:
|
||||
l["filePathOS"] = p(libraryPath,library["downloads"]["artifact"]["path"].replace("/",os.path.sep))
|
||||
|
||||
@ -266,7 +267,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||
else: # dumb
|
||||
lBase["dumb"] = True
|
||||
if "natives" in library: # natives
|
||||
lBaseTwo = lBase.copy()
|
||||
lBaseTwo = copy.deepcopy(lBase)
|
||||
lBaseTwo["type"] = "native"
|
||||
if not "url" in library:
|
||||
lBaseTwo["url"] = "https://libraries.minecraft.net"
|
||||
@ -277,7 +278,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||
lBaseTwo["url"] = lBaseTwo["url"] + "/" + lBaseTwo["filePath"]
|
||||
|
||||
for native in library["natives"]:
|
||||
l = lBaseTwo.copy()
|
||||
l = copy.deepcopy(lBaseTwo)
|
||||
l["nativeOS"] = native
|
||||
native = "natives-" + native
|
||||
l["filePath"] = l["filePath"][:-4] + "-" + native + ".jar"
|
||||
@ -285,7 +286,7 @@ def processVersion(versionsPath,libraryPath,nativePath,version):
|
||||
l["filePathOS"] = p(nativePath,l["filePath"].replace("/",os.path.sep))
|
||||
libraries.append(l)
|
||||
else: # libraries
|
||||
l = lBase.copy()
|
||||
l = copy.deepcopy(lBase)
|
||||
if not "url" in library:
|
||||
l["url"] = "https://libraries.minecraft.net"
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user