diff --git a/.hgignore b/.hgignore index d1fc0c0d..daf0d026 100644 --- a/.hgignore +++ b/.hgignore @@ -1,6 +1,7 @@ syntax: glob .DS_Store +run.py *.pyc *.so *.mode1v3 diff --git a/build.py b/build.py index 20eaeb4c..53bffeba 100644 --- a/build.py +++ b/build.py @@ -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): diff --git a/run.py b/run.py deleted file mode 100644 index d9a116f9..00000000 --- a/run.py +++ /dev/null @@ -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() \ No newline at end of file diff --git a/run_template_cocoa.py b/run_template_cocoa.py new file mode 100644 index 00000000..0269235f --- /dev/null +++ b/run_template_cocoa.py @@ -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()) \ No newline at end of file diff --git a/run_template_qt.py b/run_template_qt.py new file mode 100644 index 00000000..0dfe915b --- /dev/null +++ b/run_template_qt.py @@ -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()) \ No newline at end of file