Merge branch 'master' of git://git.assembla.com/fpdb-sql

Conflicts:
	pyfpdb/py2exe_setup.py
This commit is contained in:
Eratosthenes 2010-02-07 11:43:28 -05:00
commit da3b8076c7
4 changed files with 37 additions and 31 deletions

View File

@ -42,6 +42,9 @@ def to_utf8(s):
except UnicodeDecodeError: except UnicodeDecodeError:
sys.stderr.write('Could not convert: "%s"\n' % s) sys.stderr.write('Could not convert: "%s"\n' % s)
raise raise
except UnicodeEncodeError:
sys.stderr.write('Could not encode: "%s"\n' % s)
raise
except TypeError: # TypeError is raised when we give unicode() an already encoded string except TypeError: # TypeError is raised when we give unicode() an already encoded string
return s return s
@ -54,13 +57,21 @@ def to_db_utf8(s):
except UnicodeDecodeError: except UnicodeDecodeError:
sys.stderr.write('Could not convert: "%s"\n' % s) sys.stderr.write('Could not convert: "%s"\n' % s)
raise raise
except UnicodeEncodeError:
sys.stderr.write('Could not encode: "%s"\n' % s)
raise
def to_gui(s): def to_gui(s):
if not_needed3: return s if not_needed3: return s
try: try:
(_out, _len) = encoder_to_sys.encode(s) # we usually don't want to use 'replace' but this is only for displaying
# in the gui so it doesn't matter if names are missing an accent or two
(_out, _len) = encoder_to_sys.encode(s, 'replace')
return _out return _out
except UnicodeDecodeError: except UnicodeDecodeError:
sys.stderr.write('Could not convert: "%s"\n' % s) sys.stderr.write('Could not convert: "%s"\n' % s)
raise raise
except UnicodeEncodeError:
sys.stderr.write('Could not encode: "%s"\n' % s)
raise

View File

@ -69,13 +69,13 @@ class HUD_main(object):
# This class mainly provides state for controlling the multiple HUDs. # This class mainly provides state for controlling the multiple HUDs.
def __init__(self, db_name = 'fpdb'): def __init__(self, db_name = 'fpdb'):
try:
print "\nHUD_main: starting ..." print "\nHUD_main: starting ..."
self.db_name = db_name self.db_name = db_name
self.config = Configuration.Config(file=options.config, dbname=db_name) self.config = Configuration.Config(file=options.config, dbname=db_name)
log = Configuration.get_logger("logging.conf", "hud", log_dir=self.config.dir_log) log = Configuration.get_logger("logging.conf", "hud", log_dir=self.config.dir_log)
log.info("HUD_main starting: using db name = %s" % (db_name)) log.info("HUD_main starting: using db name = %s" % (db_name))
try:
if not options.errorsToConsole: if not options.errorsToConsole:
fileName = os.path.join(self.config.dir_log, 'HUD-errors.txt') fileName = os.path.join(self.config.dir_log, 'HUD-errors.txt')
print "Note: error output is being diverted to:\n"+fileName \ print "Note: error output is being diverted to:\n"+fileName \
@ -100,8 +100,9 @@ class HUD_main(object):
self.main_window.set_title("HUD Main Window") self.main_window.set_title("HUD Main Window")
self.main_window.show_all() self.main_window.show_all()
except: except:
log.debug("commit "+str(i)+" failed: info=" + str(sys.exc_info()) log.error( "*** Exception in HUD_main.init() *** " )
+ " value=" + str(sys.exc_value)) for e in traceback.format_tb(sys.exc_info()[2]):
log.error(e)
def destroy(self, *args): # call back for terminating the main eventloop def destroy(self, *args): # call back for terminating the main eventloop
@ -139,7 +140,8 @@ class HUD_main(object):
self.hud_dict[table_name].reposition_windows() self.hud_dict[table_name].reposition_windows()
except: except:
log.error( "*** Exception in HUD_main::idle_func() *** " ) log.error( "*** Exception in HUD_main::idle_func() *** " )
log.error( traceback.format_stack() ) for e in traceback.format_tb(sys.exc_info()[2]):
log.error(e)
finally: finally:
gtk.gdk.threads_leave() gtk.gdk.threads_leave()
return False return False

View File

@ -88,10 +88,10 @@ test_and_remove('gfx')
today = date.today().strftime('%Y%m%d') today = date.today().strftime('%Y%m%d')
print "\nOutput will be created in /dist/ and /fpdb_XXX_"+today+"/" print "\n" + r"Output will be created in \dist\ and \fpdb_XXX_"+today+'\\'
print "Enter value for XXX (any length): ", # the comma means no newline print "Enter value for XXX (any length): ", # the comma means no newline
xxx = sys.stdin.readline().rstrip() xxx = sys.stdin.readline().rstrip()
dist_dir = r'..\fpdb-' + xxx + '-' + today dist_dir = r'..\fpdb-' + xxx + '-' + today + '-exe'
print print
@ -106,33 +106,26 @@ setup(
], ],
options = {'py2exe': { options = {'py2exe': {
'packages' :'encodings', 'packages' : ['encodings', 'matplotlib'],
'includes' : 'cairo, pango, pangocairo, atk, gobject, PokerStarsToFpdb, FulltiltToFpdb', 'includes' : ['cairo', 'pango', 'pangocairo', 'atk', 'gobject'
'excludes' : '_tkagg, _agg2, cocoaagg, fltkagg', ,'PokerStarsToFpdb', 'matplotlib.numerix.random_array'],
'dll_excludes': 'libglade-2.0-0.dll', 'excludes' : ['_gtkagg', '_tkagg', '_agg2', 'cocoaagg', 'fltkagg'],
'dll_excludes': ['libglade-2.0-0.dll', 'libgdk-win32-2.0-0.dll'
,'libgobject-2.0-0.dll'],
} }
}, },
# REB's data_files # files in 2nd value in tuple are moved to dir named in 1st value
# data_files = ['HUD_config.xml.example',
# 'Cards01.png',
# 'logging.conf',
# (r'mpl-data', [r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\matplotlibrc']),
# (r'mpl-data\images', glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\images\*.*')),
# (r'mpl-data\fonts', glob.glob(r'C:\Python25\Lib\site-packages\matplotlib\mpl-data\fonts\*.*')),
# ]
# sc's data_files
# files are moved from 2nd value in tuple to dir named in 1st
data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf']) data_files = [('', ['HUD_config.xml.example', 'Cards01.png', 'logging.conf'])
,(dist_dir, ['run_fpdb.bat']) ,(dist_dir, [r'..\run_fpdb.bat'])
,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') ) ,( dist_dir + r'\gfx', glob.glob(r'..\gfx\*.*') )
# line below has problem with fonts subdir ('not a regular file')
#,(r'matplotlibdata', glob.glob(r'c:\python25\Lib\site-packages\matplotlib\mpl-data\*')) #,(r'matplotlibdata', glob.glob(r'c:\python25\Lib\site-packages\matplotlib\mpl-data\*'))
] + matplotlib.get_py2exe_datafiles() ] + matplotlib.get_py2exe_datafiles()
) )
print '\nIf py2exe was successful move the /dist/ directory ' print '\n' + r'If py2exe was successful move the \dist\ directory '
print 'into /'+dist_dir+'/ and rename it as /pyfpdb/' print 'into \\'+dist_dir+'\\ and rename it as \\pyfpdb\\'
print "Don't forget to add the /etc /lib and /share dirs from your gtk dir\n" print "Don't forget to add the \\etc \\lib and \\share dirs from your gtk dir\n"