2009-12-30 16:34:41 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2009-12-30
|
2012-03-15 18:28:40 +00:00
|
|
|
# Copyright 2012 Hardcoded Software (http://www.hardcoded.net)
|
2009-12-30 16:34:41 +00:00
|
|
|
#
|
2010-09-30 10:17:41 +00:00
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
2009-12-30 16:34:41 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2010-09-30 10:17:41 +00:00
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
2009-12-30 16:34:41 +00:00
|
|
|
|
2012-01-11 17:18:03 +00:00
|
|
|
import sys
|
2009-12-30 16:34:41 +00:00
|
|
|
import os
|
|
|
|
import os.path as op
|
2011-01-21 13:39:33 +00:00
|
|
|
from optparse import OptionParser
|
2010-01-01 20:42:52 +00:00
|
|
|
import shutil
|
2011-01-11 15:21:36 +00:00
|
|
|
import json
|
2012-01-16 15:30:45 +00:00
|
|
|
import importlib
|
2012-07-28 20:22:51 +00:00
|
|
|
import glob
|
2009-12-30 16:34:41 +00:00
|
|
|
|
2011-12-28 19:51:33 +00:00
|
|
|
from setuptools import setup, Extension
|
2009-12-30 16:34:41 +00:00
|
|
|
|
2011-01-12 16:30:57 +00:00
|
|
|
from hscommon import sphinxgen
|
2011-07-21 14:11:51 +00:00
|
|
|
from hscommon.build import (add_to_pythonpath, print_and_do, copy_packages, filereplace,
|
2012-07-28 23:07:37 +00:00
|
|
|
get_module_version, move_all, copy_sysconfig_files_for_embed, copy_all, move, copy,
|
2012-07-28 20:22:51 +00:00
|
|
|
create_osx_app_structure)
|
2011-11-01 19:44:18 +00:00
|
|
|
from hscommon import loc
|
2009-12-30 16:34:41 +00:00
|
|
|
|
2011-01-21 13:39:33 +00:00
|
|
|
def parse_args():
|
|
|
|
usage = "usage: %prog [options]"
|
|
|
|
parser = OptionParser(usage=usage)
|
2011-01-22 16:06:04 +00:00
|
|
|
parser.add_option('--clean', action='store_true', dest='clean',
|
|
|
|
help="Clean build folder before building")
|
2011-06-14 17:43:29 +00:00
|
|
|
parser.add_option('--doc', action='store_true', dest='doc',
|
|
|
|
help="Build only the help file")
|
|
|
|
parser.add_option('--loc', action='store_true', dest='loc',
|
|
|
|
help="Build only localization")
|
2012-07-28 23:07:37 +00:00
|
|
|
parser.add_option('--cocoa-compile', action='store_true', dest='cocoa_compile',
|
|
|
|
help="Build only Cocoa modules and executables")
|
2012-07-20 21:09:43 +00:00
|
|
|
parser.add_option('--xibless', action='store_true', dest='xibless',
|
|
|
|
help="Build only xibless UIs")
|
2011-11-02 19:55:20 +00:00
|
|
|
parser.add_option('--updatepot', action='store_true', dest='updatepot',
|
2011-11-01 19:44:18 +00:00
|
|
|
help="Generate .pot files from source code.")
|
2011-11-02 19:55:20 +00:00
|
|
|
parser.add_option('--mergepot', action='store_true', dest='mergepot',
|
|
|
|
help="Update all .po files based on .pot files.")
|
2011-01-21 13:39:33 +00:00
|
|
|
(options, args) = parser.parse_args()
|
|
|
|
return options
|
|
|
|
|
2012-07-28 23:07:37 +00:00
|
|
|
def cocoa_compile_command(edition):
|
|
|
|
return '{0} waf configure --edition {1} && {0} waf'.format(sys.executable, edition)
|
|
|
|
|
|
|
|
def cocoa_app_path(edition):
|
|
|
|
return {
|
|
|
|
'se': 'build/dupeGuru.app',
|
|
|
|
'me': 'build/dupeGuru ME.app',
|
|
|
|
'pe': 'build/dupeGuru PE.app',
|
|
|
|
}[edition]
|
|
|
|
|
2012-07-21 20:13:16 +00:00
|
|
|
def build_xibless(edition):
|
2012-07-20 21:09:43 +00:00
|
|
|
import xibless
|
2012-07-21 14:39:01 +00:00
|
|
|
if not op.exists('cocoa/autogen'):
|
|
|
|
os.mkdir('cocoa/autogen')
|
2012-07-28 20:49:36 +00:00
|
|
|
xibless.generate('cocoalib/ui/progress.py', 'cocoa/autogen/ProgressController_UI')
|
|
|
|
xibless.generate('cocoalib/ui/about.py', 'cocoa/autogen/HSAboutBox_UI', localizationTable='cocoalib')
|
|
|
|
xibless.generate('cocoalib/ui/fairware_reminder.py', 'cocoa/autogen/HSFairwareReminder_UI', localizationTable='cocoalib')
|
|
|
|
xibless.generate('cocoalib/ui/demo_reminder.py', 'cocoa/autogen/HSDemoReminder_UI', localizationTable='cocoalib')
|
|
|
|
xibless.generate('cocoalib/ui/enter_code.py', 'cocoa/autogen/HSEnterCode_UI', localizationTable='cocoalib')
|
|
|
|
xibless.generate('cocoalib/ui/error_report.py', 'cocoa/autogen/HSErrorReportWindow_UI', localizationTable='cocoalib')
|
2012-07-22 16:46:43 +00:00
|
|
|
xibless.generate('cocoa/base/ui/ignore_list_dialog.py', 'cocoa/autogen/IgnoreListDialog_UI', localizationTable='Localizable')
|
2012-07-23 14:14:50 +00:00
|
|
|
xibless.generate('cocoa/base/ui/deletion_options.py', 'cocoa/autogen/DeletionOptions_UI', localizationTable='Localizable')
|
2012-07-23 15:04:13 +00:00
|
|
|
xibless.generate('cocoa/base/ui/problem_dialog.py', 'cocoa/autogen/ProblemDialog_UI', localizationTable='Localizable')
|
2012-07-23 21:46:01 +00:00
|
|
|
xibless.generate('cocoa/base/ui/directory_panel.py', 'cocoa/autogen/DirectoryPanel_UI', localizationTable='Localizable')
|
2012-07-24 15:31:18 +00:00
|
|
|
xibless.generate('cocoa/base/ui/prioritize_dialog.py', 'cocoa/autogen/PrioritizeDialog_UI', localizationTable='Localizable')
|
2012-07-26 16:18:39 +00:00
|
|
|
xibless.generate('cocoa/base/ui/result_window.py', 'cocoa/autogen/ResultWindow_UI', localizationTable='Localizable')
|
2012-07-29 15:28:39 +00:00
|
|
|
xibless.generate('cocoa/base/ui/main_menu.py', 'cocoa/autogen/MainMenu_UI',
|
|
|
|
localizationTable='Localizable', args={'edition': edition})
|
2012-07-28 23:07:37 +00:00
|
|
|
xibless.generate('cocoa/base/ui/preferences_panel.py', 'cocoa/autogen/PreferencesPanel_UI',
|
|
|
|
localizationTable='Localizable', args={'edition': edition})
|
2012-07-27 19:21:35 +00:00
|
|
|
if edition == 'pe':
|
|
|
|
xibless.generate('cocoa/pe/ui/details_panel.py', 'cocoa/autogen/DetailsPanel_UI', localizationTable='Localizable')
|
|
|
|
else:
|
|
|
|
xibless.generate('cocoa/base/ui/details_panel.py', 'cocoa/autogen/DetailsPanel_UI', localizationTable='Localizable')
|
2012-07-20 21:09:43 +00:00
|
|
|
|
2011-01-11 16:58:28 +00:00
|
|
|
def build_cocoa(edition, dev):
|
2012-07-28 20:22:51 +00:00
|
|
|
ed = lambda s: s.format(edition)
|
2012-07-21 20:13:16 +00:00
|
|
|
build_xibless(edition)
|
2011-12-28 19:51:33 +00:00
|
|
|
build_cocoa_proxy_module()
|
2012-01-16 15:30:45 +00:00
|
|
|
build_cocoa_bridging_interfaces(edition)
|
|
|
|
print("Building the cocoa layer")
|
2012-07-28 22:10:05 +00:00
|
|
|
from pluginbuilder import copy_embeddable_python_dylib, collect_dependencies
|
2012-01-11 17:18:03 +00:00
|
|
|
copy_embeddable_python_dylib('build')
|
|
|
|
if not op.exists('build/py'):
|
|
|
|
os.mkdir('build/py')
|
2012-07-28 20:22:51 +00:00
|
|
|
cocoa_project_path = ed('cocoa/{}')
|
2012-01-13 22:03:00 +00:00
|
|
|
shutil.copy(op.join(cocoa_project_path, 'dg_cocoa.py'), 'build')
|
2012-01-05 22:08:56 +00:00
|
|
|
specific_packages = {
|
|
|
|
'se': ['core_se'],
|
|
|
|
'me': ['core_me'],
|
|
|
|
'pe': ['core_pe'],
|
|
|
|
}[edition]
|
|
|
|
tocopy = ['core', 'hscommon', 'cocoa/inter', 'cocoalib/cocoa'] + specific_packages
|
2012-01-18 17:33:54 +00:00
|
|
|
copy_packages(tocopy, 'build')
|
|
|
|
sys.path.insert(0, 'build')
|
|
|
|
collect_dependencies('build/dg_cocoa.py', 'build/py', excludes=['PyQt4'])
|
|
|
|
del sys.path[0]
|
2012-01-13 22:03:00 +00:00
|
|
|
if dev:
|
|
|
|
copy_packages(tocopy, 'build/py', create_links=True)
|
2012-01-11 20:14:59 +00:00
|
|
|
# Views are not referenced by python code, so they're not found by the collector.
|
|
|
|
copy_all('build/inter/*.so', 'build/py/inter')
|
2012-01-11 17:18:03 +00:00
|
|
|
copy_sysconfig_files_for_embed('build/py')
|
2010-02-09 14:32:52 +00:00
|
|
|
os.chdir(cocoa_project_path)
|
2011-01-13 10:29:01 +00:00
|
|
|
print('Generating Info.plist')
|
2012-07-28 20:22:51 +00:00
|
|
|
app_version = get_module_version(ed('core_{}'))
|
2011-01-13 10:29:01 +00:00
|
|
|
filereplace('InfoTemplate.plist', 'Info.plist', version=app_version)
|
2012-07-28 20:22:51 +00:00
|
|
|
print("Compiling with WAF")
|
|
|
|
os.chdir('..')
|
2012-07-28 23:07:37 +00:00
|
|
|
os.system(cocoa_compile_command(edition))
|
2012-07-28 20:22:51 +00:00
|
|
|
os.chdir('..')
|
|
|
|
print("Creating the .app folder")
|
|
|
|
image_path = ed('cocoa/{}/dupeguru.icns')
|
|
|
|
resources = [image_path, 'cocoa/base/dsa_pub.pem', 'build/dg_cocoa.py',
|
|
|
|
'build/py', 'build/help'] + glob.glob('cocoa/base/*.lproj')
|
|
|
|
frameworks = ['build/Python', 'cocoalib/Sparkle.framework']
|
2012-07-28 23:07:37 +00:00
|
|
|
app_path = cocoa_app_path(edition)
|
2012-07-28 22:10:05 +00:00
|
|
|
create_osx_app_structure(app_path, 'cocoa/build/dupeGuru', ed('cocoa/{}/Info.plist'),
|
|
|
|
resources, frameworks, symlink_resources=dev)
|
|
|
|
print("Creating the run.py file")
|
2010-10-04 13:42:38 +00:00
|
|
|
tmpl = open('run_template_cocoa.py', 'rt').read()
|
2010-10-05 07:27:32 +00:00
|
|
|
run_contents = tmpl.replace('{{app_path}}', app_path)
|
2010-10-04 13:42:38 +00:00
|
|
|
open('run.py', 'wt').write(run_contents)
|
2010-02-09 14:32:52 +00:00
|
|
|
|
|
|
|
def build_qt(edition, dev):
|
2010-08-17 07:30:25 +00:00
|
|
|
print("Building Qt stuff")
|
2010-08-11 14:39:06 +00:00
|
|
|
print_and_do("pyrcc4 -py3 {0} > {1}".format(op.join('qt', 'base', 'dg.qrc'), op.join('qt', 'base', 'dg_rc.py')))
|
2010-10-04 13:42:38 +00:00
|
|
|
print("Creating the run.py file")
|
|
|
|
tmpl = open('run_template_qt.py', 'rt').read()
|
2010-10-05 07:27:32 +00:00
|
|
|
run_contents = tmpl.replace('{{edition}}', edition)
|
2010-10-04 13:42:38 +00:00
|
|
|
open('run.py', 'wt').write(run_contents)
|
2010-08-17 07:30:25 +00:00
|
|
|
|
2011-01-21 13:39:33 +00:00
|
|
|
def build_help(edition):
|
2011-01-11 16:58:28 +00:00
|
|
|
print("Generating Help")
|
2011-01-12 16:30:57 +00:00
|
|
|
current_path = op.abspath('.')
|
|
|
|
help_basepath = op.join(current_path, 'help', 'en')
|
|
|
|
help_destpath = op.join(current_path, 'build', 'help'.format(edition))
|
|
|
|
changelog_path = op.join(current_path, 'help', 'changelog_{}'.format(edition))
|
|
|
|
tixurl = "https://hardcoded.lighthouseapp.com/projects/31699-dupeguru/tickets/{0}"
|
|
|
|
appname = {'se': 'dupeGuru', 'me': 'dupeGuru Music Edition', 'pe': 'dupeGuru Picture Edition'}[edition]
|
|
|
|
homepage = 'http://www.hardcoded.net/dupeguru{}/'.format('_' + edition if edition != 'se' else '')
|
2012-02-01 14:53:24 +00:00
|
|
|
confrepl = {'edition': edition, 'appname': appname, 'homepage': homepage, 'language': 'en'}
|
2012-01-24 13:28:23 +00:00
|
|
|
changelogtmpl = op.join(current_path, 'help', 'changelog.tmpl')
|
|
|
|
conftmpl = op.join(current_path, 'help', 'conf.tmpl')
|
|
|
|
sphinxgen.gen(help_basepath, help_destpath, changelog_path, tixurl, confrepl, conftmpl, changelogtmpl)
|
2011-01-11 16:58:28 +00:00
|
|
|
|
2011-06-14 17:43:29 +00:00
|
|
|
def build_localizations(ui, edition):
|
|
|
|
print("Building localizations")
|
2011-11-01 20:01:34 +00:00
|
|
|
loc.compile_all_po('locale')
|
|
|
|
loc.compile_all_po(op.join('hscommon', 'locale'))
|
|
|
|
loc.merge_locale_dir(op.join('hscommon', 'locale'), 'locale')
|
2011-06-14 17:43:29 +00:00
|
|
|
if ui == 'cocoa':
|
2011-11-02 20:47:56 +00:00
|
|
|
print("Creating lproj folders based on .po files")
|
|
|
|
for lang in loc.get_langs('locale'):
|
|
|
|
if lang == 'en':
|
|
|
|
continue
|
|
|
|
pofile = op.join('locale', lang, 'LC_MESSAGES', 'ui.po')
|
2012-07-27 22:30:34 +00:00
|
|
|
enlproj = op.join('cocoa', 'base', 'en.lproj')
|
|
|
|
dest_lproj = op.join('cocoa', 'base', lang + '.lproj')
|
|
|
|
if not op.exists(dest_lproj):
|
|
|
|
os.makedirs(dest_lproj)
|
|
|
|
loc.po2strings(pofile, op.join(enlproj, 'Localizable.strings'), op.join(dest_lproj, 'Localizable.strings'))
|
2011-11-04 19:17:14 +00:00
|
|
|
pofile = op.join('cocoalib', 'locale', lang, 'LC_MESSAGES', 'cocoalib.po')
|
2012-07-28 20:22:51 +00:00
|
|
|
loc.po2strings(pofile, op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), op.join(dest_lproj, 'cocoalib.strings'))
|
2011-06-14 17:43:29 +00:00
|
|
|
elif ui == 'qt':
|
2011-11-01 20:01:34 +00:00
|
|
|
loc.compile_all_po(op.join('qtlib', 'locale'))
|
|
|
|
loc.merge_locale_dir(op.join('qtlib', 'locale'), 'locale')
|
2012-05-14 12:55:23 +00:00
|
|
|
if op.exists(op.join('build', 'locale')):
|
|
|
|
shutil.rmtree(op.join('build', 'locale'))
|
|
|
|
shutil.copytree('locale', op.join('build', 'locale'), ignore=shutil.ignore_patterns('*.po', '*.pot'))
|
2011-11-01 19:44:18 +00:00
|
|
|
|
2011-11-02 19:55:20 +00:00
|
|
|
def build_updatepot():
|
2011-11-01 19:44:18 +00:00
|
|
|
print("Building .pot files from source files")
|
|
|
|
print("Building core.pot")
|
|
|
|
all_cores = ['core', 'core_se', 'core_me', 'core_pe']
|
|
|
|
loc.generate_pot(all_cores, op.join('locale', 'core.pot'), ['tr'])
|
|
|
|
print("Building columns.pot")
|
|
|
|
loc.generate_pot(all_cores, op.join('locale', 'columns.pot'), ['coltr'])
|
|
|
|
print("Building ui.pot")
|
2011-11-04 15:23:17 +00:00
|
|
|
ui_packages = ['qt', op.join('cocoa', 'inter')]
|
|
|
|
loc.generate_pot(ui_packages, op.join('locale', 'ui.pot'), ['tr'])
|
2011-11-01 19:44:18 +00:00
|
|
|
print("Building hscommon.pot")
|
|
|
|
loc.generate_pot(['hscommon'], op.join('hscommon', 'locale', 'hscommon.pot'), ['tr'])
|
|
|
|
print("Building qtlib.pot")
|
|
|
|
loc.generate_pot(['qtlib'], op.join('qtlib', 'locale', 'qtlib.pot'), ['tr'])
|
2012-02-01 14:45:33 +00:00
|
|
|
print("Building cocoalib.pot")
|
|
|
|
loc.allstrings2pot(op.join('cocoalib', 'en.lproj'), op.join('cocoalib', 'locale', 'cocoalib.pot'))
|
2011-11-02 19:55:20 +00:00
|
|
|
print("Enhancing ui.pot with Cocoa's strings files")
|
|
|
|
loc.allstrings2pot(op.join('cocoa', 'base', 'en.lproj'), op.join('locale', 'ui.pot'),
|
|
|
|
excludes={'core', 'message', 'columns'})
|
|
|
|
loc.allstrings2pot(op.join('cocoa', 'se', 'en.lproj'), op.join('locale', 'ui.pot'))
|
|
|
|
loc.allstrings2pot(op.join('cocoa', 'me', 'en.lproj'), op.join('locale', 'ui.pot'))
|
|
|
|
loc.allstrings2pot(op.join('cocoa', 'pe', 'en.lproj'), op.join('locale', 'ui.pot'))
|
|
|
|
|
|
|
|
def build_mergepot():
|
|
|
|
print("Updating .po files using .pot files")
|
|
|
|
loc.merge_pots_into_pos('locale')
|
2011-11-03 15:12:29 +00:00
|
|
|
loc.merge_pots_into_pos(op.join('hscommon', 'locale'))
|
2012-01-03 22:03:53 +00:00
|
|
|
loc.merge_pots_into_pos(op.join('qtlib', 'locale'))
|
2012-02-01 14:45:33 +00:00
|
|
|
loc.merge_pots_into_pos(op.join('cocoalib', 'locale'))
|
2011-06-14 17:43:29 +00:00
|
|
|
|
2012-01-15 16:00:34 +00:00
|
|
|
def build_cocoa_ext(extname, dest, source_files, extra_frameworks=(), extra_includes=()):
|
2012-01-13 22:03:00 +00:00
|
|
|
extra_link_args = ["-framework", "CoreFoundation", "-framework", "Foundation"]
|
|
|
|
for extra in extra_frameworks:
|
|
|
|
extra_link_args += ['-framework', extra]
|
2012-01-15 16:00:34 +00:00
|
|
|
ext = Extension(extname, source_files, extra_link_args=extra_link_args, include_dirs=extra_includes)
|
2012-01-13 22:03:00 +00:00
|
|
|
setup(script_args=['build_ext', '--inplace'], ext_modules=[ext])
|
|
|
|
fn = extname + '.so'
|
|
|
|
assert op.exists(fn)
|
|
|
|
move(fn, op.join(dest, fn))
|
|
|
|
|
2011-12-28 19:51:33 +00:00
|
|
|
def build_cocoa_proxy_module():
|
|
|
|
print("Building Cocoa Proxy")
|
|
|
|
import objp.p2o
|
2012-01-05 21:57:31 +00:00
|
|
|
objp.p2o.generate_python_proxy_code('cocoalib/cocoa/CocoaProxy.h', 'build/CocoaProxy.m')
|
2012-01-13 22:03:00 +00:00
|
|
|
build_cocoa_ext("CocoaProxy", 'cocoalib/cocoa',
|
2012-07-20 21:09:43 +00:00
|
|
|
['cocoalib/cocoa/CocoaProxy.m', 'build/CocoaProxy.m', 'build/ObjP.m',
|
2012-07-28 20:49:36 +00:00
|
|
|
'cocoalib/HSErrorReportWindow.m', 'cocoa/autogen/HSErrorReportWindow_UI.m'],
|
2012-01-15 16:00:34 +00:00
|
|
|
['AppKit', 'CoreServices'],
|
2012-07-28 20:49:36 +00:00
|
|
|
['cocoalib', 'cocoa/autogen'])
|
2011-12-28 19:51:33 +00:00
|
|
|
|
2012-01-16 15:30:45 +00:00
|
|
|
def build_cocoa_bridging_interfaces(edition):
|
2012-01-11 20:14:59 +00:00
|
|
|
print("Building Cocoa Bridging Interfaces")
|
|
|
|
import objp.o2p
|
|
|
|
import objp.p2o
|
|
|
|
add_to_pythonpath('cocoa')
|
|
|
|
add_to_pythonpath('cocoalib')
|
2012-01-13 20:25:34 +00:00
|
|
|
from cocoa.inter import (PyGUIObject, GUIObjectView, PyColumns, ColumnsView, PyOutline,
|
2012-01-13 19:43:43 +00:00
|
|
|
OutlineView, PySelectableList, SelectableListView, PyTable, TableView, PyFairware)
|
2012-05-30 16:10:56 +00:00
|
|
|
from inter.deletion_options import PyDeletionOptions, DeletionOptionsView
|
2012-01-12 17:34:20 +00:00
|
|
|
from inter.details_panel import PyDetailsPanel, DetailsPanelView
|
2012-01-12 20:19:40 +00:00
|
|
|
from inter.directory_outline import PyDirectoryOutline, DirectoryOutlineView
|
2012-01-12 22:40:23 +00:00
|
|
|
from inter.prioritize_dialog import PyPrioritizeDialog, PrioritizeDialogView
|
|
|
|
from inter.prioritize_list import PyPrioritizeList, PrioritizeListView
|
2012-01-13 17:19:23 +00:00
|
|
|
from inter.problem_dialog import PyProblemDialog
|
2012-03-14 16:47:21 +00:00
|
|
|
from inter.ignore_list_dialog import PyIgnoreListDialog, IgnoreListDialogView
|
2012-01-13 16:49:34 +00:00
|
|
|
from inter.result_table import PyResultTable, ResultTableView
|
2012-01-12 17:34:20 +00:00
|
|
|
from inter.stats_label import PyStatsLabel, StatsLabelView
|
2012-01-13 19:43:43 +00:00
|
|
|
from inter.app import PyDupeGuruBase, DupeGuruView
|
2012-01-16 15:30:45 +00:00
|
|
|
appmod = importlib.import_module('inter.app_{}'.format(edition))
|
2012-01-13 19:43:43 +00:00
|
|
|
allclasses = [PyGUIObject, PyColumns, PyOutline, PySelectableList, PyTable, PyFairware,
|
2012-02-27 14:44:51 +00:00
|
|
|
PyDetailsPanel, PyDirectoryOutline, PyPrioritizeDialog, PyPrioritizeList, PyProblemDialog,
|
2012-05-30 16:10:56 +00:00
|
|
|
PyIgnoreListDialog, PyDeletionOptions, PyResultTable, PyStatsLabel, PyDupeGuruBase,
|
|
|
|
appmod.PyDupeGuru]
|
2012-01-12 22:40:23 +00:00
|
|
|
for class_ in allclasses:
|
2012-01-13 15:20:46 +00:00
|
|
|
objp.o2p.generate_objc_code(class_, 'cocoa/autogen', inherit=True)
|
2012-01-13 17:19:23 +00:00
|
|
|
allclasses = [GUIObjectView, ColumnsView, OutlineView, SelectableListView, TableView,
|
2012-02-27 14:44:51 +00:00
|
|
|
DetailsPanelView, DirectoryOutlineView, PrioritizeDialogView, PrioritizeListView,
|
2012-05-30 16:10:56 +00:00
|
|
|
IgnoreListDialogView, DeletionOptionsView, ResultTableView, StatsLabelView, DupeGuruView]
|
2012-01-15 16:49:04 +00:00
|
|
|
clsspecs = [objp.o2p.spec_from_python_class(class_) for class_ in allclasses]
|
|
|
|
objp.p2o.generate_python_proxy_code_from_clsspec(clsspecs, 'build/CocoaViews.m')
|
|
|
|
build_cocoa_ext('CocoaViews', 'cocoa/inter', ['build/CocoaViews.m', 'build/ObjP.m'])
|
2011-12-28 19:51:33 +00:00
|
|
|
|
2010-08-17 07:30:25 +00:00
|
|
|
def build_pe_modules(ui):
|
|
|
|
print("Building PE Modules")
|
|
|
|
exts = [
|
|
|
|
Extension("_block", [op.join('core_pe', 'modules', 'block.c'), op.join('core_pe', 'modules', 'common.c')]),
|
|
|
|
Extension("_cache", [op.join('core_pe', 'modules', 'cache.c'), op.join('core_pe', 'modules', 'common.c')]),
|
|
|
|
]
|
|
|
|
if ui == 'qt':
|
|
|
|
exts.append(Extension("_block_qt", [op.join('qt', 'pe', 'modules', 'block.c')]))
|
|
|
|
elif ui == 'cocoa':
|
|
|
|
exts.append(Extension(
|
|
|
|
"_block_osx", [op.join('core_pe', 'modules', 'block_osx.m'), op.join('core_pe', 'modules', 'common.c')],
|
|
|
|
extra_link_args=[
|
|
|
|
"-framework", "CoreFoundation",
|
|
|
|
"-framework", "Foundation",
|
|
|
|
"-framework", "ApplicationServices",]
|
|
|
|
))
|
|
|
|
setup(
|
|
|
|
script_args = ['build_ext', '--inplace'],
|
|
|
|
ext_modules = exts,
|
|
|
|
)
|
2011-10-04 13:45:55 +00:00
|
|
|
move_all('_block_qt*', op.join('qt', 'pe'))
|
|
|
|
move_all('_block*', 'core_pe')
|
|
|
|
move_all('_cache*', 'core_pe')
|
2010-02-09 14:32:52 +00:00
|
|
|
|
2011-01-21 13:39:33 +00:00
|
|
|
def build_normal(edition, ui, dev):
|
2010-08-11 14:39:06 +00:00
|
|
|
print("Building dupeGuru {0} with UI {1}".format(edition.upper(), ui))
|
2010-01-01 20:42:52 +00:00
|
|
|
add_to_pythonpath('.')
|
2011-01-22 15:12:18 +00:00
|
|
|
build_help(edition)
|
2011-06-14 17:43:29 +00:00
|
|
|
build_localizations(ui, edition)
|
2010-08-11 14:39:06 +00:00
|
|
|
print("Building dupeGuru")
|
2009-12-30 16:34:41 +00:00
|
|
|
if edition == 'pe':
|
2010-08-17 07:30:25 +00:00
|
|
|
build_pe_modules(ui)
|
2009-12-30 16:34:41 +00:00
|
|
|
if ui == 'cocoa':
|
2011-01-11 16:58:28 +00:00
|
|
|
build_cocoa(edition, dev)
|
2009-12-30 16:34:41 +00:00
|
|
|
elif ui == 'qt':
|
2010-02-09 14:32:52 +00:00
|
|
|
build_qt(edition, dev)
|
2009-12-30 16:34:41 +00:00
|
|
|
|
2011-01-21 13:39:33 +00:00
|
|
|
def main():
|
|
|
|
options = parse_args()
|
|
|
|
conf = json.load(open('conf.json'))
|
|
|
|
edition = conf['edition']
|
|
|
|
ui = conf['ui']
|
|
|
|
dev = conf['dev']
|
|
|
|
if dev:
|
|
|
|
print("Building in Dev mode")
|
2011-01-22 16:06:04 +00:00
|
|
|
if options.clean:
|
|
|
|
if op.exists('build'):
|
|
|
|
shutil.rmtree('build')
|
|
|
|
if not op.exists('build'):
|
|
|
|
os.mkdir('build')
|
2011-06-14 17:43:29 +00:00
|
|
|
if options.doc:
|
2011-01-21 13:39:33 +00:00
|
|
|
build_help(edition)
|
2011-06-14 17:43:29 +00:00
|
|
|
elif options.loc:
|
|
|
|
build_localizations(ui, edition)
|
2011-11-02 19:55:20 +00:00
|
|
|
elif options.updatepot:
|
|
|
|
build_updatepot()
|
|
|
|
elif options.mergepot:
|
|
|
|
build_mergepot()
|
2012-07-28 23:07:37 +00:00
|
|
|
elif options.cocoa_compile:
|
2012-01-15 16:00:34 +00:00
|
|
|
build_cocoa_proxy_module()
|
2012-01-16 15:30:45 +00:00
|
|
|
build_cocoa_bridging_interfaces(edition)
|
2012-07-28 23:07:37 +00:00
|
|
|
os.chdir('cocoa')
|
|
|
|
os.system(cocoa_compile_command(edition))
|
|
|
|
os.chdir('..')
|
|
|
|
copy('cocoa/build/dupeGuru', op.join(cocoa_app_path(edition), 'Contents/MacOS/dupeGuru'))
|
2012-07-20 21:09:43 +00:00
|
|
|
elif options.xibless:
|
2012-07-21 20:13:16 +00:00
|
|
|
build_xibless(edition)
|
2011-01-21 13:39:33 +00:00
|
|
|
else:
|
|
|
|
build_normal(edition, ui, dev)
|
|
|
|
|
2009-12-30 16:34:41 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|