QT: change dir layout, packaging begins

This commit is contained in:
boyska 2011-11-04 00:24:33 +01:00
parent 6aade0ffc8
commit b6105ca5b6
7 changed files with 77 additions and 0 deletions

View File

@ -0,0 +1,29 @@
from tomblib.parser import *
class TestWrong:
def test_wrong_tag(self):
assert parse_line(' [a] foo') is None
def test_no_space(self):
assert parse_line(' [!]foo') is None
class TestError:
def test_simple(self):
parse = parse_line('[!] foo')
assert parse is not None
assert parse['type'] == 'error'
assert parse['content'] == 'foo'
def test_preceding(self):
parse = parse_line(' [!] foo')
assert parse is not None
assert parse['type'] == 'error'
assert parse['content'] == 'foo'
def test_following(self):
parse = parse_line('[!]shdad foo')
assert parse is not None
assert parse['type'] == 'error'
assert parse['content'] == 'foo'
def test_mul_words(self):
parse = parse_line('[!] shdad foo')
assert parse is not None
assert parse['type'] == 'error'
assert parse['content'] == 'shdad foo'

2
src/qt/.gitignore vendored
View File

@ -1,2 +1,4 @@
.*.swp
*.pyc
TombQt.egg-info
build

46
src/qt/setup.py Normal file
View File

@ -0,0 +1,46 @@
import os
import glob
from setuptools import setup
from StringIO import StringIO
from distutils import log
from distutils.core import Command
from distutils.dep_util import newer
class build_ui(Command):
# Stolen from picard
description = "build Qt UI files"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
from PyQt4 import uic
for uifile in glob.glob("tombqt/*.ui"):
pyfile = "ui_%s.py" % os.path.splitext(os.path.basename(uifile))[0]
pyfile = os.path.join('tombqt', pyfile)
if newer(uifile, pyfile):
log.info("compiling %s -> %s", uifile, pyfile)
tmp = StringIO()
uic.compileUi(uifile, tmp)
source = tmp.getvalue()
f = open(pyfile, "w")
f.write(source)
f.close()
setup(
name = 'TombQt',
version = '0.1',
packages = ['tombqt'],
cmdclass = {
'build_ui': build_ui
}
)