Changes to make the py2exe exe happy.

This commit is contained in:
Eratosthenes 2010-02-05 23:13:53 -05:00
parent 08078cfee4
commit 4df991517e
2 changed files with 18 additions and 2 deletions

13
pyfpdb/Configuration.py Executable file → Normal file
View File

@ -166,6 +166,10 @@ if LOCALE_ENCODING == "US-ASCII":
# needs LOCALE_ENCODING (above), imported for sqlite setup in Config class below # needs LOCALE_ENCODING (above), imported for sqlite setup in Config class below
FROZEN = hasattr(sys, "frozen")
EXEC_PATH = get_exec_path()
import Charset import Charset
@ -613,7 +617,8 @@ class Config:
def save(self, file = None): def save(self, file = None):
if file is None: if file is None:
file = self.file file = self.file
shutil.move(file, file+".backup") shutil.move(file, file+".backup", ignore_errors = True)
with open(file, 'w') as f: with open(file, 'w') as f:
self.doc.writexml(f) self.doc.writexml(f)
@ -1030,3 +1035,9 @@ if __name__== "__main__":
PrettyPrint(site_node, stream=sys.stdout, encoding="utf-8") PrettyPrint(site_node, stream=sys.stdout, encoding="utf-8")
except: except:
print "xml.dom.ext needs PyXML to be installed!" print "xml.dom.ext needs PyXML to be installed!"
print "FROZEN =", FROZEN
print "EXEC_PATH =", EXEC_PATH
print "press enter to end"
sys.stdin.readline()

7
pyfpdb/GuiAutoImport.py Executable file → Normal file
View File

@ -193,7 +193,11 @@ class GuiAutoImport (threading.Thread):
self.doAutoImportBool = True self.doAutoImportBool = True
widget.set_label(u' _Stop Autoimport ') widget.set_label(u' _Stop Autoimport ')
if self.pipe_to_hud is None: if self.pipe_to_hud is None:
if os.name == 'nt': if Configuration.FROZEN:
path = Configuration.EXEC_PATH
command = "HUD_main.exe"
bs = 0
elif os.name == 'nt':
path = sys.path[0].replace('\\','\\\\') path = sys.path[0].replace('\\','\\\\')
command = 'python "'+path+'\\HUD_main.py" ' + self.settings['cl_options'] command = 'python "'+path+'\\HUD_main.py" ' + self.settings['cl_options']
bs = 0 bs = 0
@ -203,6 +207,7 @@ class GuiAutoImport (threading.Thread):
bs = 1 bs = 1
try: try:
print "opening pipe to HUD"
self.pipe_to_hud = subprocess.Popen(command, bufsize=bs, self.pipe_to_hud = subprocess.Popen(command, bufsize=bs,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
universal_newlines=True) universal_newlines=True)