[Trivia] Move Trivia lists back home (#2028)

* [Trivia] Move trivia lists back home

Removes red-trivia as a dependency.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Include package data in distribution

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>

* Add test from red-trivia repo, and fix package data setup

* The distribution will now include all files under any data/ sub-directory of a package, as well as all *.po files under any locales/ sub-directory (as it should have been before).

* MANIFEST.in has been simplified to comply with these changes and redbot/cogs/audio/application.yml has been moved to the data/ sub-directory to maintain consistency in how we declare package data.

Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
Toby Harradine
2018-08-26 23:39:46 +10:00
committed by GitHub
parent 1b196bf0fb
commit e6495bc7c0
44 changed files with 23426 additions and 61 deletions

View File

@@ -3,7 +3,6 @@ import os
import re
import tempfile
from distutils.errors import CCompilerError, DistutilsPlatformError
from pathlib import Path
from setuptools import setup, find_packages
requirements = [
@@ -24,7 +23,6 @@ requirements = [
"pyyaml==3.13",
"raven==6.9.0",
"raven-aiohttp==0.7.0",
"red-trivia==1.1.1",
"websockets==6.0",
"yarl==1.2.6",
]
@@ -35,11 +33,6 @@ def get_dependency_links():
return file.read().splitlines()
def get_package_list():
core = find_packages(include=["redbot", "redbot.*"])
return core
def check_compiler_available():
m = ccompiler.new_compiler()
@@ -62,35 +55,6 @@ def get_version():
return version
def find_locale_folders():
"""
Ignore this tomfoolery in the desire for automation. It works, that's
all you gotta know. Don't fuck with this unless you really know what
you're doing, otherwise we lose all translations.
"""
def glob_locale_files(path: Path):
msgs = path.glob("*.po")
parents = path.parents
return [str(m.relative_to(parents[0])) for m in msgs]
ret = {"redbot.core": glob_locale_files(Path("redbot/core/locales"))}
cogs_path = Path("redbot/cogs")
for cog_folder in cogs_path.iterdir():
locales_folder = cog_folder / "locales"
if not locales_folder.is_dir():
continue
pkg_name = str(cog_folder).replace("/", ".")
ret[pkg_name] = glob_locale_files(locales_folder)
return ret
if __name__ == "__main__":
if not check_compiler_available():
requirements.remove(
@@ -103,9 +67,8 @@ if __name__ == "__main__":
setup(
name="Red-DiscordBot",
version=get_version(),
packages=get_package_list(),
package_data=find_locale_folders(),
include_package_data=True,
packages=find_packages(include=["redbot", "redbot.*"]),
package_data={"": ["locales/*.po", "data/*", "data/**/*"]},
url="https://github.com/Cog-Creators/Red-DiscordBot",
license="GPLv3",
author="Cog-Creators",