Get builds going for OS X

This commit is contained in:
David Vierra 2016-08-16 22:55:59 -10:00
parent 2f97bf4c86
commit 9b60287eb2
6 changed files with 57 additions and 25 deletions

BIN
mcedit2.icns Normal file

Binary file not shown.

View File

@ -20,7 +20,8 @@ except ImportError:
# --- Configurations ---
onefile = True # if False, also skips the distribution packaging
is_win = sys.platform == 'win32'
is_osx = sys.platform == 'darwin'
SEVENZIP = r"C:\Program Files\7-Zip\7z.exe"
@ -32,10 +33,18 @@ if 'APPVEYOR_BUILD_FOLDER' in os.environ:
arch_plat = os.environ.get('PYTHON_ARCH_PLAT')
if arch_plat is None:
_arch = platform.architecture()[0][:2]
_plat = "win" if os.name == 'nt' else os.name
_plat = "win" if sys.platform == 'win32' else os.name
arch_plat = _plat + _arch
if is_win:
exe_name = dist_app_name = "mcedit2.exe"
exclude_binaries = False
if is_osx:
exe_name = "MCEdit 2"
dist_app_name = "MCEdit 2.app"
exclude_binaries = True
# --- Get version number and write to _version.py ---
@ -152,20 +161,20 @@ def apply_filter(toc):
a.datas = apply_filter(a.datas)
a.binaries = apply_filter(a.binaries)
if onefile:
if is_win:
a.scripts += a.binaries + a.zipfiles + a.datas + a.zipped_data
exe = EXE(pyz,
a.scripts,
exclude_binaries=not onefile,
name='mcedit2.exe',
exclude_binaries=exclude_binaries,
name=exe_name,
debug=True,
strip=None,
upx=False,
console=True,
icon="mcediticon.ico")
if not onefile:
if is_osx:
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
@ -174,20 +183,31 @@ if not onefile:
upx=True,
name='mcedit2')
bundle = BUNDLE(coll,
name=dist_app_name,
icon="mcedit2.icns",
bundle_identifier='net.mcedit.mcedit2',
)
# --- Distribution packaging ---
if onefile:
dist_folder_path = path.join("dist", dist_folder_name)
os.makedirs(dist_folder_path)
shutil.copy(path.join("dist", "mcedit2.exe"), dist_folder_path)
userdata_path = path.join(dist_folder_path, "MCEdit 2 Files")
plugins_path = path.join(userdata_path, "plugins")
os.makedirs(userdata_path)
shutil.copytree(path.join('src', 'plugins'), plugins_path)
dist_folder_path = path.join("dist", dist_folder_name)
os.makedirs(dist_folder_path)
if is_osx:
shutil.copytree(path.join("dist", dist_app_name), path.join(dist_folder_path, dist_app_name))
else:
shutil.copy(path.join("dist", dist_app_name), dist_folder_path)
userdata_path = path.join(dist_folder_path, "MCEdit 2 Files")
plugins_path = path.join(userdata_path, "plugins")
os.makedirs(userdata_path)
shutil.copytree(path.join('src', 'plugins'), plugins_path)
if is_win:
sfx_exe_path = path.join("dist", sfx_exe_name)
subprocess.check_call(

View File

@ -1,6 +1,6 @@
-r requirements-mceditlib.txt
pyzmq==15.0.0 # v15.4.0 fails to freeze with PyInstaller - see pyinstaller/issues/2147
pyside>=1.2.0
pyside>=1.2.0 ; sys.platform != 'darwin' # install this via homebrew, not visible to pip
pyopengl
ipython
qtconsole

View File

@ -18,13 +18,18 @@ install_requires = [
"numpy",
]
include_dirs = [numpy.get_include()]
mcedit2_ext_modules = cythonize(
[
"src/mcedit2/rendering/blockmodels.pyx",
"src/mcedit2/rendering/modelmesh.pyx",
]
],
)
for m in mcedit2_ext_modules:
m.include_dirs = include_dirs
setup(name='mcedit2',
version=version,
description="Interactive 3D World Editor for Minecraft Levels",
@ -49,7 +54,7 @@ setup(name='mcedit2',
packages=["mcedit2"],
package_dir={'': 'src'},
ext_modules=mcedit2_ext_modules,
include_dirs=numpy.get_include(),
include_dirs=include_dirs,
include_package_data=True,
zip_safe=False,
install_requires=install_requires,

View File

@ -18,11 +18,16 @@ install_requires = [
"numpy",
]
include_dirs = [numpy.get_include()]
mceditlib_ext_modules = cythonize([
"src/mceditlib/nbt.pyx",
"src/mceditlib/relight/with_cython.pyx"
])
for m in mceditlib_ext_modules:
m.include_dirs = include_dirs
setup(name='mceditlib',
version=version,
description="Python library for editing Minecraft levels",
@ -45,7 +50,7 @@ setup(name='mceditlib',
packages=["mceditlib"],
package_dir={'': 'src'},
ext_modules=mceditlib_ext_modules,
include_dirs=numpy.get_include(),
include_dirs=include_dirs,
include_package_data=True,
zip_safe=False,
install_requires=install_requires,

View File

@ -32,8 +32,10 @@ def writer(stream):
return _write
sys.stdout = codecs.getwriter(sys.stdin.encoding)(sys.stdout, errors='ignore')
sys.stderr = codecs.getwriter(sys.stdin.encoding)(sys.stderr, errors='ignore')
ioencoding = sys.stdin.encoding or 'utf-8'
sys.stdout = codecs.getwriter(ioencoding)(sys.stdout, errors='ignore')
sys.stderr = codecs.getwriter(ioencoding)(sys.stderr, errors='ignore')
sys.stdout.write = writer(sys.stdout)
sys.stderr.write = writer(sys.stderr)
@ -109,7 +111,7 @@ def setup_logging():
logging.captureWarnings(True)
from mcedit2.util.directories import getUserFilesDirectory
mceditUserData = getUserFilesDirectory()
logfilename = os.path.join(mceditUserData, 'mcedit.log')
logfilename = os.path.join(mceditUserData, 'mcedit2.log')
abslogfile = os.path.abspath(logfilename)
if hasattr(sys, 'frozen'):
@ -117,7 +119,7 @@ def setup_logging():
if sys.platform == "darwin":
log_debug("OS X found.")
logfile = os.path.expanduser(b"~/Library/Logs/" + logfilename)
logfile = os.path.expanduser(b"~/Library/Logs/" + 'mcedit2.log')
else:
logfile = abslogfile
else: