Renamed src package to sebimachine.

- Gave the package a descriptive name.
- Passed over with black once more.
- Created setup.py to install dependencies.
- Updated author to reflect repo ownership to Dusty.
- Changed `git` command to use the __url__ attribute.
- Changed music to use ogg vorbis instead of mp3, purely for
    performance.
- Tried to make sure nothing broke.
- Updated dockerfile. Pretty sure we don't need it though...
This commit is contained in:
neko404notfound 2018-06-21 10:02:54 +01:00
parent 001d6aa0ac
commit 4f5a1b518a
32 changed files with 656 additions and 604 deletions

View File

@ -16,4 +16,4 @@ RUN python3.6 -m pip install --upgrade pip && \
python3.6 -m pip install -r requirements.txt && \ python3.6 -m pip install -r requirements.txt && \
python3.6 -m pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice] python3.6 -m pip install -U git+https://github.com/Rapptz/discord.py@rewrite#egg=discord.py[voice]
cmd ["python3.6","-m","src"] cmd ["python3.6","-m","sebimachine"]

View File

@ -9,7 +9,7 @@ trap "echo 'Received interrupt. Exiting.'; exit 0" SIGINT
# Also loads the venv if it is present. # Also loads the venv if it is present.
[ -d .venv/bin ] && source .venv/bin/activate && echo "Entered venv." || echo "No venv detected." [ -d .venv/bin ] && source .venv/bin/activate && echo "Entered venv." || echo "No venv detected."
until python -m src; do until python -m sebimachine; do
# Added colouring to ensure the date of shutdown and the exit code stands # Added colouring to ensure the date of shutdown and the exit code stands
# out from the other clutter in the traceback that might have been output. # out from the other clutter in the traceback that might have been output.
echo -e "\e[0;31m[$(date --utc)]\e[0m Sebi-Machine shutdown with error \e[0;31m$?\e[0m. Restarting..." >&2 echo -e "\e[0;31m[$(date --utc)]\e[0m Sebi-Machine shutdown with error \e[0;31m$?\e[0m. Restarting..." >&2

View File

@ -4,7 +4,7 @@
Sebi-Machine. Sebi-Machine.
""" """
__author__ = "Annihilator708" __author__ = "Dusty.P"
__contributors__ = (__author__, "Neko404NotFound", "Dusty.P", "davfsa", "YashKandalkar") __contributors__ = (__author__, "Neko404NotFound", "Dusty.P", "davfsa", "YashKandalkar")
__license__ = "MIT" __license__ = "MIT"

View File

@ -8,19 +8,19 @@ Something meaningful here, eventually.
import asyncio import asyncio
import json import json
import logging import logging
import random
import traceback
import os import os
import random
import sys import sys
import traceback
from typing import Dict
import discord import discord
from discord.ext import commands from discord.ext import commands
from src.config.config import LoadConfig from .config.config import LoadConfig
from src.shared_libs.loggable import Loggable from .shared_libs import database
from src.shared_libs.ioutils import in_here from .shared_libs.ioutils import in_here
from src.shared_libs import database from .shared_libs.loggable import Loggable
from typing import Dict
# Init logging to output on INFO level to stderr. # Init logging to output on INFO level to stderr.

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,9 +1,9 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import asyncio
from discord.ext import commands from discord.ext import commands
import discord import discord
import asyncio
class BasicCommands: class BasicCommands:

View File

@ -29,8 +29,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
import discord import discord
from discord.ext import commands from discord.ext import commands
from src.shared_libs.utils import paginate, run_command from sebimachine.shared_libs.utils import paginate, run_command
from src.shared_libs.loggable import Loggable from sebimachine.shared_libs.loggable import Loggable
from sebimachine import __url__
import asyncio import asyncio
@ -41,7 +43,8 @@ class Git(Loggable):
@commands.group(case_insensitive=True, invoke_without_command=True) @commands.group(case_insensitive=True, invoke_without_command=True)
async def git(self, ctx): async def git(self, ctx):
"""Run help git for more info""" """Run help git for more info"""
await ctx.send("https://github.com/dustinpianalto/Sebi-Machine/") # await ctx.send("https://github.com/dustinpianalto/Sebi-Machine/")
await ctx.send(__url__ or "No URL specified in __init__.py")
@commands.command(case_insensitive=True, brief="Gets the Trello link.") @commands.command(case_insensitive=True, brief="Gets the Trello link.")
async def trello(self, ctx): async def trello(self, ctx):

View File

@ -15,7 +15,7 @@ from .utils import noblock
YT_DL_OPTS = { YT_DL_OPTS = {
"format": "mp3[abr>0]/bestaudio/best", "format": "ogg[abr>0]/bestaudio/best",
"ignoreerrors": True, "ignoreerrors": True,
"default_search": "auto", "default_search": "auto",
"source_address": "0.0.0.0", "source_address": "0.0.0.0",

View File

@ -1,6 +1,7 @@
import asyncpg
import asyncio import asyncio
import asyncpg
class DatabaseConnection: class DatabaseConnection:
def __init__( def __init__(

View File

@ -31,9 +31,10 @@ Utility for creating Paginated responses
import asyncio import asyncio
import discord
import typing import typing
import discord
class Paginator: class Paginator:
def __init__( def __init__(

47
setup.py Normal file
View File

@ -0,0 +1,47 @@
#!/usr/bin/env python3.6
# -*- coding: utf-8 -*-
"""
Setup.
"""
import re
from setuptools import setup
import traceback
package_name = 'sebimachine'
req_line_test = lambda l: l and l[0] != '#'
with open('README.md') as fp:
readme = fp.read()
with open('requirements.txt') as fp:
requirements = {*filter(req_line_test, map(str.lstrip, fp.read().split('\n')))}
with open(f'{package_name}/__init__.py') as fp:
attrs = {}
print('Attributes:')
for k, v in re.findall(r'^__(\w+)__\s?=\s?"([^"]*)"', fp.read(), re.M):
k = 'name' if k == 'title' else k
attrs[k] = v
print(k, v)
# Use pip on invoke to install requirements. Ensures we can essentially just run this
# script without setuptools arguments. TODO: fix.
try:
import pip
pip.main(['install', *install_requires])
except (ModuleNotFoundError, ImportError):
print('Failed to import pip. Install git dependencies manually.')
traceback.print_exc()
setup(
long_description=readme,
**attrs
)