from __future__ import unicode_literals import py import sys import subprocess from collections import OrderedDict from devpi_common.url import URL from devpi_server.config import ( render, parseoptions, get_pluginmanager ) try: # python >= 3.4 from plistlib import dumps as plist_dumps # don't sort the keys; that way we can keep our own order write_plist_to_bytes = lambda d: plist_dumps(d, sort_keys=False) except ImportError: try: # python 3.0-3.3 from plistlib import writePlistToBytes as write_plist_to_bytes except ImportError: # python 2 from plistlib import writePlistToString as write_plist_to_bytes def gen_supervisor(tw, config, argv, writer): import getpass devpibin = py.path.local(sys.argv[0]) assert devpibin.exists() content = render( tw, "supervisord.conf",
from __future__ import unicode_literals import os import py import sys import subprocess from devpi_common.url import URL from devpi_server.config import ( render, parseoptions, get_default_serverdir, get_pluginmanager ) try: # python >= 3.4 from plistlib import dumps as plist_dumps # don't sort the keys; that way we can keep our own order write_plist_to_bytes = lambda d: plist_dumps(d, sort_keys=False) except ImportError: try: # python 3.0-3.3 from plistlib import writePlistToBytes as write_plist_to_bytes except ImportError: # python 2 from plistlib import writePlistToString as write_plist_to_bytes try: # python >= 2.7 # prefer ordered keys for the plist from collections import OrderedDict as PossiblyOrderedDict except ImportError: # python <= 2.6 # we don't have OrderedDict; the plist will still be fine, but the keys