# HG changeset patch # User Drew Perttula # Date 2018-04-26 08:20:19 # Node ID 5c04a54df6353fa97b538325cbfbf335e65fc6a6 # Parent d9337dfe941aa628eaec3e511de8bf3101f1f935 fix startup (this might be breaking mypy) Ignore-this: d81817852cde18bb475ce7be80499b5d diff --git a/bin/collector b/bin/collector --- a/bin/collector +++ b/bin/collector @@ -8,6 +8,8 @@ Input can be over http or zmq. """ from __future__ import division +from run_local import log + from rdflib import URIRef, Literal from twisted.internet import reactor, utils from txzmq import ZmqEndpoint, ZmqFactory, ZmqPullConnection @@ -19,7 +21,6 @@ import traceback import cyclone.web, cyclone.websocket from greplin import scales -from run_local import log from lib.cycloneerr import PrettyErrorHandler from light9.collector.output import EnttecDmx, Udmx, DummyOutput from light9.collector.collector import Collector diff --git a/bin/run_local.py b/bin/run_local.py --- a/bin/run_local.py +++ b/bin/run_local.py @@ -3,7 +3,50 @@ # this should be turned off when the programs are installed import sys, os, socket -sys.path.insert(0,os.path.join(os.path.dirname(sys.argv[0]),"..")) + +def fixSysPath(): + root = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), '..')) + '/' + + # this is site-packages/zope.interface-4.5.0-py2.7-nspkg.pth, + # slightly edited. + import types + has_mfs = sys.version_info > (3, 5); + p = root + 'env/local/lib/python2.7/site-packages/zope' + importlib = has_mfs and __import__('importlib.util'); + has_mfs and __import__('importlib.machinery'); + m = has_mfs and sys.modules.setdefault( + 'zope', importlib.util.module_from_spec( + importlib.machinery.PathFinder.find_spec( + 'zope', [os.path.dirname(p)]))); + m = m or sys.modules.setdefault('zope', types.ModuleType('zope')); + mp = (m or []) and m.__dict__.setdefault('__path__',[]); + (p not in mp) and mp.append(p) + + p = root + 'env/local/lib/python2.7/site-packages/greplin' + importlib = has_mfs and __import__('importlib.util'); + has_mfs and __import__('importlib.machinery'); + m = has_mfs and sys.modules.setdefault('greplin', importlib.util.module_from_spec(importlib.machinery.PathFinder.find_spec('greplin', [os.path.dirname(p)]))); + m = m or sys.modules.setdefault('greplin', types.ModuleType('greplin')); + mp = (m or []) and m.__dict__.setdefault('__path__',[]); + (p not in mp) and mp.append(p) + + sys.path = [ + root, + root + 'env/lib/python2.7', + root + 'env/lib/python2.7/plat-x86_64-linux-gnu', + root + 'env/lib/python2.7/lib-tk', + root + 'env/lib/python2.7/lib-old', + root + 'env/lib/python2.7/lib-dynload', + '/usr/lib/python2.7', + '/usr/lib/python2.7/plat-x86_64-linux-gnu', + '/usr/lib/python2.7/lib-tk', + root + 'env/local/lib/python2.7/site-packages', + root + 'env/local/lib/python2.7/site-packages/gtk-2.0', + root + 'env/lib/python2.7/site-packages', + root + 'env/lib/python2.7/site-packages/gtk-2.0', + ] + +fixSysPath() from twisted.python.failure import Failure diff --git a/bin/subcomposer b/bin/subcomposer --- a/bin/subcomposer +++ b/bin/subcomposer @@ -16,7 +16,12 @@ subcomposer """ from __future__ import division, nested_scopes + +from run_local import log import time, logging + +log.setLevel(logging.DEBUG) + from optparse import OptionParser import logging, urllib import Tkinter as tk @@ -24,12 +29,8 @@ import louie as dispatcher from twisted.internet import reactor, tksupport, task from rdflib import URIRef, RDF, RDFS, Literal -from run_local import log -log.setLevel(logging.DEBUG) - from light9.dmxchanedit import Levelbox from light9 import dmxclient, Submaster, prof, showconfig, networking - from light9.Patch import get_channel_name from light9.uihelpers import toplevelat from rdfdb.syncedgraph import SyncedGraph