mirror of
https://github.com/evennia/evennia.git
synced 2026-03-19 22:36:31 +01:00
Make procpool compatible with windows and OS X.
This commit is contained in:
parent
b28d67534b
commit
bc4783efac
2 changed files with 5 additions and 4 deletions
|
|
@ -278,7 +278,8 @@ def spawnProcess(processProtocol, bootstrap, args=(), env={},
|
|||
|
||||
pythonpath = []
|
||||
for pkg in packages:
|
||||
p = os.path.split(imp.find_module(pkg)[1])[0]
|
||||
path, name = os.path.split(pkg)
|
||||
p = os.path.split(imp.find_module(name, [path] if path else None)[1])[0]
|
||||
if p.startswith(os.path.join(sys.prefix, 'lib')):
|
||||
continue
|
||||
pythonpath.append(p)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ file locking clashes. Test what works with your mileage.
|
|||
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
|
|
@ -85,21 +86,20 @@ def start_plugin_services(server):
|
|||
apackages = ("twisted",
|
||||
os.path.join(os.pardir, "contrib", "procpools", "ampoule"),
|
||||
os.path.join(os.pardir, "ev"),
|
||||
os.path.join(os.pardir))
|
||||
"settings")
|
||||
aenv = {"DJANGO_SETTINGS_MODULE":"settings",
|
||||
"DATABASE_NAME":settings.DATABASES.get("default", {}).get("NAME") or settings.DATABASE_NAME}
|
||||
if PROCPOOL_DEBUG:
|
||||
_BOOTSTRAP = _BOOTSTRAP % "log.startLogging(sys.stderr)"
|
||||
else:
|
||||
_BOOTSTRAP = _BOOTSTRAP % ""
|
||||
|
||||
procpool_starter = ampoule_main.ProcessStarter(packages=apackages,
|
||||
env=aenv,
|
||||
path=PROCPOOL_DIRECTORY,
|
||||
uid=PROCPOOL_UID,
|
||||
gid=PROCPOOL_GID,
|
||||
bootstrap=_BOOTSTRAP,
|
||||
childReactor=os.name == 'nt' and "select" or "epoll")
|
||||
childReactor=sys.platform == 'linux2' and "epoll" or "default")
|
||||
procpool = ampoule_pool.ProcessPool(name=SERVICE_NAME,
|
||||
min=PROCPOOL_MIN_NPROC,
|
||||
max=PROCPOOL_MAX_NPROC,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue