Browse Source

Add Python 2 support

Add requirements file for reproducible builds
master
Sam Whited 8 years ago
parent
commit
af00bb7562
  1. 1
      __init__.py
  2. 1
      plugins/__init__.py
  3. BIN
      plugins/__init__.pyc
  4. 3
      requirements.txt
  5. 14
      server.py

1
__init__.py

@ -0,0 +1 @@ @@ -0,0 +1 @@
# Make Python 2 happy

1
plugins/__init__.py

@ -0,0 +1 @@ @@ -0,0 +1 @@
# Make Python 2 happy

BIN
plugins/__init__.pyc

Binary file not shown.

3
requirements.txt

@ -0,0 +1,3 @@ @@ -0,0 +1,3 @@
PyYAML==3.11
sleekxmpp==1.3.1
wheel==0.24.0

14
server.py

@ -9,8 +9,14 @@ import random @@ -9,8 +9,14 @@ import random
import os
from threading import Thread
from threading import Lock
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
try:
# Python 3
from http.server import HTTPServer, BaseHTTPRequestHandler
from socketserver import ThreadingMixIn
except ImportError:
# Python 2
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from SocketServer import ThreadingMixIn
import sleekxmpp
from sleekxmpp.componentxmpp import ComponentXMPP
@ -142,12 +148,12 @@ class HttpHandler(BaseHTTPRequestHandler): @@ -142,12 +148,12 @@ class HttpHandler(BaseHTTPRequestHandler):
class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):
"""Handle requests in a separate thread."""
if __name__ == "__main__":
global files
global files_lock
global config
with open('config.yml','r') as ymlfile:
config = yaml.load(ymlfile)

Loading…
Cancel
Save