From 9d56a2ce9a32fe56453b9c6db5d4427da20ad04c Mon Sep 17 00:00:00 2001 From: "beville@gmail.com" Date: Thu, 7 Feb 2013 04:50:10 +0000 Subject: [PATCH] Got frozen windows build working again git-svn-id: http://comictagger.googlecode.com/svn/trunk@458 6c5673fe-1810-88d6-992b-cd32ca31540c --- comictaggerlib/settings.py | 17 +++++++---------- setup.py | 9 --------- windows/Makefile | 12 ++++++------ 3 files changed, 13 insertions(+), 25 deletions(-) diff --git a/comictaggerlib/settings.py b/comictaggerlib/settings.py index 8b36ff5..9f05028 100644 --- a/comictaggerlib/settings.py +++ b/comictaggerlib/settings.py @@ -37,25 +37,22 @@ class ComicTaggerSettings: @staticmethod def baseDir(): - if platform.system() == "Darwin" and getattr(sys, 'frozen', None): - return sys._MEIPASS + if getattr(sys, 'frozen', None): + if platform.system() == "Darwin": + return sys._MEIPASS + else: # Windows + return os.path.dirname( os.path.abspath( sys.argv[0] ) ) else: - #return os.path.dirname( os.path.abspath( sys.argv[0] ) ) - #return os.path.dirname( os.path.realpath(sys.argv[0] ) ) return os.path.dirname( os.path.abspath( __file__) ) @staticmethod def getGraphic( filename ): - graphic_folder = os.path.join(ComicTaggerSettings.baseDir(), '..', 'graphics') - if not os.path.exists(graphic_folder): - graphic_folder = os.path.join(ComicTaggerSettings.baseDir(), 'graphics') + graphic_folder = os.path.join(ComicTaggerSettings.baseDir(), 'graphics') return os.path.join( graphic_folder, filename ) @staticmethod def getUIFile( filename ): - ui_folder = os.path.join(ComicTaggerSettings.baseDir(), '..', 'ui') - if not os.path.exists(ui_folder): - ui_folder = os.path.join(ComicTaggerSettings.baseDir(), 'ui') + ui_folder = os.path.join(ComicTaggerSettings.baseDir(), 'ui') return os.path.join( ui_folder, filename ) def setDefaultValues( self ): diff --git a/setup.py b/setup.py index 539e131..407d263 100644 --- a/setup.py +++ b/setup.py @@ -2,15 +2,6 @@ from distutils.core import setup import distutils.command.install_scripts -#import os -#import shutil - -# Things are weird if the script has a py. Will this break things for windows??? -#if not os.path.exists('scripts/comictagger'): -# if not os.path.exists('scripts'): -# os.makedirs('scripts') -# shutil.copyfile('comictagger.py', 'scripts/comictagger') - setup(name = "comictagger", version = "1.1.1", diff --git a/windows/Makefile b/windows/Makefile index 71083ea..bc0340e 100644 --- a/windows/Makefile +++ b/windows/Makefile @@ -2,21 +2,21 @@ # rm, cp, grep, cut, cat TAGGER_BASE:= c:\Users\tony\Dropbox\tagger\comictagger -TAGGER_SRC := $(TAGGER_BASE)\src +TAGGER_SRC := $(TAGGER_BASE)\comictaggerlib DIST_DIR := $(TAGGER_BASE)\windows\dist NSIS_CMD := "C:\Program Files (x86)\NSIS\makensis.exe" -VERSION := $(shell grep version "$(TAGGER_BASE)\ctversion.py" | cut -d= -f2) +VERSION := $(shell grep version "$(TAGGER_SRC)\ctversion.py" | cut -d= -f2) all: clean dist package dist: cd "$(TAGGER_BASE)" & - "C:\Python27\Scripts\cxfreeze.bat" $(TAGGER_SRC)\comictagger.py --icon nsis\app.ico + "C:\Python27\Scripts\cxfreeze.bat" $(TAGGER_BASE)\comictagger.py --icon nsis\app.ico #--base-name=Win32GUI cp -R C:\Python27\Lib\site-packages\PyQt4\plugins\imageformats $(DIST_DIR) - cp "$(TAGGER_SRC)\UnRAR2\UnRARDLL\unrar.dll" $(DIST_DIR) - cp "$(TAGGER_BASE)\*.ui" $(DIST_DIR) - cp -r "$(TAGGER_BASE)\graphics" $(DIST_DIR) + cp "$(TAGGER_SRC)\UnRAR2\UnRARDLL\unrar.dll" $(DIST_DIR) + cp -r "$(TAGGER_SRC)\ui" $(DIST_DIR) + cp -r "$(TAGGER_SRC)\graphics" $(DIST_DIR) rm "$(DIST_DIR)\QtWebKit4.dll" rm "$(DIST_DIR)\PyQt4.QtWebKit.pyd"