2011-11-03 23:24:33 +00:00
|
|
|
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
|
2011-11-03 23:40:35 +00:00
|
|
|
},
|
|
|
|
entry_points = {
|
|
|
|
'gui_scripts': [
|
2012-01-28 11:28:24 +00:00
|
|
|
'tomb-qt-create = tombqt.create:run_create_wizard',
|
|
|
|
'tomb-qt-open = tombqt.open:run_open_wizard'
|
2011-11-03 23:40:35 +00:00
|
|
|
]
|
2011-11-03 23:24:33 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|