mirror of
https://github.com/unmojang/meta.git
synced 2025-09-24 03:31:03 -04:00
chore: reformat
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
c06bc0cdaf
commit
48bb5d6779
@ -437,7 +437,6 @@ def main():
|
||||
v = version_from_build_system_installer(installer, profile, version)
|
||||
else:
|
||||
if version.uses_installer():
|
||||
|
||||
# If we do not have the Forge json, we ignore this version
|
||||
if not os.path.isfile(profile_filepath):
|
||||
eprint("Skipping %s with missing profile json" % key)
|
||||
|
@ -16,7 +16,7 @@ from meta.common.neoforge import (
|
||||
BAD_VERSIONS,
|
||||
FORGEWRAPPER_MAVEN,
|
||||
)
|
||||
from meta.common.forge import (FORGE_COMPONENT)
|
||||
from meta.common.forge import FORGE_COMPONENT
|
||||
from meta.common.mojang import MINECRAFT_COMPONENT
|
||||
from meta.model import (
|
||||
MetaVersion,
|
||||
@ -215,7 +215,9 @@ def version_from_modernized_installer(
|
||||
return v
|
||||
|
||||
|
||||
def version_from_legacy(info: NeoForgeLegacyInfo, version: NeoForgeVersion) -> MetaVersion:
|
||||
def version_from_legacy(
|
||||
info: NeoForgeLegacyInfo, version: NeoForgeVersion
|
||||
) -> MetaVersion:
|
||||
v = MetaVersion(name="NeoForge", version=version.rawVersion, uid=NEOFORGE_COMPONENT)
|
||||
mc_version = version.mc_version_sane
|
||||
v.requires = [Dependency(uid=MINECRAFT_COMPONENT, equals=mc_version)]
|
||||
@ -245,7 +247,9 @@ def version_from_legacy(info: NeoForgeLegacyInfo, version: NeoForgeVersion) -> M
|
||||
|
||||
|
||||
def version_from_build_system_installer(
|
||||
installer: MojangVersion, profile: NeoForgeInstallerProfileV2, version: NeoForgeVersion
|
||||
installer: MojangVersion,
|
||||
profile: NeoForgeInstallerProfileV2,
|
||||
version: NeoForgeVersion,
|
||||
) -> MetaVersion:
|
||||
v = MetaVersion(name="NeoForge", version=version.rawVersion, uid=NEOFORGE_COMPONENT)
|
||||
v.requires = [Dependency(uid=MINECRAFT_COMPONENT, equals=version.mc_version_sane)]
|
||||
@ -289,7 +293,8 @@ def version_from_build_system_installer(
|
||||
v.libraries = []
|
||||
|
||||
wrapper_lib = Library(
|
||||
name=GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "1.5.6"))
|
||||
name=GradleSpecifier("io.github.zekerzhayard", "ForgeWrapper", "1.5.6")
|
||||
)
|
||||
wrapper_lib.downloads = MojangLibraryDownloads()
|
||||
wrapper_lib.downloads.artifact = MojangArtifact(
|
||||
url=FORGEWRAPPER_MAVEN,
|
||||
@ -333,7 +338,6 @@ def main():
|
||||
)
|
||||
recommended_versions = []
|
||||
|
||||
|
||||
for key, entry in remote_versions.versions.items():
|
||||
if entry.mc_version is None:
|
||||
eprint("Skipping %s with invalid MC version" % key)
|
||||
@ -395,7 +399,6 @@ def main():
|
||||
v = version_from_build_system_installer(installer, profile, version)
|
||||
else:
|
||||
if version.uses_installer():
|
||||
|
||||
# If we do not have the Forge json, we ignore this version
|
||||
if not os.path.isfile(profile_filepath):
|
||||
eprint("Skipping %s with missing profile json" % key)
|
||||
@ -404,7 +407,7 @@ def main():
|
||||
v = version_from_profile(profile, version)
|
||||
|
||||
v.write(os.path.join(LAUNCHER_DIR, NEOFORGE_COMPONENT, f"{v.version}.json"))
|
||||
v.version = "NEO-"+v.version
|
||||
v.version = "NEO-" + v.version
|
||||
v.write(os.path.join(LAUNCHER_DIR, FORGE_COMPONENT, f"{v.version}.json"))
|
||||
|
||||
recommended_versions.sort()
|
||||
|
2
index.py
2
index.py
@ -57,7 +57,7 @@ for package in sorted(os.listdir(LAUNCHER_DIR)):
|
||||
versionEntry = MetaVersionIndexEntry.from_meta_version(
|
||||
versionFile, is_recommended, filehash
|
||||
)
|
||||
|
||||
|
||||
versionList.versions.append(versionEntry)
|
||||
|
||||
# sort the versions in descending order by time of release
|
||||
|
@ -65,13 +65,15 @@ def filehash(filename, hashtype, blocksize=65536):
|
||||
hashtype.update(block)
|
||||
return hashtype.hexdigest()
|
||||
|
||||
|
||||
def find_nth(haystack, needle, n):
|
||||
start = haystack.find(needle)
|
||||
while start >= 0 and n > 1:
|
||||
start = haystack.find(needle, start+len(needle))
|
||||
start = haystack.find(needle, start + len(needle))
|
||||
n -= 1
|
||||
return start
|
||||
|
||||
|
||||
def get_single_forge_files_manifest(longversion):
|
||||
print(f"Getting NeoForge manifest for {longversion}")
|
||||
path_thing = UPSTREAM_DIR + "/neoforge/files_manifests/%s.json" % longversion
|
||||
@ -83,7 +85,8 @@ def get_single_forge_files_manifest(longversion):
|
||||
from_file = True
|
||||
else:
|
||||
file_url = (
|
||||
"https://maven.neoforged.net/api/maven/details/releases/net%2Fneoforged%2Fforge%2F" + urllib.parse.quote(longversion)
|
||||
"https://maven.neoforged.net/api/maven/details/releases/net%2Fneoforged%2Fforge%2F"
|
||||
+ urllib.parse.quote(longversion)
|
||||
)
|
||||
r = sess.get(file_url)
|
||||
r.raise_for_status()
|
||||
@ -98,14 +101,12 @@ def get_single_forge_files_manifest(longversion):
|
||||
if file_ext in [".md5", ".sha1", ".sha256", ".sha512"]:
|
||||
continue
|
||||
|
||||
classifier = file["name"][find_nth(name, "-", 3)+1:len(file_name)]
|
||||
classifier = file["name"][find_nth(name, "-", 3) + 1 : len(file_name)]
|
||||
|
||||
# assert len(extensionObj.items()) == 1
|
||||
index = 0
|
||||
count = 0
|
||||
file_obj = NeoForgeFile(
|
||||
classifier=classifier, extension=file_ext[1:]
|
||||
)
|
||||
file_obj = NeoForgeFile(classifier=classifier, extension=file_ext[1:])
|
||||
if count == 0:
|
||||
ret_dict[classifier] = file_obj
|
||||
index += 1
|
||||
@ -117,8 +118,6 @@ def get_single_forge_files_manifest(longversion):
|
||||
)
|
||||
assert False
|
||||
|
||||
|
||||
|
||||
if not from_file:
|
||||
Path(path_thing).parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(path_thing, "w", encoding="utf-8") as f:
|
||||
@ -188,7 +187,9 @@ def main():
|
||||
print("")
|
||||
print("Dumping index files...")
|
||||
|
||||
with open(UPSTREAM_DIR + "/neoforge/maven-metadata.json", "w", encoding="utf-8") as f:
|
||||
with open(
|
||||
UPSTREAM_DIR + "/neoforge/maven-metadata.json", "w", encoding="utf-8"
|
||||
) as f:
|
||||
json.dump(main_json, f, sort_keys=True, indent=4)
|
||||
|
||||
new_index.write(UPSTREAM_DIR + "/neoforge/derived_index.json")
|
||||
@ -222,7 +223,8 @@ def main():
|
||||
+ "/neoforge/installer_manifests/%s.json" % version.long_version
|
||||
)
|
||||
version_file_path = (
|
||||
UPSTREAM_DIR + "/neoforge/version_manifests/%s.json" % version.long_version
|
||||
UPSTREAM_DIR
|
||||
+ "/neoforge/version_manifests/%s.json" % version.long_version
|
||||
)
|
||||
|
||||
installer_refresh_required = not os.path.isfile(
|
||||
@ -257,7 +259,9 @@ def main():
|
||||
# Process: does it parse?
|
||||
MojangVersion.parse_raw(version_data)
|
||||
|
||||
Path(version_file_path).parent.mkdir(parents=True, exist_ok=True)
|
||||
Path(version_file_path).parent.mkdir(
|
||||
parents=True, exist_ok=True
|
||||
)
|
||||
with open(version_file_path, "wb") as versionJsonFile:
|
||||
versionJsonFile.write(version_data)
|
||||
versionJsonFile.close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user