3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 21:19:31 +01:00
PyLink/world.py

39 lines
1.1 KiB
Python
Raw Normal View History

"""
2016-03-12 08:09:07 +01:00
world.py: Stores global variables for PyLink, including lists of active IRC objects and plugins.
"""
from collections import defaultdict
import threading
2015-09-19 20:51:56 +02:00
import subprocess
import os
# Global variable to indicate whether we're being ran directly, or imported
2015-12-25 03:24:42 +01:00
# for a testcase. This defaults to True.
testing = True
2015-12-25 03:24:42 +01:00
# Sets the default protocol module to use with tests.
testing_ircd = 'inspircd'
global commands, hooks
# This should be a mapping of command names to functions
commands = defaultdict(list)
hooks = defaultdict(list)
networkobjects = {}
plugins = {}
whois_handlers = []
started = threading.Event()
2015-09-19 20:51:56 +02:00
plugins_folder = os.path.join(os.getcwd(), 'plugins')
protocols_folder = os.path.join(os.getcwd(), 'protocols')
2015-09-19 20:51:56 +02:00
version = "<unknown>"
source = "https://github.com/GLolol/PyLink" # CHANGE THIS IF YOU'RE FORKING!!
# Only run this once.
if version == "<unknown>":
# Get version from Git tags.
try:
version = 'v' + subprocess.check_output(['git', 'describe', '--tags']).decode('utf-8').strip()
except Exception as e:
print('ERROR: Failed to get version from "git describe --tags": %s: %s' % (type(e).__name__, e))