Commits

Miki Tebeka  committed 4b0772c

install works, python3 fixes

  • Participants
  • Parent commits 497a856
  • Tags v0.3.0

Comments (0)

Files changed (5)

 include README.md requirements.txt test-requirements.txt ChangeLog Makefile
+include logbot *.html
 recursive-include logbot/httpd/static *

File logbot/httpd/__init__.py

 from jinja2 import Environment, FileSystemLoader
 
 from collections import namedtuple
-from httplib import NOT_FOUND
 from os.path import dirname, realpath, join, isfile
 import logging
 
+from sys import version_info
+
+if version_info[0] >= 3:
+    from http.client import NOT_FOUND
+else:
+    from httplib import NOT_FOUND
+
 here = dirname(realpath(__file__))
 static_dir = join(here, 'static')
 get_template = Environment(loader=FileSystemLoader(here)).get_template

File logbot/search.py

 from whoosh.qparser import QueryParser
 
 from glob import glob
-from itertools import imap
 from os import makedirs
 from os.path import join, isdir
 from sys import version_info
 
 if version_info[0] >= 3:
     unicode = lambda x: x
+else:
+    from itertools import imap
+    map = imap
 
 
 schema = Schema(
 
 
 def msg_fields(hit):
-    return imap(hit.get, Message._fields)
+    return map(hit.get, Message._fields)
 
 
 def search(query):
 import logbot
 
 from setuptools import setup
+from os import walk
 from os.path import dirname, realpath, join
 import re
 
         return [line.strip() for line in fo
                 if not is_comment(line) and line.strip()]
 
+def static_files():
+    for root, _, files in walk('logbot/httpd/static'):
+        for name in files:
+            yield join(root, name)
+
 setup(
     name='logbot',
     version=logbot.__version__,
     packages=['logbot', 'logbot.httpd'],
     install_requires=load_requirements('requirements.txt'),
     package_data={
-        'logbot': ['httpd/static/*', 'httpd/*.html'],
+        'logbot': ['httpd/*.html'] + list(static_files()),
     },
     entry_points={
         'console_scripts': [

File tests/test-install.sh

 # Fail on first error
 set -e
 rm -rf ${root}
-virtualenv ${root}
+virtualenv-2.7 ${root}
 . ${root}/bin/activate
 python setup.py install
 ${root}/bin/logbot --help