Rather than having a run.py file that checks build config at runtime, this file is generated at build time, making it easier to package it.

This commit is contained in:
Virgil Dupras 2010-10-04 15:42:38 +02:00
parent d2f968def7
commit 31555aa473
5 changed files with 42 additions and 39 deletions

View File

@ -1,6 +1,7 @@
syntax: glob
.DS_Store
run.py
*.pyc
*.so
*.mode1v3

View File

@ -63,11 +63,25 @@ def build_cocoa(edition, dev, help_destpath):
args.append('-configuration release')
args = ' '.join(args)
os.system('xcodebuild {0}'.format(args))
os.chdir('..')
os.chdir('../..')
print("Creating the run.py file")
subfolder = 'dev' if dev else 'release'
app_path = {
'se': 'cocoa/se/build/{0}/dupeGuru.app',
'me': 'cocoa/me/build/{0}/dupeGuru\\ ME.app',
'pe': 'cocoa/pe/build/{0}/dupeGuru\\ PE.app',
}[edition].format(subfolder)
tmpl = open('run_template_cocoa.py', 'rt').read()
run_contents = tmpl.format(app_path=app_path)
open('run.py', 'wt').write(run_contents)
def build_qt(edition, dev):
print("Building Qt stuff")
print_and_do("pyrcc4 -py3 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py')))
print("Creating the run.py file")
tmpl = open('run_template_qt.py', 'rt').read()
run_contents = tmpl.format(edition=edition)
open('run.py', 'wt').write(run_contents)
def build_pe_modules(ui):
def move(src, dst):

38
run.py
View File

@ -1,38 +0,0 @@
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2009-12-30
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/bsd_license
import sys
import os
import os.path as op
import runpy
import yaml
from hscommon.build import add_to_pythonpath
def main():
conf = yaml.load(open('conf.yaml'))
edition = conf['edition']
ui = conf['ui']
dev = conf['dev']
print("Running dupeGuru {0} with UI {1}".format(edition.upper(), ui))
if ui == 'cocoa':
subfolder = 'dev' if dev else 'release'
app_path = {
'se': 'cocoa/se/build/{0}/dupeGuru.app',
'me': 'cocoa/me/build/{0}/dupeGuru\\ ME.app',
'pe': 'cocoa/pe/build/{0}/dupeGuru\\ PE.app',
}[edition].format(subfolder)
os.system('open {0}'.format(app_path))
elif ui == 'qt':
add_to_pythonpath('.')
runpy.run_module('qt.{0}.start'.format(edition), run_name='__main__')
if __name__ == '__main__':
main()

10
run_template_cocoa.py Normal file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env python3
import sys
import os
def main():
return os.system('open {app_path}')
if __name__ == '__main__':
sys.exit(main())

16
run_template_qt.py Normal file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
import sys
import os
import os.path as op
import runpy
def main():
scriptpath = op.abspath(__file__)
scriptfolder = op.dirname(scriptpath)
sys.path.insert(0, scriptfolder)
del sys.argv[0]
runpy.run_module('qt.{edition}.start', run_name="__main__")
if __name__ == '__main__':
sys.exit(main())