mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 14:32:25 +01:00
Fix missing mapPackages
This commit is contained in:
parent
13b6ab04bb
commit
b87401a0c8
@ -388,7 +388,7 @@ def homepage():
|
|||||||
return {
|
return {
|
||||||
"count": count,
|
"count": count,
|
||||||
"downloads": downloads,
|
"downloads": downloads,
|
||||||
"featured": featured,
|
"featured": mapPackages(featured),
|
||||||
"new": mapPackages(new),
|
"new": mapPackages(new),
|
||||||
"updated": mapPackages(updated),
|
"updated": mapPackages(updated),
|
||||||
"pop_mod": mapPackages(pop_mod),
|
"pop_mod": mapPackages(pop_mod),
|
||||||
|
@ -70,23 +70,6 @@ def getMeta(urlstr, author):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def get_edit_data_from_dir(dir: str):
|
|
||||||
data = {}
|
|
||||||
for path in [os.path.join(dir, ".cdb.json"), os.path.join(dir, ".cdb", "meta.json")]:
|
|
||||||
if os.path.isfile(path):
|
|
||||||
with open(path, "r") as f:
|
|
||||||
data = json.loads(f.read())
|
|
||||||
break
|
|
||||||
|
|
||||||
for path in [os.path.join(dir, ".cdb.md"), os.path.join(dir, ".cdb", "long_description.md")]:
|
|
||||||
if os.path.isfile(path):
|
|
||||||
with open(path, "r") as f:
|
|
||||||
data["long_description"] = f.read().replace("\r\n", "\n")
|
|
||||||
break
|
|
||||||
|
|
||||||
return data
|
|
||||||
|
|
||||||
|
|
||||||
def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
||||||
try:
|
try:
|
||||||
tree = build_tree(path, expected_type=ContentType[release.package.type.name],
|
tree = build_tree(path, expected_type=ContentType[release.package.type.name],
|
||||||
@ -134,11 +117,13 @@ def postReleaseCheckUpdate(self, release: PackageRelease, path):
|
|||||||
release.max_rel = MinetestRelease.get(tree.meta["max_minetest_version"], None)
|
release.max_rel = MinetestRelease.get(tree.meta["max_minetest_version"], None)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
data = get_edit_data_from_dir(tree.baseDir)
|
with open(os.path.join(tree.baseDir, ".cdb.json"), "r") as f:
|
||||||
if data != {}: # Not sure if this will actually work to check not empty, probably not
|
data = json.loads(f.read())
|
||||||
do_edit_package(package.author, package, False, data, "Post release hook")
|
do_edit_package(package.author, package, False, data, "Post release hook")
|
||||||
except LogicError as e:
|
except LogicError as e:
|
||||||
raise TaskError(e.message)
|
raise TaskError(e.message)
|
||||||
|
except IOError:
|
||||||
|
pass
|
||||||
|
|
||||||
return tree
|
return tree
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user