First appveyor script and python windows package build file
This commit is contained in:
88
appveyor.yml
Normal file
88
appveyor.yml
Normal file
@@ -0,0 +1,88 @@
|
||||
# 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.
|
||||
|
||||
#---------------------------------#
|
||||
# environment configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# environment variables
|
||||
environment:
|
||||
# environment:
|
||||
# global:
|
||||
# connection_string: server=12;password=13;
|
||||
# service_url: https://127.0.0.1:8090
|
||||
#
|
||||
# matrix:
|
||||
# - db: mysql
|
||||
# provider: mysql
|
||||
#
|
||||
# - db: mssql
|
||||
# provider: mssql
|
||||
# password:
|
||||
# secure: $#(JFDA)jQ@#$
|
||||
|
||||
# scripts that run after cloning repository
|
||||
install:
|
||||
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
|
||||
- "%PYTHON%/python.exe C:/get-pip.py"
|
||||
- "%PYTHON%/Scripts/pip.exe install pyjavaproperties"
|
||||
|
||||
#---------------------------------#
|
||||
# build configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# build Configuration, i.e. Debug, Release, etc.
|
||||
configuration: Release
|
||||
|
||||
build:
|
||||
project: projects/mtg/mtg_vs2010.sln # path to Visual Studio solution or project
|
||||
|
||||
#---------------------------------#
|
||||
# tests configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# to disable automatic tests
|
||||
test: off
|
||||
|
||||
|
||||
#---------------------------------#
|
||||
# artifacts configuration #
|
||||
#---------------------------------#
|
||||
|
||||
artifacts:
|
||||
# pushing windows package
|
||||
- path: projects\mtg\bin\Wagic-windows*.zip
|
||||
|
||||
|
||||
#---------------------------------#
|
||||
# deployment configuration #
|
||||
#---------------------------------#
|
||||
|
||||
# scripts to run before deployment
|
||||
before_deploy:
|
||||
- cd projects/mtg/bin
|
||||
- "%PYTHON%/python.exe createWindowsZip.py"
|
||||
|
||||
# scripts to run after deployment
|
||||
after_deploy:
|
||||
|
||||
# to run your custom scripts instead of provider deployments
|
||||
deploy_script:
|
||||
|
||||
# to disable deployment
|
||||
#deploy: off
|
||||
|
||||
#---------------------------------#
|
||||
# global handlers #
|
||||
#---------------------------------#
|
||||
|
||||
# on successful build
|
||||
on_success:
|
||||
- do something
|
||||
|
||||
# on build failure
|
||||
on_failure:
|
||||
- do something
|
||||
@@ -30,8 +30,8 @@ def createResZipFile(filename):
|
||||
zip_file.close()
|
||||
|
||||
if rename:
|
||||
os.rename('settings/options.txt', 'settings/options.orig.txt')
|
||||
os.rename('player/options.txt', 'player/options.orig.txt')
|
||||
os.rename('settings/options.txt', 'settings/options.orig.txt')
|
||||
os.rename('player/options.txt', 'player/options.orig.txt')
|
||||
|
||||
def getFilename():
|
||||
p = Properties();
|
||||
@@ -44,16 +44,18 @@ def getFilename():
|
||||
|
||||
|
||||
|
||||
def createStandardResFile():
|
||||
print "Creating Standard Resource File"
|
||||
filename = getFilename() + '.zip'
|
||||
def createStandardResFile(filename):
|
||||
print('Creating Standard Resource File')
|
||||
if not filename:
|
||||
filename = getFilename() + '.zip'
|
||||
createResZipFile( filename )
|
||||
print >> sys.stderr, 'Created Resource Package for Standard Distribution: {0}'.format( filename)
|
||||
|
||||
def createIosResFile():
|
||||
print 'Preparing Resource Package for iOS'
|
||||
def createIosResFile(filename):
|
||||
print('Preparing Resource Package for iOS')
|
||||
utilities = ZipUtilities()
|
||||
filename = getFilename() + '_iOS.zip'
|
||||
if not filename:
|
||||
filename = getFilename() + '_iOS.zip'
|
||||
#createResZipFile( filename )
|
||||
zip_file = zipfile.ZipFile(filename, 'a', zipfile.ZIP_STORED)
|
||||
zip_file.write("../../iOS/Res/rules/modrules.xml", "rules/modrules.xml", zipfile.ZIP_STORED)
|
||||
@@ -78,10 +80,10 @@ class ZipUtilities:
|
||||
if file != '.svn':
|
||||
full_path = os.path.join(folder, file)
|
||||
if os.path.isfile(full_path):
|
||||
print 'File added: ' + str(full_path)
|
||||
print('File added: ' + str(full_path))
|
||||
zip_file.write(full_path)
|
||||
elif os.path.isdir(full_path):
|
||||
print 'Entering folder: ' + str(full_path)
|
||||
print('Entering folder: ' + str(full_path))
|
||||
self.addFolderToZip(zip_file, full_path)
|
||||
|
||||
|
||||
@@ -90,16 +92,17 @@ def main():
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-p", "--platform", help="PLATFORM: specify custom build. (eg ios, android, etc)", metavar="PLATFORM", dest="platform")
|
||||
parser.add_option("-n", "--name", help="NAME: specify resource file name", metavar="NAME", dest="name")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if (options.platform):
|
||||
if (options.platform == "ios"):
|
||||
createIosResFile()
|
||||
else:
|
||||
createStandardResFile()
|
||||
if (options.platform == "ios"):
|
||||
createIosResFile(options.name)
|
||||
else:
|
||||
createStandardResFile(options.name)
|
||||
else:
|
||||
createStandardResFile()
|
||||
createStandardResFile(options.name)
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
80
projects/mtg/bin/createWindowsZip.py
Normal file
80
projects/mtg/bin/createWindowsZip.py
Normal file
@@ -0,0 +1,80 @@
|
||||
import sys
|
||||
import os
|
||||
import zipfile
|
||||
from pyjavaproperties import Properties
|
||||
from optparse import OptionParser
|
||||
|
||||
def createWindowsZipFile(filename):
|
||||
utilities = ZipUtilities()
|
||||
zip_file = zipfile.ZipFile(filename, 'w', zipfile.ZIP_STORED)
|
||||
zip_file.write('../../../LICENSE')
|
||||
zip_file.write('libpng13.dll')
|
||||
zip_file.write('SDL.dll')
|
||||
zip_file.write('fmod.dll')
|
||||
zip_file.write('zlib1.dll')
|
||||
zip_file.write('Wagic.exe')
|
||||
zip_file.write('Res/' + getFilename('core') + '.zip')
|
||||
zip_file.close()
|
||||
|
||||
def getFilename(filename):
|
||||
p = Properties();
|
||||
p.load(open('../build.number.properties'));
|
||||
minor = p['build.minor'];
|
||||
major = p['build.major'];
|
||||
point = p['build.point'];
|
||||
filename = filename + '-' + major + minor + point
|
||||
return filename
|
||||
|
||||
def createStandardResFile():
|
||||
print "Creating Resource File"
|
||||
cmd = 'python createResourceZip.py -n ' + getFilename('core') + '.zip'
|
||||
os.chdir("Res")
|
||||
os.system(cmd)
|
||||
# os.system("python createResourceZip.py -n resources.zip")
|
||||
os.chdir("..")
|
||||
print "Creating Windows Package File"
|
||||
filename = getFilename('Wagic-windows') + '.zip'
|
||||
createWindowsZipFile( filename )
|
||||
print >> sys.stderr, 'Created Resource Package for Standard Distribution: {0}'.format( filename)
|
||||
|
||||
class ZipUtilities:
|
||||
|
||||
def toZip(self, file, filename):
|
||||
zip_file = zipfile.ZipFile(filename, 'w')
|
||||
if os.path.isfile(file):
|
||||
zip_file.write(file)
|
||||
else:
|
||||
self.addFolderToZip(zip_file, file)
|
||||
zip_file.close()
|
||||
|
||||
def addFolderToZip(self, zip_file, folder):
|
||||
zip_file.writestr(folder + '/', '')
|
||||
for file in os.listdir(folder):
|
||||
if file != '.svn':
|
||||
full_path = os.path.join(folder, file)
|
||||
if os.path.isfile(full_path):
|
||||
print 'File added: ' + str(full_path)
|
||||
zip_file.write(full_path)
|
||||
elif os.path.isdir(full_path):
|
||||
print 'Entering folder: ' + str(full_path)
|
||||
self.addFolderToZip(zip_file, full_path)
|
||||
|
||||
|
||||
def main():
|
||||
## using optparse instead of argParse for now since python 2.7 may not be installed.
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option("-p", "--platform", help="PLATFORM: specify custom build. (eg ios, android, etc)", metavar="PLATFORM", dest="platform")
|
||||
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if (options.platform):
|
||||
if (options.platform == "ios"):
|
||||
createIosResFile()
|
||||
else:
|
||||
createStandardResFile()
|
||||
else:
|
||||
createStandardResFile()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user