fixes for py2exe/windows
This commit is contained in:
@@ -98,7 +98,11 @@ class MapGen(object):
|
||||
blank.save(os.path.join(tileDir, "blank."+quadtree.imgformat))
|
||||
|
||||
# copy web assets into destdir:
|
||||
mirror_dir(os.path.join(util.get_program_path(), "overviewer_core", "data", "web_assets"), self.destdir)
|
||||
global_assets = os.path.join(util.get_program_path(), "overviewer_core", "data", "web_assets")
|
||||
if not os.path.isdir(global_assets):
|
||||
global_assets = os.path.join(util.get_program_path(), "web_assets")
|
||||
mirror_dir(global_assets, self.destdir)
|
||||
|
||||
# do the same with the local copy, if we have it
|
||||
if self.web_assets_path:
|
||||
mirror_dir(self.web_assets_path, self.destdir)
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# with the Overviewer. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import sys
|
||||
import imp
|
||||
import os
|
||||
import os.path
|
||||
import zipfile
|
||||
@@ -56,6 +57,11 @@ def _find_file(filename, mode="rb"):
|
||||
path = os.path.join(programdir, "overviewer_core", "data", "textures", filename)
|
||||
if os.path.exists(path):
|
||||
return open(path, mode)
|
||||
elif hasattr(sys, "frozen") or imp.is_frozen("__main__"):
|
||||
# windows special case, when the package dir doesn't exist
|
||||
path = os.path.join(programdir, "textures", filename)
|
||||
if os.path.exists(path):
|
||||
return open(path, mode)
|
||||
|
||||
if sys.platform == "darwin":
|
||||
path = os.path.join("/Applications/Minecraft", filename)
|
||||
|
||||
9
setup.py
9
setup.py
@@ -45,12 +45,18 @@ setup_kwargs['author_email'] = 'brownan@gmail.com'
|
||||
setup_kwargs['license'] = 'GNU General Public License v3'
|
||||
setup_kwargs['long_description'] = read('README.rst')
|
||||
|
||||
# top-level files that should be included as documentation
|
||||
doc_files = ['COPYING.txt', 'README.rst', 'CONTRIBUTORS.rst', 'sample.settings.py']
|
||||
|
||||
#
|
||||
# py2exe options
|
||||
#
|
||||
|
||||
if py2exe is not None:
|
||||
setup_kwargs['console'] = ['overviewer.py']
|
||||
setup_kwargs['data_files'] = [('', doc_files),
|
||||
('textures', glob.glob('overviewer_core/data/textures/*')),
|
||||
('web_assets', glob.glob('overviewer_core/data/web_assets/*'))]
|
||||
setup_kwargs['zipfile'] = None
|
||||
if platform.system() == 'Windows' and '64bit' in platform.architecture():
|
||||
b = 3
|
||||
@@ -67,7 +73,8 @@ setup_kwargs['scripts'] = ['overviewer.py']
|
||||
setup_kwargs['package_data'] = {'overviewer_core':
|
||||
['data/textures/*',
|
||||
'data/web_assets/*']}
|
||||
setup_kwargs['data_files'] = [('share/doc/minecraft-overviewer', ['COPYING.txt', 'README.rst', 'CONTRIBUTORS.rst', 'sample.settings.py'])]
|
||||
if py2exe is None:
|
||||
setup_kwargs['data_files'] = [('share/doc/minecraft-overviewer', doc_files)]
|
||||
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user