Set up appveyor build scripts
Also changes mcedit2.spec to handle distribution packaging
This commit is contained in:
parent
42ba3be4c6
commit
2f97bf4c86
1
.gitignore
vendored
1
.gitignore
vendored
@ -52,3 +52,4 @@ src/mceditlib/relight/with_cython.cpp
|
|||||||
src/mceditlib/relight/with_cython.html
|
src/mceditlib/relight/with_cython.html
|
||||||
src/mcedit2/ui/**/*.py
|
src/mcedit2/ui/**/*.py
|
||||||
!__init__.py
|
!__init__.py
|
||||||
|
env-av
|
||||||
|
59
appveyor.yml
Normal file
59
appveyor.yml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
# Notes:
|
||||||
|
# - Minimal appveyor.yml file is an empty file. All sections are optional.
|
||||||
|
# - Indent each level of configuration with 2 spaces. Do not use tabs!
|
||||||
|
# - All section names are case-sensitive.
|
||||||
|
# - Section names should be unique on each level.
|
||||||
|
|
||||||
|
#---------------------------------#
|
||||||
|
# general configuration #
|
||||||
|
#---------------------------------#
|
||||||
|
|
||||||
|
# version format
|
||||||
|
version: 2.0.0-appveyor-testing-{build}
|
||||||
|
|
||||||
|
|
||||||
|
cache:
|
||||||
|
# Cache downloaded pip packages.
|
||||||
|
- "C:\\Users\\appveyor\\AppData\\Local\\pip"
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------#
|
||||||
|
# environment configuration #
|
||||||
|
#---------------------------------#
|
||||||
|
|
||||||
|
# Operating system (build VM template)
|
||||||
|
os: Windows Server 2012
|
||||||
|
|
||||||
|
environment:
|
||||||
|
matrix:
|
||||||
|
- PYTHON: "c:\\python27"
|
||||||
|
|
||||||
|
- PYTHON: "c:\\python27-x64"
|
||||||
|
|
||||||
|
global:
|
||||||
|
MCEDIT_BUILD_VERSION: $(APPVEYOR_REPO_TAG_NAME)
|
||||||
|
|
||||||
|
|
||||||
|
# scripts that run after cloning repository
|
||||||
|
install:
|
||||||
|
# by default, all script lines are interpreted as batch
|
||||||
|
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
|
||||||
|
- pip install -r requirements.txt
|
||||||
|
- pip install git+http://github.com/pyinstaller/pyinstaller
|
||||||
|
|
||||||
|
build_script:
|
||||||
|
- pyinstaller mcedit2.spec
|
||||||
|
|
||||||
|
artifacts:
|
||||||
|
- path: dist/mcedit2-*.exe
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
description: 'MCEdit 2 beta release $(APPVEYOR_REPO_TAG_NAME)'
|
||||||
|
provider: GitHub
|
||||||
|
auth_token: "$(GITHUB_AUTH_TOKEN)"
|
||||||
|
artifact: /dist\/mcedit2-.*\.exe/
|
||||||
|
draft: false
|
||||||
|
prerelease: true
|
||||||
|
force_update: true
|
||||||
|
on:
|
||||||
|
appveyor_repo_tag: true # deploy on tag push only
|
97
mcedit2.spec
97
mcedit2.spec
@ -2,15 +2,77 @@
|
|||||||
# Build script for pyinstaller. Run using:
|
# Build script for pyinstaller. Run using:
|
||||||
# $ pyinstaller mcedit2.spec
|
# $ pyinstaller mcedit2.spec
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import os
|
import os
|
||||||
import itertools
|
import sys
|
||||||
|
import platform
|
||||||
|
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import shutil
|
||||||
|
from os import path
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from PyInstaller.utils.hooks import collect_data_files
|
from PyInstaller.utils.hooks import collect_data_files
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from PyInstaller.hooks.hookutils import collect_data_files
|
from PyInstaller.hooks.hookutils import collect_data_files
|
||||||
|
|
||||||
|
|
||||||
|
# --- Configurations ---
|
||||||
|
|
||||||
|
onefile = True # if False, also skips the distribution packaging
|
||||||
|
|
||||||
|
SEVENZIP = r"C:\Program Files\7-Zip\7z.exe"
|
||||||
|
|
||||||
|
if 'APPVEYOR_BUILD_FOLDER' in os.environ:
|
||||||
|
SEVENZIP = '7z'
|
||||||
|
|
||||||
|
# --- Get build parameters and environment ---
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
arch_plat = _plat + _arch
|
||||||
|
|
||||||
|
|
||||||
|
# --- Get version number and write to _version.py ---
|
||||||
|
|
||||||
|
def get_git_version():
|
||||||
|
"""
|
||||||
|
Get the version from git.
|
||||||
|
"""
|
||||||
|
|
||||||
|
return subprocess.check_output('git describe --tags'.split()).strip()
|
||||||
|
|
||||||
|
build_version = os.environ.get('MCEDIT_BUILD_VERSION')
|
||||||
|
if build_version is None:
|
||||||
|
build_version = "HOMEBAKED-" + get_git_version()
|
||||||
|
|
||||||
|
version_src = """
|
||||||
|
__version__ = %r
|
||||||
|
""" % (build_version,)
|
||||||
|
|
||||||
|
with file("src/mcedit2/_version.py", "w") as f:
|
||||||
|
f.write(version_src)
|
||||||
|
|
||||||
|
# --- Distribution settings ---
|
||||||
|
|
||||||
|
dist_folder_name = "mcedit2-%s-%s" % (arch_plat, build_version)
|
||||||
|
sfx_exe_name = dist_folder_name + ".exe"
|
||||||
|
|
||||||
|
# --- Install mcedit2 in develop-mode and rebuild extensions ---
|
||||||
|
|
||||||
|
subprocess.check_call([sys.executable, 'setup.py', 'develop'])
|
||||||
|
|
||||||
|
# --- Rebuild UI files
|
||||||
|
|
||||||
|
subprocess.check_call([sys.executable, '-m', 'mcedit2.util.gen_ui'])
|
||||||
|
|
||||||
|
|
||||||
|
# --- Call PyInstaller to perform build ---
|
||||||
|
|
||||||
a = Analysis(['src/mcedit2/main.py'],
|
a = Analysis(['src/mcedit2/main.py'],
|
||||||
hiddenimports=['PySide.QtXml'],
|
hiddenimports=['PySide.QtXml'],
|
||||||
hookspath=['.'],
|
hookspath=['.'],
|
||||||
@ -60,8 +122,6 @@ a.binaries = a.binaries - TOC([
|
|||||||
|
|
||||||
pyz = PYZ(a.pure)
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
onefile = True
|
|
||||||
|
|
||||||
def data_filter(filename):
|
def data_filter(filename):
|
||||||
return not (
|
return not (
|
||||||
# Remove IPython html assets, saving 1.5MB.
|
# Remove IPython html assets, saving 1.5MB.
|
||||||
@ -81,9 +141,9 @@ def data_filter(filename):
|
|||||||
# mcedit egg-infos
|
# mcedit egg-infos
|
||||||
"mcedit2.egg-info" in filename or
|
"mcedit2.egg-info" in filename or
|
||||||
"mceditlib.egg-info" in filename
|
"mceditlib.egg-info" in filename
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def apply_filter(toc):
|
def apply_filter(toc):
|
||||||
return [(filename, path, filetype)
|
return [(filename, path, filetype)
|
||||||
for filename, path, filetype in toc
|
for filename, path, filetype in toc
|
||||||
@ -97,7 +157,6 @@ if onefile:
|
|||||||
|
|
||||||
exe = EXE(pyz,
|
exe = EXE(pyz,
|
||||||
a.scripts,
|
a.scripts,
|
||||||
[('i', '', 'OPTION')],
|
|
||||||
exclude_binaries=not onefile,
|
exclude_binaries=not onefile,
|
||||||
name='mcedit2.exe',
|
name='mcedit2.exe',
|
||||||
debug=True,
|
debug=True,
|
||||||
@ -114,3 +173,29 @@ if not onefile:
|
|||||||
strip=None,
|
strip=None,
|
||||||
upx=True,
|
upx=True,
|
||||||
name='mcedit2')
|
name='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)
|
||||||
|
|
||||||
|
sfx_exe_path = path.join("dist", sfx_exe_name)
|
||||||
|
|
||||||
|
subprocess.check_call(
|
||||||
|
[
|
||||||
|
SEVENZIP, "a", "-sfx7z.sfx",
|
||||||
|
sfx_exe_name,
|
||||||
|
dist_folder_name,
|
||||||
|
"-m0=Copy", # STORE compression mode
|
||||||
|
],
|
||||||
|
cwd="dist")
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
cython
|
cython
|
||||||
numpy>=1.9.0, <1.10.0
|
numpy
|
||||||
arrow
|
arrow
|
Reference in New Issue
Block a user