diff --git a/.hgignore b/.hgignore index a55e174d..797ee69c 100644 --- a/.hgignore +++ b/.hgignore @@ -1,19 +1,15 @@ syntax: glob +.DS_Store *.pyc +*.so conf.yaml -cocoa/se/Info.plist -cocoa/me/Info.plist -cocoa/pe/Info.plist -cocoa/se/build -cocoa/me/build -cocoa/pe/build -cocoa/se/py/build -cocoa/me/py/build -cocoa/pe/py/build -cocoa/se/py/dist -cocoa/me/py/dist -cocoa/pe/py/dist +build +core_pe/modules/block/block.c +core_pe/modules/cache/cache.c +cocoa/*/Info.plist +cocoa/*/build +cocoa/*/dg_cocoa.plugin qt/base/*_rc.py qt/base/*_ui.py qt/se/*_ui.py diff --git a/build.py b/build.py index 37f82045..43c24525 100644 --- a/build.py +++ b/build.py @@ -11,10 +11,13 @@ import sys import os import os.path as op +import shutil +from setuptools import setup import yaml -from hsutil.build import move_testdata_out, put_testdata_back, add_to_pythonpath +from hsdocgen import generate_help, filters +from hsutil.build import add_to_pythonpath, print_and_do, build_all_qt_ui, copy_packages def main(): conf = yaml.load(open('conf.yaml')) @@ -22,20 +25,17 @@ def main(): ui = conf['ui'] dev = conf['dev'] print "Building dupeGuru {0} with UI {1}".format(edition.upper(), ui) - add_to_pythonpath('.') if dev: print "Building in Dev mode" + add_to_pythonpath('.') print "Generating Help" - windows = sys.platform=='win32' - if edition == 'se': - import help_se.gen - help_se.gen.generate(windows=windows, force_render=not dev) - elif edition == 'me': - import help_me.gen - help_me.gen.generate(windows=windows, force_render=not dev) - elif edition == 'pe': - import help_pe.gen - help_pe.gen.generate(windows=windows, force_render=not dev) + windows = sys.platform == 'win32' + tix = filters.tixgen("https://hardcoded.lighthouseapp.com/projects/31699-dupeguru/tickets/{0}") + help_dir = 'help_{0}'.format(edition) + dest_dir = 'dupeguru_{0}_help'.format(edition) if edition != 'se' else 'dupeguru_help' + help_basepath = op.abspath(help_dir) + help_destpath = op.abspath(op.join(help_dir, dest_dir)) + generate_help.main(help_basepath, help_destpath, force_render=not dev, tix=tix, windows=windows) print "Building dupeGuru" if edition == 'pe': @@ -43,16 +43,44 @@ def main(): os.system('python gen.py') os.chdir('..') if ui == 'cocoa': - move_log = move_testdata_out() - try: - os.chdir(op.join('cocoa', edition)) - if dev: - os.system('python gen.py --dev') - else: - os.system('python gen.py') - os.chdir(op.join('..', '..')) - finally: - put_testdata_back(move_log) + if not dev: + print "Building help index" + os.system('open /Developer/Applications/Utilities/Help\\ Indexer.app --args {0}'.format(help_destpath)) + + print "Building dg_cocoa.plugin" + if op.exists('build'): + shutil.rmtree('build') + os.mkdir('build') + if not dev: + specific_packages = { + 'se': ['core_se'], + 'me': ['core_me', 'hsmedia'], + 'pe': ['core_pe'], + }[edition] + copy_packages(['core', 'hsutil'] + specific_packages, 'build') + cocoa_project_path = 'cocoa/{0}'.format(edition) + shutil.copy(op.join(cocoa_project_path, 'dg_cocoa.py'), 'build') + os.chdir('build') + script_args = ['py2app', '-A'] if dev else ['py2app'] + setup( + script_args = script_args, + plugin = ['dg_cocoa.py'], + setup_requires = ['py2app'], + ) + os.chdir('..') + pluginpath = op.join(cocoa_project_path, 'dg_cocoa.plugin') + if op.exists(pluginpath): + shutil.rmtree(pluginpath) + shutil.move('build/dist/dg_cocoa.plugin', pluginpath) + if dev: + # In alias mode, the tweakings we do to the pythonpath aren't counted in. We have to + # manually put a .pth in the plugin + pthpath = op.join(pluginpath, 'Contents/Resources/dev.pth') + open(pthpath, 'w').write(op.abspath('.')) + os.chdir(cocoa_project_path) + print "Building the XCode project" + os.system('xcodebuild') + os.chdir('..') elif ui == 'qt': os.chdir(op.join('qt', edition)) os.system('python gen.py') diff --git a/cocoa/me/py/dg_cocoa.py b/cocoa/me/dg_cocoa.py similarity index 100% rename from cocoa/me/py/dg_cocoa.py rename to cocoa/me/dg_cocoa.py diff --git a/cocoa/me/dupeguru.xcodeproj/project.pbxproj b/cocoa/me/dupeguru.xcodeproj/project.pbxproj index 556e626e..7cc4bc5d 100644 --- a/cocoa/me/dupeguru.xcodeproj/project.pbxproj +++ b/cocoa/me/dupeguru.xcodeproj/project.pbxproj @@ -88,7 +88,7 @@ CE381C9509914ACE003581CE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; }; CE381C9A09914ADF003581CE /* ResultWindow.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = ResultWindow.m; sourceTree = SOURCE_ROOT; }; CE381C9B09914ADF003581CE /* ResultWindow.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = ResultWindow.h; sourceTree = SOURCE_ROOT; }; - CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dg_cocoa.plugin; path = py/dist/dg_cocoa.plugin; sourceTree = SOURCE_ROOT; }; + CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dg_cocoa.plugin; path = dg_cocoa.plugin; sourceTree = SOURCE_ROOT; }; CE3FBDD11094637800B72D77 /* DetailsPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DetailsPanel.xib; path = ../../base/xib/DetailsPanel.xib; sourceTree = ""; }; CE3FBDD21094637800B72D77 /* DirectoryPanel.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = DirectoryPanel.xib; path = ../../base/xib/DirectoryPanel.xib; sourceTree = ""; }; CE49DEF20FDFEB810098617B /* BRSingleLineFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BRSingleLineFormatter.h; path = ../../cocoalib/brsinglelineformatter/BRSingleLineFormatter.h; sourceTree = SOURCE_ROOT; }; diff --git a/cocoa/me/gen.py b/cocoa/me/gen.py deleted file mode 100644 index 5f3cb135..00000000 --- a/cocoa/me/gen.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -import os.path as op -import os -import shutil -from optparse import OptionParser - -def main(dev): - if not dev: - print "Building help index" - help_path = op.abspath('../../help_me/dupeguru_me_help') - os.system('open /Developer/Applications/Utilities/Help\\ Indexer.app --args {0}'.format(help_path)) - - print "Building dg_cocoa.plugin" - if op.exists('py/build'): - shutil.rmtree('py/build') - if op.exists('py/dist'): - shutil.rmtree('py/dist') - - os.chdir('py') - if dev: - os.system('python -u setup.py py2app -A') - else: - os.system('python -u setup.py py2app') - os.chdir('..') - - print "Building the XCode project" - os.system('xcodebuild') - -if __name__ == '__main__': - usage = "usage: %prog [options]" - parser = OptionParser(usage=usage) - parser.add_option('--dev', action='store_true', dest='dev', default=False, - help="If this flag is set, will configure for dev builds.") - (options, args) = parser.parse_args() - main(options.dev) \ No newline at end of file diff --git a/cocoa/me/py/setup.py b/cocoa/me/py/setup.py deleted file mode 100644 index 472ee4be..00000000 --- a/cocoa/me/py/setup.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -import os.path as op -import sys -sys.path.insert(0, op.abspath('../../..')) # for all cross-toolkit modules - -from distutils.core import setup -import py2app - -setup( - plugin = ['dg_cocoa.py'], -) diff --git a/cocoa/pe/py/dg_cocoa.py b/cocoa/pe/dg_cocoa.py similarity index 100% rename from cocoa/pe/py/dg_cocoa.py rename to cocoa/pe/dg_cocoa.py diff --git a/cocoa/pe/dupeguru.xcodeproj/project.pbxproj b/cocoa/pe/dupeguru.xcodeproj/project.pbxproj index 2c7ea589..8a6c786d 100644 --- a/cocoa/pe/dupeguru.xcodeproj/project.pbxproj +++ b/cocoa/pe/dupeguru.xcodeproj/project.pbxproj @@ -84,7 +84,7 @@ CE381C9509914ACE003581CE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; }; CE381C9A09914ADF003581CE /* ResultWindow.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = ResultWindow.m; sourceTree = SOURCE_ROOT; }; CE381C9B09914ADF003581CE /* ResultWindow.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = ResultWindow.h; sourceTree = SOURCE_ROOT; }; - CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dg_cocoa.plugin; path = py/dist/dg_cocoa.plugin; sourceTree = SOURCE_ROOT; }; + CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dg_cocoa.plugin; path = dg_cocoa.plugin; sourceTree = SOURCE_ROOT; }; CE6044EA0FE6796200B71262 /* DetailsPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetailsPanel.h; path = ../base/DetailsPanel.h; sourceTree = SOURCE_ROOT; }; CE6044EB0FE6796200B71262 /* DetailsPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DetailsPanel.m; path = ../base/DetailsPanel.m; sourceTree = SOURCE_ROOT; }; CE68EE6509ABC48000971085 /* DirectoryPanel.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = DirectoryPanel.h; sourceTree = SOURCE_ROOT; }; diff --git a/cocoa/pe/gen.py b/cocoa/pe/gen.py deleted file mode 100644 index 67fe5edd..00000000 --- a/cocoa/pe/gen.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -import os.path as op -import os -import shutil -from optparse import OptionParser - -def main(dev): - if not dev: - print "Building help index" - help_path = op.abspath('../../help_pe/dupeguru_pe_help') - os.system('open /Developer/Applications/Utilities/Help\\ Indexer.app --args {0}'.format(help_path)) - - print "Building dg_cocoa.plugin" - if op.exists('py/build'): - shutil.rmtree('py/build') - if op.exists('py/dist'): - shutil.rmtree('py/dist') - - os.chdir('py') - if dev: - os.system('python -u setup.py py2app -A') - else: - os.system('python -u setup.py py2app') - os.chdir('..') - - print "Building the XCode project" - os.system('xcodebuild') - -if __name__ == '__main__': - usage = "usage: %prog [options]" - parser = OptionParser(usage=usage) - parser.add_option('--dev', action='store_true', dest='dev', default=False, - help="If this flag is set, will configure for dev builds.") - (options, args) = parser.parse_args() - main(options.dev) \ No newline at end of file diff --git a/cocoa/pe/py/setup.py b/cocoa/pe/py/setup.py deleted file mode 100644 index 17806a99..00000000 --- a/cocoa/pe/py/setup.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -from distutils.core import setup -import py2app - -setup( - plugin = ['dg_cocoa.py'], -) \ No newline at end of file diff --git a/cocoa/se/py/dg_cocoa.py b/cocoa/se/dg_cocoa.py similarity index 100% rename from cocoa/se/py/dg_cocoa.py rename to cocoa/se/dg_cocoa.py diff --git a/cocoa/se/dupeguru.xcodeproj/project.pbxproj b/cocoa/se/dupeguru.xcodeproj/project.pbxproj index 63b20181..c01076af 100644 --- a/cocoa/se/dupeguru.xcodeproj/project.pbxproj +++ b/cocoa/se/dupeguru.xcodeproj/project.pbxproj @@ -75,7 +75,7 @@ CE381C9509914ACE003581CE /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = SOURCE_ROOT; }; CE381C9A09914ADF003581CE /* ResultWindow.m */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.objc; path = ResultWindow.m; sourceTree = SOURCE_ROOT; }; CE381C9B09914ADF003581CE /* ResultWindow.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = ResultWindow.h; sourceTree = SOURCE_ROOT; }; - CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dg_cocoa.plugin; path = py/dist/dg_cocoa.plugin; sourceTree = SOURCE_ROOT; }; + CE381CF509915304003581CE /* dg_cocoa.plugin */ = {isa = PBXFileReference; lastKnownFileType = folder; name = dg_cocoa.plugin; path = dg_cocoa.plugin; sourceTree = SOURCE_ROOT; }; CE3A46F9109B212E002ABFD5 /* MainMenu.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainMenu.xib; path = ../base/xib/MainMenu.xib; sourceTree = ""; }; CE45579A0AE3BC2B005A9546 /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = /Library/Frameworks/Sparkle.framework; sourceTree = ""; }; CE68EE6509ABC48000971085 /* DirectoryPanel.h */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = sourcecode.c.h; path = DirectoryPanel.h; sourceTree = SOURCE_ROOT; }; diff --git a/cocoa/se/gen.py b/cocoa/se/gen.py deleted file mode 100644 index 9f9faeb3..00000000 --- a/cocoa/se/gen.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -import os.path as op -import os -import shutil -from optparse import OptionParser - -def main(dev): - if not dev: - print "Building help index" - help_path = op.abspath('../../help_se/dupeguru_help') - os.system('open /Developer/Applications/Utilities/Help\\ Indexer.app --args {0}'.format(help_path)) - - print "Building dg_cocoa.plugin" - if op.exists('py/build'): - shutil.rmtree('py/build') - if op.exists('py/dist'): - shutil.rmtree('py/dist') - - os.chdir('py') - if dev: - os.system('python -u setup.py py2app -A') - else: - os.system('python -u setup.py py2app') - os.chdir('..') - - print "Building the XCode project" - os.system('xcodebuild') - -if __name__ == '__main__': - usage = "usage: %prog [options]" - parser = OptionParser(usage=usage) - parser.add_option('--dev', action='store_true', dest='dev', default=False, - help="If this flag is set, will configure for dev builds.") - (options, args) = parser.parse_args() - main(options.dev) \ No newline at end of file diff --git a/cocoa/se/py/setup.py b/cocoa/se/py/setup.py deleted file mode 100644 index 2962070e..00000000 --- a/cocoa/se/py/setup.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -from distutils.core import setup -import py2app - -from hsutil.build import move_testdata_out, put_testdata_back - -move_log = move_testdata_out() -try: - setup( - plugin = ['dg_cocoa.py'], - ) -finally: - put_testdata_back(move_log) \ No newline at end of file diff --git a/help_me/gen.py b/help_me/gen.py deleted file mode 100644 index 72671b37..00000000 --- a/help_me/gen.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -import os.path as op -from hsdocgen import generate_help, filters - -def generate(windows=False, force_render=True): - tix = filters.tixgen("https://hardcoded.lighthouseapp.com/projects/31699-dupeguru/tickets/{0}") - basepath = op.dirname(__file__) - generate_help.main(basepath, op.join(basepath, 'dupeguru_me_help'), force_render=force_render, tix=tix, windows=windows) diff --git a/help_pe/gen.py b/help_pe/gen.py deleted file mode 100644 index 03ffaced..00000000 --- a/help_pe/gen.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -import os.path as op -from hsdocgen import generate_help, filters - -def generate(windows=False, force_render=True): - tix = filters.tixgen("https://hardcoded.lighthouseapp.com/projects/31699-dupeguru/tickets/{0}") - basepath = op.dirname(__file__) - generate_help.main(basepath, op.join(basepath, 'dupeguru_pe_help'), force_render=force_render, tix=tix, windows=windows) diff --git a/help_se/gen.py b/help_se/gen.py deleted file mode 100644 index 92607ea9..00000000 --- a/help_se/gen.py +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env python -# Copyright 2010 Hardcoded Software (http://www.hardcoded.net) -# -# This software is licensed under the "HS" 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/hs_license - -import os.path as op -from hsdocgen import generate_help, filters - -def generate(windows=False, force_render=True): - tix = filters.tixgen("https://hardcoded.lighthouseapp.com/projects/31699-dupeguru/tickets/{0}") - basepath = op.dirname(__file__) - generate_help.main(basepath, op.join(basepath, 'dupeguru_help'), force_render=force_render, tix=tix, windows=windows) -