Skip to content

Commit

Permalink
Rework directory structure
Browse files Browse the repository at this point in the history
First, venvs are cool, so add them to the .gitignore.
Second, if I do python3 setup.py develop, it doesn't work properly
because of the package_dirs entry (see pypa/setuptools#230). So, rename
the source directory to botbot so as to not need package_dirs (uglier
in my opinion, but whatever).
Third, use relative imports, because relative imports are cool (and
because DRY).
  • Loading branch information
ArkaneMoose committed Dec 17, 2019
1 parent 7df1dfc commit 7839d8b
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ __pycache__/
# Distribution / packaging
.Python
env/
venv/
build/
develop-eggs/
dist/
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions source/__main__.py → botbot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from sys import executable, argv
from traceback import print_exc
from time import sleep
from botbot.main import get_args
from .main import get_args

restart_delay_after_error = 10

Expand All @@ -12,9 +12,9 @@ def main():
try:
if call([executable, '-m', 'botbot.main'] + argv[1:]) != 0:
sleep(restart_delay_after_error)
except:
except Exception:
print_exc()
sleep(restart_delay_after_error)

if __name__ == '__main__':
main();
main()
File renamed without changes.
12 changes: 6 additions & 6 deletions source/botbot.py → botbot/botbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@

#Additional modules
import euphoria as eu
from botbot.euphutils import EuphUtils
from .euphutils import EuphUtils

#Project modules
import botbot.logger as logger
import botbot.agentid_room as agentid_room
import botbot.longmessage_room as longmessage_room
from botbot.botcollection import BotCollection
from botbot.snapshot import Snapshot
from . import logger
from . import agentid_room
from . import longmessage_room
from .botcollection import BotCollection
from .snapshot import Snapshot

log = logger.Logger()

Expand Down
9 changes: 5 additions & 4 deletions source/botbotbot.py → botbot/botbotbot.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
from botbot.euphutils import EuphUtils
from botbot.snapshot import Snapshot
import botbot.agentid_room as agentid_room
import botbot.longmessage_room as longmessage_room
from .euphutils import EuphUtils
from .snapshot import Snapshot
from . import agentid_room
from . import longmessage_room
import euphoria as eu

import time
import re
import uuid as uuid_module
import errno
import os
import traceback

spam_threshold_messages = 10
spam_threshold_time = 5
Expand Down
6 changes: 3 additions & 3 deletions source/botcollection.py → botbot/botcollection.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from botbot.euphutils import EuphUtils
from botbot.botparser import Parser
from botbot.botbotbot import BotBotBot
from .euphutils import EuphUtils
from .botparser import Parser
from .botbotbot import BotBotBot

import euphoria as eu
import threading
Expand Down
4 changes: 2 additions & 2 deletions source/botparser.py → botbot/botparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import time
import json
from simpleeval import SimpleEval, DEFAULT_OPERATORS, DEFAULT_FUNCTIONS, DEFAULT_NAMES
from botbot.euphutils import EuphUtils
from .euphutils import EuphUtils

import botbot.logger as logger
from . import logger

log = logger.Logger()

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions source/main.py → botbot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

import euphoria as eu

from botbot.botbot import BotBot
from botbot.euphutils import EuphUtils
from botbot.snapshot import Snapshot
from .botbot import BotBot
from .euphutils import EuphUtils
from .snapshot import Snapshot

room_name = 'testing'
password = None
Expand Down
2 changes: 1 addition & 1 deletion source/snapshot.py → botbot/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import shutil
import time

import botbot.logger as logger
from . import logger

log = logger.Logger()

Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
url='https://github.com/ArkaneMoose/BotBot',
license='MIT',
packages=['botbot'],
package_dir={'botbot': 'source'},
install_requires=['eupy >=1.2, <2.0', 'simpleeval >=0.9, <0.10'],
dependency_links=['git+https://github.com/ArkaneMoose/EuPy.git@75777c49503acb32e09f4c36f6f65cc35157694a#egg=eupy-1.2', 'git+https://github.com/ArkaneMoose/simpleeval.git@ac33b805645ca616f11e64bb3330a12bc5fba658#egg=simpleeval-0.9.2'],
entry_points={
Expand Down

0 comments on commit 7839d8b

Please sign in to comment.