2016-06-01 00:21:07 +00:00
|
|
|
# Copyright 2016 Hardcoded Software (http://www.hardcoded.net)
|
2014-10-05 20:31:16 +00:00
|
|
|
#
|
2015-01-03 21:33:16 +00:00
|
|
|
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
2014-10-05 20:31:16 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2015-01-03 21:33:16 +00:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
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
|
2012-01-16 15:30:45 +00:00
|
|
|
import importlib
|
2012-09-10 19:37:57 +00:00
|
|
|
import compileall
|
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
|
2014-10-13 19:08:59 +00:00
|
|
|
from hscommon.build import (
|
|
|
|
add_to_pythonpath, print_and_do, copy_packages, filereplace,
|
2013-12-07 22:23:18 +00:00
|
|
|
get_module_version, move_all, copy_all, OSXAppStructure,
|
2012-09-10 19:37:57 +00:00
|
|
|
build_cocoalib_xibless, fix_qt_resource_file, build_cocoa_ext, copy_embeddable_python_dylib,
|
2016-06-01 00:21:07 +00:00
|
|
|
collect_stdlib_dependencies
|
2014-10-13 19:08:59 +00:00
|
|
|
)
|
2011-11-01 19:44:18 +00:00
|
|
|
from hscommon import loc
|
2016-06-01 00:21:07 +00:00
|
|
|
from hscommon.plat import ISOSX
|
2012-09-10 19:37:57 +00:00
|
|
|
from hscommon.util import ensure_folder, delete_files_with_pattern
|
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)
|
2014-10-13 19:08:59 +00:00
|
|
|
parser.add_option(
|
|
|
|
'--clean', action='store_true', dest='clean',
|
|
|
|
help="Clean build folder before building"
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--doc', action='store_true', dest='doc',
|
|
|
|
help="Build only the help file"
|
|
|
|
)
|
2016-06-01 00:21:07 +00:00
|
|
|
parser.add_option(
|
|
|
|
'--ui', dest='ui',
|
|
|
|
help="Type of UI to build. 'qt' or 'cocoa'. Default is determined by your system."
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--dev', action='store_true', dest='dev', default=False,
|
|
|
|
help="If this flag is set, will configure for dev builds."
|
|
|
|
)
|
2014-10-13 19:08:59 +00:00
|
|
|
parser.add_option(
|
|
|
|
'--loc', action='store_true', dest='loc',
|
|
|
|
help="Build only localization"
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--cocoa-ext', action='store_true', dest='cocoa_ext',
|
|
|
|
help="Build only Cocoa extensions"
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--cocoa-compile', action='store_true', dest='cocoa_compile',
|
|
|
|
help="Build only Cocoa executable"
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--xibless', action='store_true', dest='xibless',
|
|
|
|
help="Build only xibless UIs"
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--updatepot', action='store_true', dest='updatepot',
|
|
|
|
help="Generate .pot files from source code."
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--mergepot', action='store_true', dest='mergepot',
|
|
|
|
help="Update all .po files based on .pot files."
|
|
|
|
)
|
|
|
|
parser.add_option(
|
|
|
|
'--normpo', action='store_true', dest='normpo',
|
|
|
|
help="Normalize all PO files (do this before commit)."
|
|
|
|
)
|
2011-01-21 13:39:33 +00:00
|
|
|
(options, args) = parser.parse_args()
|
|
|
|
return options
|
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def cocoa_app():
|
|
|
|
app_path = 'build/dupeGuru.app'
|
2012-08-02 16:49:49 +00:00
|
|
|
return OSXAppStructure(app_path)
|
2012-07-28 23:07:37 +00:00
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def build_xibless(dest='cocoa/autogen'):
|
2012-08-01 20:34:12 +00:00
|
|
|
import xibless
|
|
|
|
ensure_folder(dest)
|
|
|
|
FNPAIRS = [
|
|
|
|
('ignore_list_dialog.py', 'IgnoreListDialog_UI'),
|
|
|
|
('deletion_options.py', 'DeletionOptions_UI'),
|
|
|
|
('problem_dialog.py', 'ProblemDialog_UI'),
|
|
|
|
('directory_panel.py', 'DirectoryPanel_UI'),
|
|
|
|
('prioritize_dialog.py', 'PrioritizeDialog_UI'),
|
|
|
|
('result_window.py', 'ResultWindow_UI'),
|
|
|
|
('main_menu.py', 'MainMenu_UI'),
|
|
|
|
('preferences_panel.py', 'PreferencesPanel_UI'),
|
|
|
|
]
|
|
|
|
for srcname, dstname in FNPAIRS:
|
2014-10-13 19:08:59 +00:00
|
|
|
xibless.generate(
|
|
|
|
op.join('cocoa', 'base', 'ui', srcname), op.join(dest, dstname),
|
|
|
|
localizationTable='Localizable'
|
|
|
|
)
|
2016-06-01 00:21:07 +00:00
|
|
|
# XXX This is broken
|
|
|
|
assert False
|
|
|
|
# if edition == 'pe':
|
|
|
|
# xibless.generate(
|
|
|
|
# 'cocoa/pe/ui/details_panel.py', op.join(dest, 'DetailsPanel_UI'),
|
|
|
|
# localizationTable='Localizable'
|
|
|
|
# )
|
|
|
|
# else:
|
|
|
|
# xibless.generate(
|
|
|
|
# 'cocoa/base/ui/details_panel.py', op.join(dest, 'DetailsPanel_UI'),
|
|
|
|
# localizationTable='Localizable'
|
|
|
|
# )
|
2012-07-20 21:09:43 +00:00
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def build_cocoa(dev):
|
2012-08-02 16:49:49 +00:00
|
|
|
print("Creating OS X app structure")
|
2016-06-01 00:21:07 +00:00
|
|
|
app = cocoa_app()
|
2016-06-01 02:32:37 +00:00
|
|
|
app_version = get_module_version('core')
|
2016-06-01 00:21:07 +00:00
|
|
|
cocoa_project_path = 'cocoa/se'
|
2012-08-02 16:49:49 +00:00
|
|
|
filereplace(op.join(cocoa_project_path, 'InfoTemplate.plist'), op.join('build', 'Info.plist'), version=app_version)
|
|
|
|
app.create(op.join('build', 'Info.plist'))
|
|
|
|
print("Building localizations")
|
2016-06-01 00:21:07 +00:00
|
|
|
build_localizations('cocoa')
|
2012-08-02 16:49:49 +00:00
|
|
|
print("Building xibless UIs")
|
2012-08-01 20:34:12 +00:00
|
|
|
build_cocoalib_xibless()
|
2016-06-01 00:21:07 +00:00
|
|
|
build_xibless()
|
2012-08-02 16:49:49 +00:00
|
|
|
print("Building Python extensions")
|
2011-12-28 19:51:33 +00:00
|
|
|
build_cocoa_proxy_module()
|
2016-06-01 00:21:07 +00:00
|
|
|
build_cocoa_bridging_interfaces()
|
2012-01-16 15:30:45 +00:00
|
|
|
print("Building the cocoa layer")
|
2012-01-11 17:18:03 +00:00
|
|
|
copy_embeddable_python_dylib('build')
|
2012-08-02 19:23:17 +00:00
|
|
|
pydep_folder = op.join(app.resources, 'py')
|
|
|
|
if not op.exists(pydep_folder):
|
|
|
|
os.mkdir(pydep_folder)
|
2012-01-13 22:03:00 +00:00
|
|
|
shutil.copy(op.join(cocoa_project_path, 'dg_cocoa.py'), 'build')
|
2014-10-05 20:31:16 +00:00
|
|
|
tocopy = [
|
2016-06-01 02:32:37 +00:00
|
|
|
'core', 'hscommon', 'cocoa/inter', 'cocoalib/cocoa', 'objp', 'send2trash', 'hsaudiotag',
|
2016-06-05 17:18:33 +00:00
|
|
|
]
|
2012-09-14 16:55:53 +00:00
|
|
|
copy_packages(tocopy, pydep_folder, create_links=dev)
|
2012-01-18 17:33:54 +00:00
|
|
|
sys.path.insert(0, 'build')
|
2016-06-01 00:21:07 +00:00
|
|
|
# ModuleFinder can't seem to correctly detect the multiprocessing dependency, so we have
|
|
|
|
# to manually specify it.
|
|
|
|
extra_deps = ['multiprocessing']
|
2013-05-05 15:37:28 +00:00
|
|
|
collect_stdlib_dependencies('build/dg_cocoa.py', pydep_folder, extra_deps=extra_deps)
|
2012-01-18 17:33:54 +00:00
|
|
|
del sys.path[0]
|
2012-01-11 20:14:59 +00:00
|
|
|
# Views are not referenced by python code, so they're not found by the collector.
|
2012-08-02 19:23:17 +00:00
|
|
|
copy_all('build/inter/*.so', op.join(pydep_folder, 'inter'))
|
2012-09-14 16:55:53 +00:00
|
|
|
if not dev:
|
|
|
|
# Important: Don't ever run delete_files_with_pattern('*.py') on dev builds because you'll
|
|
|
|
# be deleting all py files in symlinked folders.
|
|
|
|
compileall.compile_dir(pydep_folder, force=True, legacy=True)
|
|
|
|
delete_files_with_pattern(pydep_folder, '*.py')
|
|
|
|
delete_files_with_pattern(pydep_folder, '__pycache__')
|
2012-07-28 20:22:51 +00:00
|
|
|
print("Compiling with WAF")
|
2012-08-02 16:49:49 +00:00
|
|
|
os.chdir('cocoa')
|
2016-06-01 00:21:07 +00:00
|
|
|
print_and_do('{0} waf configure && {0} waf'.format(sys.executable))
|
2012-07-28 20:22:51 +00:00
|
|
|
os.chdir('..')
|
2012-08-02 16:49:49 +00:00
|
|
|
app.copy_executable('cocoa/build/dupeGuru')
|
2016-06-01 00:21:07 +00:00
|
|
|
build_help()
|
2012-08-02 16:49:49 +00:00
|
|
|
print("Copying resources and frameworks")
|
2016-06-01 00:21:07 +00:00
|
|
|
image_path = 'cocoa/se/dupeguru.icns'
|
2012-08-02 19:23:17 +00:00
|
|
|
resources = [image_path, 'cocoa/base/dsa_pub.pem', 'build/dg_cocoa.py', 'build/help']
|
2012-08-02 16:49:49 +00:00
|
|
|
app.copy_resources(*resources, use_symlinks=dev)
|
|
|
|
app.copy_frameworks('build/Python', 'cocoalib/Sparkle.framework')
|
2012-07-28 22:10:05 +00:00
|
|
|
print("Creating the run.py file")
|
2012-08-15 14:33:01 +00:00
|
|
|
tmpl = open('cocoa/run_template.py', 'rt').read()
|
2012-08-02 16:49:49 +00:00
|
|
|
run_contents = tmpl.replace('{{app_path}}', app.dest)
|
2010-10-04 13:42:38 +00:00
|
|
|
open('run.py', 'wt').write(run_contents)
|
2010-02-09 14:32:52 +00:00
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def build_qt(dev):
|
2012-08-02 16:49:49 +00:00
|
|
|
print("Building localizations")
|
2016-06-01 00:21:07 +00:00
|
|
|
build_localizations('qt')
|
2010-08-17 07:30:25 +00:00
|
|
|
print("Building Qt stuff")
|
2016-06-01 01:59:31 +00:00
|
|
|
print_and_do("pyrcc5 {0} > {1}".format(op.join('qt', 'dg.qrc'), op.join('qt', 'dg_rc.py')))
|
|
|
|
fix_qt_resource_file(op.join('qt', 'dg_rc.py'))
|
2016-06-01 00:21:07 +00:00
|
|
|
build_help()
|
2010-10-04 13:42:38 +00:00
|
|
|
print("Creating the run.py file")
|
2016-06-01 00:21:07 +00:00
|
|
|
shutil.copy(op.join('qt', 'run_template.py'), 'run.py')
|
2010-08-17 07:30:25 +00:00
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def build_help():
|
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')
|
2016-06-01 00:21:07 +00:00
|
|
|
help_destpath = op.join(current_path, 'build', 'help')
|
|
|
|
changelog_path = op.join(current_path, 'help', 'changelog_se')
|
2013-07-28 19:11:39 +00:00
|
|
|
tixurl = "https://github.com/hsoft/dupeguru/issues/{}"
|
2016-06-01 00:21:07 +00:00
|
|
|
appname = 'dupeGuru'
|
|
|
|
homepage = 'https://www.hardcoded.net/dupeguru/'
|
|
|
|
confrepl = {'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
|
|
|
|
2012-08-02 16:49:49 +00:00
|
|
|
def build_qt_localizations():
|
|
|
|
loc.compile_all_po(op.join('qtlib', 'locale'))
|
|
|
|
loc.merge_locale_dir(op.join('qtlib', 'locale'), 'locale')
|
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def build_localizations(ui):
|
2013-11-30 23:23:42 +00:00
|
|
|
loc.compile_all_po('locale')
|
2011-06-14 17:43:29 +00:00
|
|
|
if ui == 'cocoa':
|
2016-06-01 00:21:07 +00:00
|
|
|
app = cocoa_app()
|
2012-09-10 14:14:50 +00:00
|
|
|
loc.build_cocoa_localizations(app, en_stringsfile=op.join('cocoa', 'base', 'en.lproj', 'Localizable.strings'))
|
|
|
|
locale_dest = op.join(app.resources, 'locale')
|
2011-06-14 17:43:29 +00:00
|
|
|
elif ui == 'qt':
|
2012-08-02 16:49:49 +00:00
|
|
|
build_qt_localizations()
|
2012-08-02 19:30:20 +00:00
|
|
|
locale_dest = op.join('build', 'locale')
|
2012-08-02 16:49:49 +00:00
|
|
|
if op.exists(locale_dest):
|
|
|
|
shutil.rmtree(locale_dest)
|
|
|
|
shutil.copytree('locale', locale_dest, 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():
|
2012-08-01 20:34:12 +00:00
|
|
|
if ISOSX:
|
|
|
|
print("Updating Cocoa strings file.")
|
|
|
|
build_cocoalib_xibless('cocoalib/autogen')
|
|
|
|
loc.generate_cocoa_strings_from_code('cocoalib', 'cocoalib/en.lproj')
|
2016-06-01 00:21:07 +00:00
|
|
|
build_xibless('se', op.join('cocoa', 'autogen', 'se'))
|
2012-08-01 20:34:12 +00:00
|
|
|
loc.generate_cocoa_strings_from_code('cocoa', 'cocoa/base/en.lproj')
|
2011-11-01 19:44:18 +00:00
|
|
|
print("Building .pot files from source files")
|
|
|
|
print("Building core.pot")
|
2016-06-01 02:32:37 +00:00
|
|
|
loc.generate_pot(['core'], op.join('locale', 'core.pot'), ['tr'])
|
2011-11-01 19:44:18 +00:00
|
|
|
print("Building columns.pot")
|
2016-06-01 02:32:37 +00:00
|
|
|
loc.generate_pot(['core'], op.join('locale', 'columns.pot'), ['coltr'])
|
2011-11-01 19:44:18 +00:00
|
|
|
print("Building ui.pot")
|
2013-03-24 14:59:41 +00:00
|
|
|
# When we're not under OS X, we don't want to overwrite ui.pot because it contains Cocoa locs
|
|
|
|
# We want to merge the generated pot with the old pot in the most preserving way possible.
|
2011-11-04 15:23:17 +00:00
|
|
|
ui_packages = ['qt', op.join('cocoa', 'inter')]
|
2013-03-24 14:59:41 +00:00
|
|
|
loc.generate_pot(ui_packages, op.join('locale', 'ui.pot'), ['tr'], merge=(not ISOSX))
|
2011-11-01 19:44:18 +00:00
|
|
|
print("Building qtlib.pot")
|
|
|
|
loc.generate_pot(['qtlib'], op.join('qtlib', 'locale', 'qtlib.pot'), ['tr'])
|
2012-08-01 20:34:12 +00:00
|
|
|
if ISOSX:
|
|
|
|
print("Building cocoalib.pot")
|
|
|
|
cocoalib_pot = op.join('cocoalib', 'locale', 'cocoalib.pot')
|
|
|
|
os.remove(cocoalib_pot)
|
|
|
|
loc.strings2pot(op.join('cocoalib', 'en.lproj', 'cocoalib.strings'), cocoalib_pot)
|
|
|
|
print("Enhancing ui.pot with Cocoa's strings files")
|
2014-10-13 19:08:59 +00:00
|
|
|
loc.strings2pot(
|
|
|
|
op.join('cocoa', 'base', 'en.lproj', 'Localizable.strings'),
|
|
|
|
op.join('locale', 'ui.pot')
|
|
|
|
)
|
2011-11-02 19:55:20 +00:00
|
|
|
|
|
|
|
def build_mergepot():
|
|
|
|
print("Updating .po files using .pot files")
|
|
|
|
loc.merge_pots_into_pos('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
|
|
|
|
2013-08-03 21:13:24 +00:00
|
|
|
def build_normpo():
|
|
|
|
loc.normalize_all_pos('locale')
|
|
|
|
loc.normalize_all_pos(op.join('qtlib', 'locale'))
|
|
|
|
loc.normalize_all_pos(op.join('cocoalib', 'locale'))
|
|
|
|
|
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')
|
2014-10-13 19:08:59 +00:00
|
|
|
build_cocoa_ext(
|
|
|
|
"CocoaProxy", 'cocoalib/cocoa',
|
|
|
|
[
|
|
|
|
'cocoalib/cocoa/CocoaProxy.m', 'build/CocoaProxy.m', 'build/ObjP.m',
|
|
|
|
'cocoalib/HSErrorReportWindow.m', 'cocoa/autogen/HSErrorReportWindow_UI.m'
|
|
|
|
],
|
2012-01-15 16:00:34 +00:00
|
|
|
['AppKit', 'CoreServices'],
|
2014-10-13 19:08:59 +00:00
|
|
|
['cocoalib', 'cocoa/autogen']
|
|
|
|
)
|
2011-12-28 19:51:33 +00:00
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def build_cocoa_bridging_interfaces():
|
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')
|
2014-10-13 19:08:59 +00:00
|
|
|
from cocoa.inter import (
|
|
|
|
PyGUIObject, GUIObjectView, PyColumns, ColumnsView, PyOutline,
|
2013-08-03 20:27:36 +00:00
|
|
|
OutlineView, PySelectableList, SelectableListView, PyTable, TableView, PyBaseApp,
|
2014-10-13 19:08:59 +00:00
|
|
|
PyTextField, ProgressWindowView, PyProgressWindow
|
|
|
|
)
|
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
|
2016-06-01 00:21:07 +00:00
|
|
|
appmod = importlib.import_module('inter.app_se')
|
2014-10-13 19:08:59 +00:00
|
|
|
allclasses = [
|
|
|
|
PyGUIObject, PyColumns, PyOutline, PySelectableList, PyTable, PyBaseApp,
|
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,
|
2014-10-13 19:08:59 +00:00
|
|
|
PyTextField, PyProgressWindow, 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)
|
2014-10-13 19:08:59 +00:00
|
|
|
allclasses = [
|
|
|
|
GUIObjectView, ColumnsView, OutlineView, SelectableListView, TableView,
|
2012-02-27 14:44:51 +00:00
|
|
|
DetailsPanelView, DirectoryOutlineView, PrioritizeDialogView, PrioritizeListView,
|
2013-08-03 20:27:36 +00:00
|
|
|
IgnoreListDialogView, DeletionOptionsView, ResultTableView, StatsLabelView,
|
2014-10-13 19:08:59 +00:00
|
|
|
ProgressWindowView, 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 = [
|
2016-06-01 02:32:37 +00:00
|
|
|
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')]
|
|
|
|
),
|
2010-08-17 07:30:25 +00:00
|
|
|
]
|
|
|
|
if ui == 'qt':
|
|
|
|
exts.append(Extension("_block_qt", [op.join('qt', 'pe', 'modules', 'block.c')]))
|
|
|
|
elif ui == 'cocoa':
|
|
|
|
exts.append(Extension(
|
2016-06-01 02:32:37 +00:00
|
|
|
"_block_osx",
|
|
|
|
[op.join('core', 'pe', 'modules', 'block_osx.m'), op.join('core', 'pe', 'modules', 'common.c')],
|
2010-08-17 07:30:25 +00:00
|
|
|
extra_link_args=[
|
|
|
|
"-framework", "CoreFoundation",
|
|
|
|
"-framework", "Foundation",
|
2014-10-13 19:08:59 +00:00
|
|
|
"-framework", "ApplicationServices",
|
|
|
|
]
|
2010-08-17 07:30:25 +00:00
|
|
|
))
|
|
|
|
setup(
|
2014-10-13 19:08:59 +00:00
|
|
|
script_args=['build_ext', '--inplace'],
|
|
|
|
ext_modules=exts,
|
2010-08-17 07:30:25 +00:00
|
|
|
)
|
2011-10-04 13:45:55 +00:00
|
|
|
move_all('_block_qt*', op.join('qt', 'pe'))
|
2016-06-01 02:32:37 +00:00
|
|
|
move_all('_block*', op.join('core', 'pe'))
|
|
|
|
move_all('_cache*', op.join('core', 'pe'))
|
2010-02-09 14:32:52 +00:00
|
|
|
|
2016-06-01 00:21:07 +00:00
|
|
|
def build_normal(ui, dev):
|
|
|
|
print("Building dupeGuru with UI {}".format(ui))
|
2010-01-01 20:42:52 +00:00
|
|
|
add_to_pythonpath('.')
|
2010-08-11 14:39:06 +00:00
|
|
|
print("Building dupeGuru")
|
2016-06-01 00:21:07 +00:00
|
|
|
build_pe_modules(ui)
|
2009-12-30 16:34:41 +00:00
|
|
|
if ui == 'cocoa':
|
2016-06-01 00:21:07 +00:00
|
|
|
build_cocoa(dev)
|
2009-12-30 16:34:41 +00:00
|
|
|
elif ui == 'qt':
|
2016-06-01 00:21:07 +00:00
|
|
|
build_qt(dev)
|
2009-12-30 16:34:41 +00:00
|
|
|
|
2011-01-21 13:39:33 +00:00
|
|
|
def main():
|
|
|
|
options = parse_args()
|
2016-06-01 00:21:07 +00:00
|
|
|
ui = options.ui
|
|
|
|
if ui not in ('cocoa', 'qt'):
|
|
|
|
ui = 'cocoa' if ISOSX else 'qt'
|
|
|
|
if options.dev:
|
2011-01-21 13:39:33 +00:00
|
|
|
print("Building in Dev mode")
|
2011-01-22 16:06:04 +00:00
|
|
|
if options.clean:
|
2013-12-07 16:14:59 +00:00
|
|
|
for path in ['build', op.join('cocoa', 'build'), op.join('cocoa', 'autogen')]:
|
|
|
|
if op.exists(path):
|
|
|
|
shutil.rmtree(path)
|
2011-01-22 16:06:04 +00:00
|
|
|
if not op.exists('build'):
|
|
|
|
os.mkdir('build')
|
2011-06-14 17:43:29 +00:00
|
|
|
if options.doc:
|
2016-06-01 00:21:07 +00:00
|
|
|
build_help()
|
2011-06-14 17:43:29 +00:00
|
|
|
elif options.loc:
|
2016-06-01 00:21:07 +00:00
|
|
|
build_localizations(ui)
|
2011-11-02 19:55:20 +00:00
|
|
|
elif options.updatepot:
|
|
|
|
build_updatepot()
|
|
|
|
elif options.mergepot:
|
|
|
|
build_mergepot()
|
2013-08-03 21:13:24 +00:00
|
|
|
elif options.normpo:
|
|
|
|
build_normpo()
|
2012-08-01 20:34:12 +00:00
|
|
|
elif options.cocoa_ext:
|
2012-01-15 16:00:34 +00:00
|
|
|
build_cocoa_proxy_module()
|
2016-06-01 00:21:07 +00:00
|
|
|
build_cocoa_bridging_interfaces()
|
2012-08-01 20:34:12 +00:00
|
|
|
elif options.cocoa_compile:
|
2012-07-28 23:07:37 +00:00
|
|
|
os.chdir('cocoa')
|
2016-06-01 00:21:07 +00:00
|
|
|
print_and_do('{0} waf configure && {0} waf'.format(sys.executable))
|
2012-07-28 23:07:37 +00:00
|
|
|
os.chdir('..')
|
2016-06-01 00:21:07 +00:00
|
|
|
cocoa_app().copy_executable('cocoa/build/dupeGuru')
|
2012-07-20 21:09:43 +00:00
|
|
|
elif options.xibless:
|
2012-08-01 20:34:12 +00:00
|
|
|
build_cocoalib_xibless()
|
2016-06-01 00:21:07 +00:00
|
|
|
build_xibless()
|
2011-01-21 13:39:33 +00:00
|
|
|
else:
|
2016-06-01 00:21:07 +00:00
|
|
|
build_normal(ui, options.dev)
|
2011-01-21 13:39:33 +00:00
|
|
|
|
2009-12-30 16:34:41 +00:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|