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