diff options
52 files changed, 0 insertions, 3983 deletions
diff --git a/SConstruct b/SConstruct deleted file mode 100644 index e8ee176c..00000000 --- a/SConstruct +++ /dev/null @@ -1,157 +0,0 @@ -PACKAGE = 'aptitude' -VERSION = '0.6.2.1' - -import aptitude_configure -import os -import os.path - -from aptitude_configure_utils import RequireCheck - -# A generic environment used to build all aptitude's programs. - -envs = aptitude_configure.Configure(PACKAGE, VERSION) - -manpage_locales = [ - 'gl', - 'it', - 'pl' - ] - -tl_manpages = Glob('aptitude.??.8') -tl_helptexts = [ - 'help.txt', - Glob('help-??.txt'), - Glob('help-??_??.txt') - ] -tl_defaults = [ - Glob('aptitude-defaults.??'), - Glob('aptitude-defaults.??_??') - ] - -# Put files from the top-level into the source distribution. -envs.base.Dist( - 'COPYING', - 'ChangeLog.SVN', - 'Doxyfile.in', - 'FAQ', - 'FAQ', - 'NEWS', - 'README.CWIDGET', - 'README.SMART-POINTERS', - 'README.THREADS', - 'README.i18n', - 'SConstruct', - 'aclocal.m4', - 'aptitude-defaults', - 'aptitude-hackers-guide.txt', - 'check_boost.sh', - 'function_groups', - 'function_pkgs', - 'section-descriptions', - tl_defaults, - tl_helptexts, - tl_manpages, - ) - - -base_env = envs.base -Export('base_env') -SConscript(dirs = [ 'site_scons' ]) - - -# Define everything that should be installed from the top-level. -envs.base.Install(envs.base['PKGDATADIR'], [ - 'COPYING', - 'FAQ', - 'NEWS', - 'aptitude-defaults', - 'function_groups', - 'function_pkgs', - 'section-descriptions', - tl_defaults, - tl_helptexts, - ]) - -envs.base.Install(envs.base['BINDIR'], [ - 'aptitude-create-state-bundle', - 'aptitude-run-state-bundle' - ]) - -for locale in manpage_locales: - envs.base.Install(os.path.join(envs.base['MANDIR'], locale, 'man8'), - 'aptitude.%s.8' % locale) - -# Create the state directory on "install". -make_statedir = Command(envs.base['STATEDIR'], [], - Mkdir('$TARGET')) -envs.base.Alias('install', make_statedir) - -all_aptitude_srcs = None - -############# Code to build source & tests in each variant ############# -for variant_env in envs.programs.AllVariantEnvs(): - Export(programs_env = variant_env) - variant_dir = 'build/%s/src' % variant_env.GetVariantName() - aptitude, all_aptitude_srcs_v = SConscript(['src/SConscript'], - variant_dir = variant_dir) - all_aptitude_srcs_v = set([x.srcnode() for x in Flatten(all_aptitude_srcs_v)]) - if all_aptitude_srcs is None: - all_aptitude_srcs = all_aptitude_srcs_v - elif all_aptitude_srcs_v != all_aptitude_srcs: - print 'Build script error: not all variants produced the same list of source files.' - print map(str, all_aptitude_srcs_v), map(str, all_aptitude_srcs) - Exit(1) - Default(aptitude) - -# De-setify the list of sources. -all_aptitude_srcs = list(all_aptitude_srcs) -# Sort it so we don't get spurious changes in order due to hashing -# blips. -all_aptitude_srcs.sort() -Export('all_aptitude_srcs') - -# NB: I know because of how the variant directories are set up that we -# always have the same number of entries in the two lists. -for boost_tests_env, cppunit_tests_env, gtest_tests_env \ - in zip(envs.boost_tests.AllVariantEnvs(), - envs.cppunit_tests.AllVariantEnvs(), - envs.gtest_tests.AllVariantEnvs()): - Export(boost_tests_env = boost_tests_env, - cppunit_tests_env = cppunit_tests_env, - gtest_tests_env = gtest_tests_env) - # If this isn't true, something has gone horribly wrong: - assert(cppunit_tests_env['VARIANT'] == boost_tests_env['VARIANT']) - SConscript(['tests/SConscript'], variant_dir = 'build/%s/tests' % cppunit_tests_env.GetVariantName()) - AlwaysBuild('test') - # For convenience, make "scons check" the same as "make check". - Alias('check', 'test') - - -###### Build the documentation in build/doc ###### -docs_env = envs.base -Export('docs_env') -SConscript(['doc/SConscript'], variant_dir = 'build/doc', duplicate = True) -Alias('docs', 'doc-html') -Alias('docs', 'doc-text') -Alias('docs', 'doc-man') - -###### Build the gettext translation files ###### -po_env = envs.base -Export('po_env') -# No variant_dir because the pofile workflow requires the outputs to -# be in the source directory and in distributed archives. -SConscript(['po/SConscript']) - - -# Don't generate the "dist" stuff unless it's been explicitly -# requested. This allows "dist" to build all targets with '.' -# without having to worry about infinite recurrence. -if 'dist' in COMMAND_LINE_TARGETS: - archives = envs.base.DistArchive(envs.base.subst('$PACKAGE-$VERSION'), - scons_args = [ '--variants=all', '.', - '-j', GetOption('num_jobs') ]) - Alias('dist', archives) - - # Rebuild the pofiles *before* attempting to build the - # distribution archive. - po_env.Depends('dist', 'update-po') diff --git a/doc/SConscript b/doc/SConscript deleted file mode 100644 index fc2ac162..00000000 --- a/doc/SConscript +++ /dev/null @@ -1,33 +0,0 @@ -Import('docs_env') -import po4a - -docs_env.Dist([ - 'Makefile.am', - 'aptitude-common.xsl', - 'aptitude-db2latex.xsl', - 'aptitude-html.xsl', - 'aptitude-man.xsl', - 'aptitude-txt.xsl', - 'aptitude.css', - 'fixup-text', - 'html-to-text', - ]) - -SConscript(dirs = [ - 'cs', - 'de', - 'en', - 'es', - 'fi', - 'fr', - 'ja', - # TODO: everyone else. - ]) - -# NOTE: po4a must already exist; i.e., this won't work if it's an -# intermediate target. This is a limitation of the current po4a rule. -build_po4a = docs_env.Po4AConfiguration('po4a/po4a.cfg') - -docs_env.Alias('update-po', build_po4a) -docs_env.Alias('po', build_po4a) - diff --git a/doc/cs/SConscript b/doc/cs/SConscript deleted file mode 100644 index f45811e7..00000000 --- a/doc/cs/SConscript +++ /dev/null @@ -1,10 +0,0 @@ -Import('docs_env') -docs_env.Dist( - 'Makefile.am', - 'SConscript', - ) - -docs_env.AptitudeStandaloneDocs( - 'cs', - manpage = None, - ) diff --git a/doc/de/SConscript b/doc/de/SConscript deleted file mode 100644 index 371ffddf..00000000 --- a/doc/de/SConscript +++ /dev/null @@ -1,7 +0,0 @@ -Import('docs_env') - -docs_env.AptitudePo4aDocs( - 'de', - main_percent_translated = 0, - manpage_percent_translated = 0 - ) diff --git a/doc/en/SConscript b/doc/en/SConscript deleted file mode 100644 index 710bfb81..00000000 --- a/doc/en/SConscript +++ /dev/null @@ -1,10 +0,0 @@ -Import('docs_env') - -docs_env.Dist( - 'Makefile.am', - 'SConscript', - ) - -docs_env.AptitudeStandaloneDocs( - 'en', - ) diff --git a/doc/es/SConscript b/doc/es/SConscript deleted file mode 100644 index ceae2e2a..00000000 --- a/doc/es/SConscript +++ /dev/null @@ -1,7 +0,0 @@ -Import('docs_env') - -docs_env.AptitudePo4aDocs( - 'es', - main_percent_translated = 0, - manpage_percent_translated = 0, - ) diff --git a/doc/fi/SConscript b/doc/fi/SConscript deleted file mode 100644 index cd79d98b..00000000 --- a/doc/fi/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -Import('docs_env') - -import os.path - -docs_env.AptitudeStandaloneDocs( - 'fi', - manpage_postprocess = 'fixman', - ) diff --git a/doc/fr/SConscript b/doc/fr/SConscript deleted file mode 100644 index 5e10332e..00000000 --- a/doc/fr/SConscript +++ /dev/null @@ -1,8 +0,0 @@ -Import('docs_env') - -docs_env.AptitudePo4aDocs( - 'fr', - main_percent_translated = 45, - manpage_percent_translated = 30, - manpage_postprocess = 'fixman', - ) diff --git a/doc/ja/SConscript b/doc/ja/SConscript deleted file mode 100644 index 11871664..00000000 --- a/doc/ja/SConscript +++ /dev/null @@ -1,7 +0,0 @@ -Import('docs_env') - -docs_env.AptitudePo4aDocs( - 'ja', - main_percent_translated = 30, - manpage_percent_translated = 29, - ) diff --git a/po/SConscript b/po/SConscript deleted file mode 100644 index a9e0d80f..00000000 --- a/po/SConscript +++ /dev/null @@ -1,107 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -Import('all_aptitude_srcs', 'po_env') - -pofile_languages = [ - 'ar', - 'ast', - 'bs', - 'ca', - 'cs', - 'da', - 'de', - 'dz', - 'el', - 'es', - 'eu', - 'fi', - 'fr', - 'gl', - 'hu', - 'it', - 'ja', - 'km', - 'ku', - 'lt', - 'mr', - 'nb', - 'ne', - 'nl', - 'nn', - 'pl', - 'pt', - 'pt_BR', - 'ro', - 'ru', - 'sk', - 'sv', - 'th', - 'tl', - 'tr', - 'uk', - 'vi', - 'zh_CN', - 'zh_TW', - ] - -def BuildPoFile(env, lang, - potfile = 'aptitude.pot', - potfile_sig = 'aptitude.pot.sig'): - '''Build the po file for the given language, compile it to a mo -file, and install the compiled form. Also distribute *both* the po -file and the mo file.''' - po_file = env.Msgmerge(lang, potfile) - # TODO: the Precious() call should be in the pofile builder, if - # that's even possible? - env.Precious(po_file) - mo_file = env.Msgfmt(po_file) - po_env.Dist(po_file, mo_file) - env.Install('$LOCALEDIR/$LANG/LC_MESSAGES', LANG = lang) - env.Alias('update-po', mo_file) - - # Arrange to build the pofile iff the potfile signature changes. - env.Depends(po_file, potfile_sig) - env.Ignore(po_file, potfile) - - return mo_file - -aptitude_pot = po_env.Xgettext('aptitude.pot', all_aptitude_srcs) -po_env.Dist(aptitude_pot) - -# Reuse the clunky but functional POT-Creation-Date stripping script -# from gettext. -removepotdate = po_env.Command('remove-potcdate.sed', - 'remove-potcdate.sin', - ["sed -e '/^#/d' $SOURCE > ${TARGET}.new", - Move('${TARGET}', '${TARGET}.new')]) - -aptitude_pot_sig = po_env.Command('aptitude.pot.sig', - aptitude_pot, - ['sed -f $REMOVEPOTDATE $SOURCE | sha512sum > ${TARGET}.new', - Move('${TARGET}', '${TARGET}.new')], - REMOVEPOTDATE = removepotdate) - -# I seriously considered making aptitude.pot a default target, but -# that would pollute the version control history with a bunch of -# relatively meaningless changes. Better to only build it on request. -po_env.Alias('update-po', aptitude_pot) - - -# Rules relating to keeping the translations up-to-date. -for lang in pofile_languages: - BuildPoFile(po_env, lang, aptitude_pot, aptitude_pot_sig) diff --git a/site_scons/SConscript b/site_scons/SConscript deleted file mode 100644 index cd3f96bb..00000000 --- a/site_scons/SConscript +++ /dev/null @@ -1,13 +0,0 @@ -Import('base_env') - -base_env.Dist( - 'SConscript', - 'aptitude_build.py', - 'aptitude_configure.py', - 'aptitude_configure_checks.py', - 'aptitude_configure_utils.py' - ) - -SConscript(dirs = [ - 'site_tools' - ]) diff --git a/site_scons/aptitude_build.py b/site_scons/aptitude_build.py deleted file mode 100644 index c5fd49ce..00000000 --- a/site_scons/aptitude_build.py +++ /dev/null @@ -1,70 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -import re - -def NonHeaders(src): - """Filter out headers from the given list of source files.""" - - return [ f for f in src if not str(f).endswith('.h') ] - -# This searches for either the start of the string or a non-backslash, -# followed by an even number of backslashes, and then a character that -# should be escaped. -cstring_toescapere = re.compile(r'(["\\\n\t\r\b])', - re.MULTILINE) - -def CString(s): - """Represent \"s\" as a C string constant.""" - - def escapechar(c): - """Escape a single character for a C string.""" - if c == '\n': - return '\\n' - elif c == '\t': - return '\\t' - elif c == '\r': - return '\\r' - elif c == '\b': - return '\\b' - else: - return '\\%s' % c - - def processmatch(m): - return escapechar(m.group(1)) - - return '"%s"' % cstring_toescapere.sub(processmatch, s) - -# Poor man's unit tests -assert(CString('abc') == '"abc"') -assert(CString('"abc"') == '"\\"abc\\""') -assert(CString('\\') == '"\\\\"') -assert(CString('\\\\') == '"\\\\\\\\"') -assert(CString('abc\ndef\\') == '"abc\\ndef\\\\"') - -# This just backslash-escapes anything that isn't an alphanumeric -# character. -shellescape_toescapere = re.compile(r'([^a-zA-Z0-9])') - -def ShellEscape(s): - def processmatch(m): - return '\\%s' % m.group(1) - - return shellescape_toescapere.sub(processmatch, s) - -assert(ShellEscape('\\') == '\\\\') -assert(ShellEscape('"') == '\\"') diff --git a/site_scons/aptitude_configure.py b/site_scons/aptitude_configure.py deleted file mode 100644 index cfa3cd18..00000000 --- a/site_scons/aptitude_configure.py +++ /dev/null @@ -1,342 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - - -# Contains the logic to configure aptitude. -from SCons.Script import ARGUMENTS, DefaultEnvironment, Exit -from SCons import SConf -import os - -import aptitude_configure_checks -import aptitude_configure_ept_checks -import aptitude_configure_utils -from aptitude_configure_checks import TryInclude, TryLibrary -from aptitude_configure_utils import RequireCheck - -languages = [ - "ar", - "ast", - "bs", - "ca", - "cs", - "da", - "de", - "dz", - "el", - "es", - "eu", - "fi", - "fr", - "gl", - "hu", - "it", - "ja", - "km", - "ku", - "lt", - "mr", - "nb", - "ne", - "nl", - "nn", - "pl", - "pt", - "pt_BR", - "ro", - "ru", - "sk", - "sv", - "th", - "tl", - "tr", - "uk", - "vi", - "zh_CN", - "zh_TW", - ] - -def DoConfigureEpt(conf, env): - """Test for features of ept.""" - - debtags_ok = False - if conf.CheckForDebtagsTag(): - conf.Define('HAVE_EPT_DEBTAGS_TAG') - debtags_ok = True - - if conf.CheckDebtagsGetTagsOfItemReturnsStrings(): - conf.Define('EPT_DEBTAGS_GETTAGSOFITEM_RETURNS_STRINGS') - debtags_ok = True - - if not debtags_ok: - print "Can't figure out how to access the ept debtags database." - Exit(1) - - if conf.CheckForDebtagsFacet(): - conf.Define('HAVE_EPT_DEBTAGS_FACET') - - textsearch_ok = False - if conf.CheckTextsearch(): - conf.Define('HAVE_EPT_TEXTSEARCH') - textsearch_ok = True - - if conf.CheckEptAxi(): - conf.Define('HAVE_EPT_AXI') - textsearch_ok = True - - if not textsearch_ok: - print "Can't figure out how to access the ept Xapian database." - Exit(1) - - if conf.CheckEptDebtagsVocabularyTagData(): - conf.Define('HAVE_EPT_DEBTAGS_VOCABULARY_TAG_DATA') - - if conf.CheckEptDebtagsVocabularyFacetData(): - conf.Define('HAVE_EPT_DEBTAGS_VOCABULARY_FACET_DATA') - - if conf.CheckEptDebtagsTagFullName(): - conf.Define('HAVE_EPT_DEBTAGS_TAG_FULLNAME') - - if conf.CheckEptDebtagsFacetDescription(): - conf.Define('HAVE_EPT_DEBTAGS_FACET_DESCRIPTION') - - if conf.CheckEptDebtagsTagDescription(): - conf.Define('HAVE_EPT_DEBTAGS_TAG_DESCRIPTION') - -def DoConfigureBuild(env): - """Configure the build environment 'env' with the libraries that -all executable targets need.""" - conf = aptitude_configure_utils.Configure(env) - - RequireCheck(conf.CheckForNCursesW(tries = [ TryInclude('/usr/include'), - TryInclude('/usr/include/ncursesw') ]), - "Can't find libncursesw -- please install libncursesw5-dev.") - RequireCheck(conf.CheckForApt(), - "Can't find the APT libraries -- please install libapt-pkg-dev.") - RequireCheck(conf.CheckForPThread(), - "Can't find the POSIX thread libraries.") - RequireCheck(conf.CheckForBoostIOStreams(), - "Can't find Boost.IOStreams") - - if conf.CheckBoostFusionFoldArgumentOrder(True): - pass - elif conf.CheckBoostFusionFoldArgumentOrder(False): - conf.Define('BOOST_FUSION_FOLD_STATE_BEFORE_VALUE') - else: - print "Can't figure out how to invoke boost::fusion::fold" - Exit(1) - - if conf.CheckDDTP(): - conf.Define('HAVE_DDTP', 1) - conf.CheckGTK() - - conf.CheckForXsltproc() - conf.CheckForPo4A() - aptitude_configure_checks.FindGettextTools(conf) - aptitude_configure_checks.FindGettext(conf) - - conf.Define('SIGC_VERSION', - '"%s"' % os.popen('pkg-config --modversion sigc++-2.0').read().strip()) - - aptitude_configure_utils.RunConfigureFinishHooks(conf) - - - pkgconfig_packages = [ - 'cwidget', - 'libept', - 'sigc++-2.0', - 'sqlite3', - 'vte', - ] - - # ept is no longer optional, but some parts of the code still rely - # on this symbol being defined. - conf.Define('HAVE_EPT') - - for pkg in pkgconfig_packages: - RequireCheck(conf.PkgConfig(pkg), - "Can't find %s" % pkg) - - DoConfigureEpt(conf, env) - - conf.Finish() - -def DoConfigureBoostTests(env): - '''Configure the build environment "env" with the libraries that -the Boost unit tests need.''' - - conf = aptitude_configure_utils.Configure(env) - - RequireCheck(conf.CheckForBoostTest(tries = [ - TryLibrary('boost_unit_test_framework-mt'), - TryLibrary('boost_unit_test_framework') ]), - "Can't find Boost.Test") - - RequireCheck(conf.CheckForGoogleMock(), - "Can't find google-mock") - - conf.Finish() - -def DoConfigureCppunitTests(env): - '''Configure the build environment "env" with the libraries that -the CPPUnit unit tests need.''' - - conf = aptitude_configure_utils.Configure(env) - - RequireCheck(conf.CheckForCPPUnit(), - "Can't find CPPUnit") - - conf.Finish() - -def DoConfigureGTestTests(env): - '''Configure the build environment "env" with the libraries that -the GTest unit tests need.''' - - conf = aptitude_configure_utils.Configure(env) - - RequireCheck(conf.CheckForGoogleTest(), - "Can't find google-test") - - RequireCheck(conf.CheckForGoogleMock(), - "Can't find google-mock") - - conf.Finish() - -class ConfigureResult: - '''Holder for the result of Configure(); see its documentation for -details.''' - - def __init__(self, **kwargs): - for key, val in kwargs.iteritems(): - setattr(self, key, val) - -def Configure(PACKAGE, VERSION): - '''Create the build environments needed for various parts of -aptitude. - -Returns an object with the following fields: - - base: a bare environment with minimal customization - - programs: an environment for building programs - - tests: an environment for building unit tests -''' - - base = DefaultEnvironment(ENV = { 'PATH' : os.environ['PATH'] }, - # We need -fno-strict-aliasing to avoid - # compiler errors that I can't figure - # out how to fix. - CXXFLAGS = [ '-fno-strict-aliasing', '-Wall', '-Werror' ], - PACKAGE = PACKAGE, - VERSION = VERSION) - - # Complain if the user passed command-line build variables; - # AddOption is much more modular, and so we prefer it everywhere, - # even for stuff that traditionally (under automake) was a build - # variable, like DESTDIR. - if len(ARGUMENTS) > 0: - print 'var=value arguments are not supported; see --help.' - Exit(1) - - base.Tool('aptitude_doc') - base.Tool('better_install') - base.Tool('define_directories') - base.Tool('distribute') - base.Tool('docbook') - base.Tool('docbook-xsl-import-scanner') - base.Tool('html2text') - base.Tool('msgfmt') - base.Tool('msgmerge') - base.Tool('pkg_config') - base.Tool('po4a') - base.Tool('rsvg') - base.Tool('test') - base.Tool('variant_builds') - base.Tool('xgettext') - base.Tool('xml-external-entity-scanner') - - def DisableVariants(env): - if not env.get('HAVE_GTK', False): - return 'gtk' - else: - return None - - base.DefineVariants(axes = [ - base.VariantAxis('Compile flags', - base.Variant('debug', flags = '-g -O0 -fno-inline'), - base.Variant('optimized', flags = '-g -O2'), - base.Variant('profiling', flags = '-g -O2 -pg')), - base.VariantAxis('Interface', - base.Variant('curses', helptext = 'Command-line and curses only'), - base.Variant('gtk', helptext = 'Command-line, curses, and gtk', - flags = '$GTKFLAGS')), - ], - default = 'debug-gtk', - disabledf = DisableVariants) - - base.DefineDirectory('destdir', - default = '', - help = 'path prepended to all install paths (e.g., for packaging)') - base.DefineDirectory('prefix', - default = '/usr/local', - help = 'installation prefix') - base.DefineDirectory('bindir', - default = '$PREFIX/bin', - help = 'installation prefix for executable files') - base.DefineDirectory('datadir', - default = '$PREFIX/share', - help = 'data installation prefix') - base.DefineDirectory('pkgdatadir', - default = '$DATADIR/$PACKAGE', - help = 'package-specific data installation prefix') - base.DefineDirectory('helpdir', - default = '$PKGDATADIR', - help = 'help file installation prefix') - base.DefineDirectory('localedir', - default = '$DATADIR/locale', - help = 'installation prefix for locale files') - base.DefineDirectory('statedir', - default = '/var/lib/$PACKAGE', - help = 'the location in which aptitude should store its state (default /var/lib/$PACKAGE)') - base.DefineDirectory('lockfile', - default = '/var/lock/$PACKAGE', - help = 'the file that aptitude should use to lock out other instances of itself (default /var/lock/$PACKAGE).') - base.DefineDirectory('mandir', - default = '$PREFIX/man', - help = 'the location in which manpages should be installed (default /usr/share/man).') - base.DefineDirectory('docdir', - default = '$DATADIR/doc', - help = 'system prefix for documentation.') - base.DefineDirectory('pkgdocdir', - default = '$DOCDIR/$PACKAGE', - help = 'the location in which aptitude\'s documentation should be installed.') - - all_build_envs = base.Clone(CPPPATH = [ '#/src', '#/build/config' ], - CPPDEFINES = [ '_REENTRANT' ]) - DoConfigureBuild(all_build_envs) - - programs = all_build_envs.Clone() - boost_tests = all_build_envs.Clone() - cppunit_tests = all_build_envs.Clone() - gtest_tests = all_build_envs.Clone() - - DoConfigureBoostTests(boost_tests) - DoConfigureCppunitTests(cppunit_tests) - DoConfigureGTestTests(gtest_tests) - - return ConfigureResult(base = all_build_envs, - programs = programs, - boost_tests = boost_tests, - cppunit_tests = cppunit_tests, - gtest_tests = gtest_tests) diff --git a/site_scons/aptitude_configure_checks.py b/site_scons/aptitude_configure_checks.py deleted file mode 100644 index c027052c..00000000 --- a/site_scons/aptitude_configure_checks.py +++ /dev/null @@ -1,460 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import AddOption, GetOption -import SCons.Script - -from aptitude_configure_utils import RegisterCheck, ConfigureCheck - -def TryInclude(d): - """Generate a single entry in "tries" that outputs an appropriate message.""" - - return ("In %s" % d, { 'CPPPATH' : [ d ] }) - -def TryLibrary(*libs): - """Generate a single entry in 'tries' that tries to link against the named library or libraries.""" - - return ("Using %s" % ' '.join(['-l%s' % lib - for lib in libs]), - { 'LIBS' : libs }) - -@RegisterCheck -def CheckForExecutable(context, filename, var, help = None): - """Look for the given filename in $PATH. If var is set in the -environment, use its value; otherwise find the program and set var to -its absolute path.""" - context.Message("Checking for %s..." % filename) - - AddOption('--with-%s' % filename, - dest = 'check_for_%s' % filename, - nargs = 1, - type = 'string', action = 'store', - metavar = 'DIR', - default = context.env.get(var), - help = help or 'set the path to %s' % filename) - location = GetOption('check_for_%s' % filename) - if location is None: - location = context.env.WhereIs(filename) - - if location is None: - context.Result('no') - return False - else: - context.env[var] = location - context.Result(location) - return True - -def MakeCheckForExecutable(name, var_name = None): - """Register a configure method named CheckForName that checks for -the given executable and sets NAME to its location.""" - # This won't cover every case, but it will cut down on code - # duplication in a lot of them. - - method_name = 'CheckFor%s' % name.capitalize() - if var_name is None: - var_name = name.upper() - - def check(context): - """Look for %s in $PATH and set $%s to its location.""" % (name, var_name) - - return CheckForExecutable(context, name, var_name) - RegisterCheck(check, name = method_name) - return check - -@ConfigureCheck("Checking for apt") -def CheckForApt(context): - """Look for apt in the given directory.""" - - context.env.Append(LIBS = [ 'apt-pkg' ]) - - return context.TryLink(''' -#include <apt-pkg/init.h> - -int main(int argc, char **argv) -{ - pkgInitSystem(*_config, _system); - return 0; -}''', context.env['CXXFILESUFFIX']) - -@ConfigureCheck("Checking for libncursesw") -def CheckForNCursesW(context): - """Look for NCursesW in the system header directory.""" - - context.env.Append(LIBS = [ 'ncursesw' ]) - - return context.TryLink(''' -#include <ncurses.h> - -int main(int argc, char **argv) -{ - wget_wch(0, 0); - return 0; -}''', context.env['CXXFILESUFFIX']) - -@ConfigureCheck("Checking for libpthread") -def CheckForPThread(context): - """Look for POSIX thread support.""" - - context.env.Append(LIBS = [ 'pthread' ]) - - return context.TryLink(''' -#include <pthread.h> - -int main(int argc, char **argv) -{ - pthread_mutex_t mutex; - pthread_mutexattr_t mutexattr; - - pthread_mutexattr_init(&mutexattr); - pthread_mutex_init(&mutex, &mutexattr); - return 0; -}''', context.env['CXXFILESUFFIX']) - -@ConfigureCheck("Checking for Boost.IOStreams") -def CheckForBoostIOStreams(context): - """Look for Boost.IOStreams.""" - - context.env.Append(LIBS = [ 'boost_iostreams' ]) - - return context.TryLink(''' -#include <boost/iostreams/device/file.hpp> -#include <boost/iostreams/filter/gzip.hpp> -#include <boost/iostreams/filtering_stream.hpp> - -int main(int argc, char **argv) -{ - boost::iostreams::file_sink devnull("/dev/null"); - boost::iostreams::filtering_ostream compressed_devnull(boost::iostreams::zlib_compressor(9) | devnull); -}''', context.env['CXXFILESUFFIX']) - -@ConfigureCheck("Checking for google-mock") -def CheckForGoogleMock(context): - """Look for gmock (headers and library). - -Brings gtest along for the ride, because otherwise gmock won't link.""" - - context.env.Append(LIBS = [ 'gmock', 'gtest' ]) - - return context.TryLink(''' -#include <gmock/gmock.h> - -class FooMock -{ -public: - MOCK_METHOD1(foo, void(int)); -}; - -int main(int argc, char **argv) -{ - ::testing::GTEST_FLAG(throw_on_failure) = true; - ::testing::InitGoogleMock(&argc, argv); - - FooMock mock; - mock.foo(4); -}''', context.env['CXXFILESUFFIX']) - -@ConfigureCheck("Checking for google-test") -def CheckForGoogleTest(context): - """Look for gtest (headers and library).""" - - context.env.Append(LIBS = [ 'gtest' ]) - - return context.TryLink(''' -#include <gmock/gmock.h> - -TEST(DummyCase, Dummy) -{ - ASSERT_EQ(2, 2); -} - -int main(int argc, char **argv) -{ - ::testing::InitGoogleTest(&argc, argv); - - return RUN_ALL_TESTS(); -}''', context.env['CXXFILESUFFIX']) - - -@ConfigureCheck("Checking for Boost.Test") -def CheckForBoostTest(context): - """Look for Boost.Test.""" - - context.env.Append(CPPDEFINES = [ 'BOOST_TEST_DYN_LINK', - 'BOOST_TEST_NO_MAIN' ]) - - return context.TryLink(''' -#include <boost/test/unit_test.hpp> - -BOOST_AUTO_TEST_CASE(dummy) -{ -} - -bool init_unit_test() -{ - return true; -} - -int main(int argc, char **argv) -{ - return boost::unit_test::unit_test_main(init_unit_test, argc, argv); -}''', context.env['CXXFILESUFFIX']) - -@RegisterCheck -def CheckBoostFusionFoldArgumentOrder(context, value_is_first): - """Figure out the order of arguments that boost::fusion::fold uses -when invoking the function it was passed.""" - - def get_code(): - code_template = ''' - #include <boost/fusion/algorithm/iteration/fold.hpp> -#include <boost/fusion/container/vector.hpp> -#include <boost/fusion/include/fold.hpp> -#include <boost/fusion/include/vector.hpp> - -struct T -{ -}; - -struct F -{ - T operator()(%s) const - { - return T(); - } - typedef T result_type; -}; - -int main(int argc, char **argv) -{ - boost::fusion::vector<int, int, int> v(5, 3, 1); - boost::fusion::fold(v, T(), F()); -}''' - if value_is_first: - return code_template % 'int n, const T &t' - else: - return code_template % 'const T &t, int n' - - if value_is_first: - order_desc = 'value first, then state' - else: - order_desc = 'state first, then value' - - context.Message('Checking whether boost::fusion::fold sends %s...' - % order_desc) - - rval = context.TryCompile(get_code(), context.env['CXXFILESUFFIX']) - context.Result(rval) - return rval - -@ConfigureCheck("Checking for CPPUnit") -def CheckForCPPUnit(context): - """Look for CPPUnit.""" - - context.env.Append(LIBS = 'cppunit') - - return context.TryLink(''' -#include <cppunit/extensions/HelperMacros.h> -#include <cppunit/extensions/TestFactoryRegistry.h> -#include <cppunit/ui/text/TestRunner.h> - -class FooTest : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(FooTest); - - CPPUNIT_TEST(testDummy); - - CPPUNIT_TEST_SUITE_END(); - -public: - void testDummy() - { - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(FooTest); - -int main(int argc, char **argv) -{ - CppUnit::TextTestRunner runner; - CppUnit::TestFactoryRegistry ®istry = - CppUnit::TestFactoryRegistry::getRegistry(); - - runner.addTest(registry.makeTest()); - - bool wasSuccessful = runner.run("", false); - - return wasSuccessful ? 0 : -255; -}''', context.env['CXXFILESUFFIX']) - -@RegisterCheck -def PkgConfig(context, *pkgs): - context.Message('Checking for %s' % pkgs) - - flags = context.env.GetPkgConfigFlags(*pkgs) - - if flags is not None: - context.env.MergeFlags(flags) - result = True - else: - result = False - - context.Result(result) - return result - -@ConfigureCheck('Checking for GTK+ libraries') -def CheckGTK(context): - '''If the necessary libraries for GTK+ support appear to be -available, add the flags necessary to activate them to GTKFLAGS and -set the variable HAVE_GTK to 1. Also arrange for -DHAVE_GTK to be -part of GTKFLAGS.''' - - SCons.Script.AddOption('--disable-gtk', - dest = 'disable_gtk', - default = False, - action = 'store_true') - - if SCons.Script.GetOption('disable_gtk'): - context.Result(False) - print 'Disabling the GTK+ frontend at your request (--disable-gtk).' - return False - - flags = context.env.GetPkgConfigFlags( - 'glibmm-2.4', - 'gthread-2.0', - 'gtkmm-2.4', - 'libglademm-2.4', - ) - - if flags is not None: - context.env.Replace(GTKFLAGS = '%s -DHAVE_GTK=1' % flags, HAVE_GTK = 1) - result = True - else: - result = False - - context.Result(result) - return result - -MakeCheckForExecutable("xsltproc") -MakeCheckForExecutable("rsvg-convert", var_name = "RSVG_CONVERT") - -@ConfigureCheck("Checking for po4a") -def CheckForPo4A(context): - """Look for po4a in $PATH and set $PO4A accordingly.""" - - has_po4a = CheckForExecutable(context, 'po4a', 'PO4A') - has_po4a_translate = CheckForExecutable(context, 'po4a-translate', 'PO4A_TRANSLATE') - return has_po4a and has_po4a_translate - -# The old Makefile defines both MSGFMT and GMSGFMT. It's unclear what -# the distinction is supposed to be; they get defined to the same -# thing. -MakeCheckForExecutable("msgfmt") -MakeCheckForExecutable("xgettext") - -# TODO: the Makefile stored actual commands, MSGMERGE="msgmerge -# --previous" and MSGMERGE_UPDATE="msgmerge --previous --update". -# Presumably there should be configure checks for platforms where -# msgmerge behaves differently. -MakeCheckForExecutable("msgmerge") -MakeCheckForExecutable("msginit") -MakeCheckForExecutable("msgconv") -MakeCheckForExecutable("msgfilter") - -@ConfigureCheck("Checking for libintl in libc") -def CheckForLibintlInLibc(context): - """Check whether libintl is already included in libc.""" - - if context.TryLink(''' -#include <libintl.h> -#include <stdio.h> // For printf. - -int main(int argc, char **argv) -{ - const char * const foo = gettext("Foo"); - printf("%s\\n", foo); - return 0; -}''', context.env['CXXFILESUFFIX']): - context.Result('yes') - return True - else: - context.Result('no') - return False - -@ConfigureCheck('Checking for setlocale in libintl.h') -def CheckSetLocale(context): - if context.TryLink(''' -#include <locale.h> - -int main(int argc, char **argv) -{ - setlocale(0, 0); -}''', context.env['CXXFILESUFFIX']): - context.Result('yes') - return True - else: - context.Result('no') - return False - -@ConfigureCheck('Checking whether apt supports ddtp') -def CheckDDTP(context): - if context.TryLink(''' -#include <apt-pkg/pkgcache.h> - -int main(int argc, char **argv) -{ - pkgCache::DescIterator d; -}''', context.env['CXXFILESUFFIX']): - context.Result('yes') - return True - else: - context.Result('no') - return False - - -def FindGettextTools(configure): - """Look for utilities needed to process pofiles.""" - - result = True - - result = configure.CheckForMsgfmt() and result - result = configure.CheckForXgettext() and result - result = configure.CheckForMsgmerge() and result - result = configure.CheckForMsginit() and result - result = configure.CheckForMsgconv() and result - result = configure.CheckForMsgfilter() and result - - configure.env['HAVE_GETTEXT_UTILS'] = result - return result - -def FindGettext(configure): - """Look for gettext-related functions.""" - - result = True - - result = configure.CheckForLibintlInLibc() and result - result = configure.CheckHeader('libintl.h') and result - result = configure.CheckHeader('locale.h') and result - - if configure.CheckSetLocale(): - configure.Define("HAVE_SETLOCALE") - else: - result = False - - if result: - configure.Define("ENABLE_NLS", 1) - - return result diff --git a/site_scons/aptitude_configure_ept_checks.py b/site_scons/aptitude_configure_ept_checks.py deleted file mode 100644 index 319dc5f7..00000000 --- a/site_scons/aptitude_configure_ept_checks.py +++ /dev/null @@ -1,141 +0,0 @@ -from SCons.Script import AddOption, GetOption -import SCons.Script - -from aptitude_configure_checks import RegisterCheck, ConfigureCheck -from aptitude_configure_utils import TryCompileCXX - -@ConfigureCheck("Checking for ept::debtags::Tag") -def CheckForDebtagsTag(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/debtags.h> - -int main(int argc, char **argv) -{ - ept::debtags::Tag t; - - return 0; -}''') - -@ConfigureCheck("Checking for ept::debtags::Facet") -def CheckForDebtagsFacet(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/debtags.h> - -int main(int argc, char **argv) -{ - ept::debtags::Facet f; - - return 0; -}''') - -@ConfigureCheck("Checking whether ept::debtags::getTagsOfItem returns a set of strings.") -def CheckDebtagsGetTagsOfItemReturnsStrings(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/debtags.h> - -int main(int argc, char **argv) -{ - // This would always crash, but we only care if it type-checks. - ept::debtags::Debtags DB; - std::set<std::string> result = DB.getTagsOfItem("foo"); - - return 0; -}''') - -@ConfigureCheck("Checking whether ept::textsearch::TextSearch exists") -def CheckTextsearch(context): - return TryCompileCXX(context, ''' -#include <ept/textsearch/textsearch.h> - -int main(int argc, char **argv) -{ - ept::textsearch::TextSearch db; - - db.docidByName("foo"); - - return 0; -}''') - -@ConfigureCheck("Checking whether ept/axi exists") -def CheckEptAxi(context): - return TryCompileCXX(context, ''' -#include <ept/axi/axi.h> - -int main(int argc, char **argv) -{ - Xapian::Database db(ept::axi::path_db()); - - return 0; -}''') - -@ConfigureCheck("Checking whether ept::debtags::Vocabulary::tagData exists and returns ept::debtags::voc::TagData *") -def CheckEptDebtagsVocabularyTagData(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/vocabulary.h> - -int main(int argc, char **argv) -{ - ept::debtags::Vocabulary vocabulary; - const ept::debtags::voc::TagData *td = vocabulary.tagData("foo"); - - // Use td so the compiler doesn\'t complain: - return td == NULL ? 1 : 0; -}''') - -@ConfigureCheck("Checking whether ept::debtags::Vocabulary::facetData exists and returns ept::debtags::voc::FacetData *") -def CheckEptDebtagsVocabularyFacetData(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/vocabulary.h> - -int main(int argc, char **argv) -{ - ept::debtags::Vocabulary vocabulary; - const ept::debtags::voc::FacetData *fd = vocabulary.facetData("foo"); - - // Use fd so the compiler doesn\'t complain: - return fd == NULL ? 1 : 0; -}''') - -@ConfigureCheck("Checking whether ept::debtags::Tag::fullName() exists") -def CheckEptDebtagsTagFullName(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/debtags.h> - -int main(int argc, char **argv) -{ - ept::debtags::Tag t; - - std::string s = t.fullname(); - - return 0; -}''') - -@ConfigureCheck("Checking whether ept::debtags::Facet exists and supports description retrieval") -def CheckEptDebtagsFacetDescription(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/debtags.h> - -int main(int argc, char **argv) -{ - ept::debtags::Facet f; - - const std::string longDesc = f.longDescription(); - const std::string shortDesc = f.shortDescription(); - - return 0; -}''') - -@ConfigureCheck("Checking whether ept::debtags::Tag exists and supports description retrieval.") -def CheckEptDebtagsTagDescription(context): - return TryCompileCXX(context, ''' -#include <ept/debtags/debtags.h> - -int main(int argc, char **argv) -{ - ept::debtags::Tag t; - - const std::string longDesc = t.longDescription(); - const std::string shortDesc = t.shortDescription(); - - return 0; -}''') diff --git a/site_scons/aptitude_configure_utils.py b/site_scons/aptitude_configure_utils.py deleted file mode 100644 index d5717d9d..00000000 --- a/site_scons/aptitude_configure_utils.py +++ /dev/null @@ -1,142 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -# Contains utility code dealing with writing and invoking configure -# tests, plus some very generic configure tests. Configure tests for -# specific libraries are in aptitude_configure.py. - -from SCons import SConf -import SCons.Script - -# Used by submodules to stage code that should run at the end of the -# configure step. They're passed the configure object as a parameter. -configure_finish_hooks = [] - -def AddConfigureFinishHook(f): - configure_finish_hooks.append(f) - -def RunConfigureFinishHooks(configure): - for hook in configure_finish_hooks: - hook(configure) - - -# Custom configure checks for aptitude and the code to register and -# configure them. - -custom_tests = {} - -def Configure(env): - """Creates an aptitude-flavored configuration object targeting -the given environment.""" - - result = SCons.Script.Configure(env, custom_tests, config_h = 'build/config/config.h') - result.Define('PACKAGE', '"%s"' % env['PACKAGE']) - result.Define('VERSION', '"%s"' % env['VERSION']) - # Need to inform the source code that we have a config.h file: - env.MergeFlags(env.ParseFlags('-DHAVE_CONFIG_H')) - return result - -def RegisterCheck(f, name = None): - """Decorates a custom configure check by registering it in the - global dictionary of checks under its name.""" - - if name is None: - name = f.__name__ - custom_tests[name] = f - return f - - -def ConfigureCheck(message, register = True, name = None): - """Decorates a custom configure function by modifying its context -as specified in kwargs before running it. If the test succeeds -by returning a true value, the environment is preserved; if the test -fails, the environment is restored. - -The "tries" keyword argument can be used to specify an explicit series -of checks. The advantage of doing this versus simply invoking the -check multiple times is that you get better messages: instead of - -Checking for ncursesw... no -Checking for ncursesw... yes - -you get: - -Checking for ncursesw... - In /usr/include... no - In /usr/include/ncursesw... yes - -Each entry of "tries" has the form (msg, vars). For instance, in the -above example. "msg" would be "In /usr/include" or "In /usr/include/ncursesw". -If "tries" is not present, one run is performed with the values in kwargs. - -This decorator also adds the test to the custom_tests dictionary.""" - def decorator(f, name = name): - def check(context, tries = None, *args, **kwargs): - context.Message('%s...' % message) - - if tries is None: - show_msg = False - tries = [("", {})] - else: - if len(tries) == 0: - raise Exception('Configure checks must have at least one test.') - context.Result('') - show_msg = True - - for msg, bindings in tries: - if show_msg: - context.Message(' %s...' % msg) - - env2 = context.env.Clone() - context.env.Append(**kwargs) - context.env.Append(**bindings) - result = f(context, *args) - - context.Result(bool(result)) - - if not result: - # TODO: this might not work if variables were changed - # that weren't in the original environment. What to - # do then? - context.env.Replace(**env2.Dictionary()) - else: - return result - - return result - - if name is None: - name = f.__name__ - if register: - if name in custom_tests: - raise Exception('Duplicate function name \"%s\".' % f) - else: - custom_tests[name] = check - - check.__name__ = name - return check - - return decorator - -def RequireCheck(check, failure_message): - """If the given configure check fails, print a message and exit.""" - if not check: - print failure_message - SCons.Script.Exit(1) - -def TryCompileCXX(context, code): - """Compile some code as a C++ program.""" - return context.TryCompile(code, context.env['CXXFILESUFFIX']) diff --git a/site_scons/site_tools/SConscript b/site_scons/site_tools/SConscript deleted file mode 100644 index 7f190802..00000000 --- a/site_scons/site_tools/SConscript +++ /dev/null @@ -1,11 +0,0 @@ -Import('base_env') - -base_env.Dist([ - 'SConscript', - 'better_install.py', - 'define_directories.py', - 'distribute.py', - 'pkg_config.py', - 'test.py', - 'variant_builds.py' - ]) diff --git a/site_scons/site_tools/aptitude_doc.py b/site_scons/site_tools/aptitude_doc.py deleted file mode 100644 index 6b426fee..00000000 --- a/site_scons/site_tools/aptitude_doc.py +++ /dev/null @@ -1,302 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - - -# scons recipies for aptitude's documentation. -# -# aptitude documentation translations are stored in doc/$LANG. -# Standalone translations contain "aptitude.xml" and/or "manpage.xml", -# with the former including the latter; po4a-based translations place -# a pofile in doc/po4a/po/$LANG.po, and they might also create an -# addendum.1.$LANG file in doc/po4a/$LANG/. -# -# This file contains canned code to generate all the expected -# documentation goodness given just the language code and a few -# parameters. - -from SCons.Script import Copy, Delete, Dir, File -import os.path - -def exists(): - return True - -def generate(env): - env.AddMethod(AptitudeStandaloneDocs) - env.AddMethod(AptitudePo4aDocs) - -def AptitudeStandaloneDocs(env, - lang, - output_html = 'output-html', - output_txt = None, - output_man = None, - manpage_postprocess = None, - temp_txt = 'output-txt', - temp_man = 'output-man', - mainfile = 'aptitude.xml', - manpage = 'manpage.xml', - images = 'images', - dist_xmls = True): - '''Recipe for creating documentation for aptitude from a -standalone .xml file. - -output_html is the HTML output directory. - -output_txt is the output text documentation (defaults to -README.$LANG). - -output_man is the output manpage (defaults to aptitude.$LANG.8). - -manpage_postprocess gives a script that should be run after building -the documentation. It\'s provided as part of porting the legacy -documentation build system; some of the languages want to run a -postprocessing script on the manpage. - -temp_txt is the temporary directory used to build the text -documentation. - -temp_man is the temporary directory used to build the manpage. - -mainfile is the main XML file (defaults to aptitude.xml), or None if -not present. - -manpage is the manpage\'s XML file (defaults to manpage.xml), or None -if not present. If mainfile is None, this is assumed to be a -standalone XML file. - -images is the directory containing images to go with the HTML -documentation, or None if not present. - -Set dist_xmls to False to keep the XML files from automatically being -included in the source archive (e.g., because they\'re autogenerated). - - -The input XML files and the images directory are implicitly added to -the set of distributed files. The HTML documentation is implicitly -installed into $PKGDOCDIR/html/$LANG, the manpage is implicitly -installed to the appropriate localized manpage directory, and the text -documentation is installed to the package data directory. - - -The aliases \'doc-html\', \'doc-text\', and \'doc-man\' are defined to -build the HTML, text, and manpage documentation respectively.''' - - if output_txt is None: - output_txt = 'README.%s' % lang - if output_man is None: - output_man = 'aptitude.%s.8' % lang - - # Register the source files for distribution. - if dist_xmls: - if mainfile is not None: - env.Dist(mainfile) - if manpage is not None: - env.Dist(manpage) - # Images are registered later on an individual basis. - - - # Set up the "fixman" script if there is one. We need to add the - # script as a "source" of the manpage, and we need to invoke it as - # "./fixman". - fixman_dep = [] - fixman_action = [] - if manpage_postprocess is not None: - # "." isn't in the path by default; put it into the - # postprocess invocation. - def relative(path): - if os.path.isabs(path): - return path - else: - return os.path.join('.', path) - fixman_action.append(env.Action('cd ${TARGET.dir} && %s' - % relative(manpage_postprocess))) - fixman_dep.append(File(manpage_postprocess)) - - # Make sure that the input XML files are File/Dir nodes. - if isinstance(manpage, basestring): - manpage = File(manpage) - if isinstance(mainfile, basestring): - mainfile = File(mainfile) - - # Generate some canned File nodes for the input XSL stuff. - # - # This lets things work smoothly in a variant directory. - aptitude_common_xsl = File('../aptitude-common.xsl') - aptitude_html_xsl = File('../aptitude-html.xsl') - aptitude_man_xsl = File('../aptitude-man.xsl') - aptitude_txt_xsl = File('../aptitude-txt.xsl') - - outputs = [] - - # Generate HTML and text documentation, if it exists. - if mainfile is not None: - # Note: automatically assume this depends on the manpage. It - # would be nice to have an XML/Docbook scanner that could find - # external entity references, but this is probably easier. - - # Build the full HTML documentation: - html = env.Docbook(Dir(output_html), - mainfile, - target_is_directory = True, - stylesheet = aptitude_html_xsl) - if images is not None: - in_svgs = env.Glob("%s/*.svg" % images) - in_pngs = env.Glob("%s/*.png" % images) - env.Dist((in_svgs, in_pngs)) - out_svg_pngs = [] - for in_svg in in_svgs: - out_svg_png = File('%s.png' % str(in_svg)[:-4]) - out_svg_pngs.append(env.Rsvg(out_svg_png, in_svg)) - in_images = env.Flatten((in_pngs, out_svg_pngs)) - if len(in_images) > 0: - # Note that the image directory is hardcoded to "images"; - # this could be a parameter instead. - copy_images = env.Command(os.path.join(output_html, 'images'), - in_images, - [ Delete('$TARGET') ] + - [ Copy('$TARGET', x) for x in in_images ] + - [ Copy('$TARGET', fn) - for fn in [ 'caution.png', 'important.png', 'note.png', 'tip.png', 'warning.png', - 'home.gif', 'next.gif', 'prev.gif', 'up.gif'] ]) - env.Alias('doc-html', copy_images) - # Note the use of InstallAs to rename the directory! - env.InstallAs('$PKGDOCDIR/html/%s' % lang, html) - env.Alias('doc-html', html) - outputs.append(html) - # Work around scons not scanning intermediate files to find - # out their dependencies. - env.Depends(html, manpage) - - - # Build the text documentation: - html_onepage = env.Docbook(File(os.path.join(temp_txt, 'index.html')), - mainfile, - stylesheet = aptitude_txt_xsl) - # Work around scons not scanning intermediate files to find - # out their dependencies. - env.Depends(html_onepage, manpage) - - text = env.Html2Text(output_txt, html_onepage) - env.Install('$PKGDATADIR', text) - env.Alias('doc-text', text) - outputs.append(text) - - - # Build the manpage from the main documentation file: - manpage_out = env.Docbook(File(os.path.join(temp_man, 'aptitude.8')), - mainfile, - stylesheet = aptitude_man_xsl) - # Work around scons not scanning intermediate files to find - # out their dependencies. - env.Depends(manpage_out, manpage) - - man_action = [Copy('$TARGET', '$SOURCE')] + fixman_action - man = env.Command(output_man, [manpage_out, fixman_dep], - man_action) - env.Install('$MANDIR/%s/man8' % lang, man) - env.Alias('doc-man', man) - outputs.append(man) - else: - # Generate a manpage, if one exists. - if manpage is not None: - manpage_out = env.Docbook(File(os.path.join(temp_man, 'aptitude.8')), - manpage, - stylesheet = aptitude_man_xsl) - - man = env.Command(output_man, manpage_out, - [Copy('$TARGET', '$SOURCE')] + fixman) - env.Install('$MANDIR/%s/man8' % lang, man) - env.Alias('doc-man', man) - outputs.append(man) - - return outputs - - -def AptitudePo4aDocs(env, - lang, - main_percent_translated = 75, - manpage_percent_translated = 75, - master_charset = 'utf-8', - add = None, - **kwargs): - '''Recipe for creating documentation for aptitude by -po4a-translating the master documentation. - -If add is None, an addendum is used if and only if the file -"doc/po4a/add_$LANG/addendum.1.$LANG" exists. If add is False, an -addendum is never used. Otherwise, the file or files named by add are -used as addenda. - -percent_translated and manpage_percent_translated are used to check -that the corresponding documentation is as translated as we expect. -If one of these values is None, the corresponding file will not be -generated or compiled. - -Other keyword args are interpreted as for AptitudeStandaloneDocs. - -The corresponding pofiles are automatically added to the list of files -to distribute.''' - - if add is None: - # Note that I use Dir('.').abspath in case we're in a variant - # directory. - testdir = os.path.join(Dir('.').abspath, - '../po4a/add_%s/addendum.1.%s' - % (lang, lang)) - if os.path.exists(testdir): - add = File('../po4a/add_%s/addendum.1.%s' % (lang, lang)) - - if add is False: - add = None - - pofile = File('../po4a/po/%s.po' % lang) - - if main_percent_translated is None: - translated_mainfile = None - else: - translated_mainfile = env.Po4A(File('aptitude.xml'), - File('../en/aptitude.xml'), - pofile, - addendum = add, - percent_translated = main_percent_translated, - master_charset = master_charset, - format = 'docbook') - - if manpage_percent_translated is None: - translated_manpage = None - else: - translated_manpage = env.Po4A(File('manpage.xml'), - File('../en/manpage.xml'), - pofile, - percent_translated = manpage_percent_translated, - master_charset = master_charset, - format = 'docbook') - - result = env.AptitudeStandaloneDocs(lang, - mainfile = translated_mainfile, - manpage = translated_manpage, - dist_xmls = False, - **kwargs) - - # Make sure the necessary files end up in the distributed archive. - env.Dist(pofile) - if add is not None: - env.Dist(add) - - # The output will be installed by rules in StandaloneDocs. - - return result - diff --git a/site_scons/site_tools/better_install.py b/site_scons/site_tools/better_install.py deleted file mode 100644 index 54f61235..00000000 --- a/site_scons/site_tools/better_install.py +++ /dev/null @@ -1,66 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - - - -# Replacement for the built-in Install builder, supporting DESTDIR and -# automatically adding the nodes it generates to the "install" alias. - -from SCons.Script import Copy, Entry, COMMAND_LINE_TARGETS -import os.path - -def exists(): - return True - -def generate(env): - env.AddMethod(Install) - -def Install(env, targetdir, *sources, **kwargs): - def add_destdir(path): - """Add DESTDIR to a path. - -os.path.join won't work because it doesn't join to absolute paths; -join('a', '/b') returns '/b'. And concatenation doesn't work right -if DESTDIR lacks a trailing space. This deals with both cases -properly.""" - destdir = env['DESTDIR'] - if destdir == '': - return path - - if not destdir.endswith('/'): - destdir += '/' - - return os.path.normpath('%s%s' % (destdir, path)) - - # Only set up the alias if the user asked for an install, so - # "scons ." works to build everything with no surprises and so - # that multiple variants can be built without trying to create - # install targets for the same file. - if 'install' in COMMAND_LINE_TARGETS: - result = [] - for source in env.Flatten(sources): - output = add_destdir(os.path.join(targetdir, os.path.basename(Entry(source).path))) - result.append(env.Command(output, - source, - Copy('$TARGET', '$SOURCE'), - **kwargs)) - - env.Alias('install', result) - - return result - else: - return [] diff --git a/site_scons/site_tools/define_directories.py b/site_scons/site_tools/define_directories.py deleted file mode 100644 index f7f731c2..00000000 --- a/site_scons/site_tools/define_directories.py +++ /dev/null @@ -1,48 +0,0 @@ -import aptitude_configure_utils - -from SCons.Script import * - -def exists(env): - return True - -def generate(env): - env.AddMethod(DefineDirectory) - -def DefineDirectory(env, key, default = None, help = None): - """Define a new directory variable. - -\"key\" is the name of the new variable; for instance, \"prefix\" or -\"datadir\". A command-line option \"--key\" will be created to -define a new value for the variable, a build environment variable $KEY -will be created to allow it to be substituted in various places, and a -config.h symbol KEY will be defined to allow it to be referenced from -C++ code. SConscript files can import the variable under the name -\"key\".""" - - while key[:2] == '--': - key = key[2:] - - lowercase_key = key.lower() - uppercase_key = key.upper() - del key # Avoid accidentally referencing it. - - AddOption('--%s' % lowercase_key, - dest = lowercase_key, - nargs = 1, - type = 'string', - action = 'store', - metavar = 'DIR', - default = default, - help = help or 'set %s' % lowercase_key) - - if uppercase_key in ARGUMENTS: - env[uppercase_key] = ARGUMENTS[uppercase_key] - else: - env[uppercase_key] = GetOption(lowercase_key) - - def finish(configure): - value = configure.env.subst('$%s' % uppercase_key) - Export({lowercase_key : value}) - configure.Define(uppercase_key, '"%s"' % value) - - aptitude_configure_utils.AddConfigureFinishHook(finish) diff --git a/site_scons/site_tools/distribute.py b/site_scons/site_tools/distribute.py deleted file mode 100644 index d174226d..00000000 --- a/site_scons/site_tools/distribute.py +++ /dev/null @@ -1,179 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import Copy, Delete, Dir, Entry - -import os.path - -# Emulation of "make dist" for scons. -def exists(): - return True - -def generate(env): - env.AddMethod(Archive) - env.AddMethod(Dist) - env.AddMethod(DistArchive) - env.AddMethod(DistDirectory) - env._dist = set() - -def Dist(env, *sources): - '''Register the given files for inclusion in the distribution -archive.''' - - # I could instead make '.' require them. That would make builds - # fail if they were missing, which I kind of like; it would also - # mean that if they were not actually leaves, they would be built - # by default and not included in the distribution, which I don't - # like. - for f in env.Flatten(sources): - if isinstance(f, basestring): - f = Entry(f) - - # Do this to collapse away variant builds. - env._dist.add(f.srcnode()) - -def DistDirectory(env, dir_name): - '''Find all source files under \'.\' and copy them into the named -directory. Returns the node for the whole process.''' - # Early versions of this code used FindSourceFiles. However, that - # has some significant drawbacks; most notably, it's very - # difficult to control what gets put into the distribution - # archive. I'd rather specify the contents "by hand". - sources = env._dist - directory = Dir(dir_name) - for source in sources: - target = os.path.join(directory.path, source.path) - env.Command(target, - source, - Copy("$TARGET", "$SOURCE")) - env.Depends(directory, target) - - return directory - -def Archive(env, target, sources, type = None): - '''Create an archive from one or more files or directories. - -The given "type" is an archive format suffix. If it is not present, the -suffix of the target file is used to determine the archive format. - -Recognized suffixes include: - .7z - .tar - .tar.bz2 - .tar.gz - .tar.lzma - .zip - -Returns the node for the target.''' - - sources = env.Flatten(sources) - - class Tool: - def __init__(self, suffix, command): - self.suffix = suffix - self.command = command - - tools = [ - Tool('.7z', '7z a -mx=9 $TARGET $SOURCES'), - Tool('.tar', 'tar cf $TARGET $SOURCES'), - Tool('.tar.bz2', 'tar c $SOURCES | bzip2 -9 > $TARGET'), - Tool('.tar.gz', 'tar c $SOURCES | gzip -9 > $TARGET'), - Tool('.tar.lzma', 'tar c $SOURCES | lzma --best > $TARGET'), - Tool('.zip', 'zip -r $TARGET $SOURCES') - ] - - tool = None - if type is None: - for tool_test in tools: - if target.endswith(tool_test.suffix): - tool = tool_test - break - if tool is None: - raise Exception('Unable to determine an archive format for %s' % `target`) - else: - for tool_test in tools: - if type == tool_test.suffix: - tool = tool_test - break - - if tool is None: - raise Exception('Unknown archive format %s' % `type`) - - try: - return env.Command(target, sources, tool.command) - except Exception, e: - print e - raise e - -# archive-stem used to default to ${PACKAGE}-${VERSION}, but there was -# weirdness due to the ${} not always getting expanded. Now we just -# rely on the caller doing it for us. -def DistArchive(env, - archive_stem, - archive_directory = '#/build/dist', - distcheck_directory = '#/build/distcheck', - suffixes = [ '.tar.gz' ], - scons_args = [ ]): - '''Create a directory containing the distributed source and -archive it. "suffixes" is a list of archive suffixes such as -".tar.gz", ".tar.bz2", etc. - -By default, the variables PACKAGE and VERSION are used to name the -generated archive. - -If scons_args is not None, then scons will invoke itself in the -subdirectory, passing the given list of arguments; the archive is only -created if the subsidiary scons succeeds. This can be used, for -instance, to verify that the source compiles and passes its unit -tests. - -Returns a list of targets, one for each entry in "suffixes".''' - archive_filename = os.path.join(archive_directory, archive_stem) - dist_dir = env.DistDirectory(archive_filename) - - if scons_args is not None: - dist_dir_pristine_copy_filename = Dir(os.path.join(distcheck_directory, archive_stem)) - dist_dir_pristine_copy = env.Command(dist_dir_pristine_copy_filename, - dist_dir, - [ Delete("$TARGET"), - Copy("$TARGET", "$SOURCE") ]) - - tested_dist_dir_stamp = os.path.join(distcheck_directory, '%s.stamp' % archive_stem) - chdir_path = Dir(dist_dir_pristine_copy_filename).abspath - tested_dist_dir = env.Command(tested_dist_dir_stamp, - dist_dir_pristine_copy, - [ 'cd $COPY_DIR && scons $SCONS_ARGS', - # Need to use the abspath here - # since we've cd'd down into - # the distcheck directory. - "cd $COPY_DIR && echo ${SOURCE.get_csig()} > ${TARGET.abspath}" ], - COPY_DIR = chdir_path, - SCONS_ARGS = scons_args) - else: - # Pretend we tested it. - tested_dist_dir = dist_dir - - result = [] - for suffix in suffixes: - archive = env.Archive(os.path.join(archive_directory, - '%s%s' % (archive_stem, suffix)), - [ dist_dir ]) - env.Depends(archive, tested_dist_dir) - - result.append(archive) - - return result diff --git a/site_scons/site_tools/docbook-xsl-import-scanner.py b/site_scons/site_tools/docbook-xsl-import-scanner.py deleted file mode 100644 index ede26bec..00000000 --- a/site_scons/site_tools/docbook-xsl-import-scanner.py +++ /dev/null @@ -1,74 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -import errno -import xml.parsers.expat -from SCons.Script import File, Scanner - -def exists(): - return True - -def generate(env): - env.Append(SCANNERS = DocbookXSLImportScanner) - -def DocbookXSLImports(node, env, path): - - result = [] - - def start_element(name, attrs): - if name == 'xsl:import' or name == 'xsl:include': - href = attrs.get('href', None) - if href is None: - return - - if href.startswith('http://'): - pass - elif href.startswith('file://'): - filename = href[len('file://'):] - result.append(filename) - else: - filename = href - result.append(filename) - - - try: - infile = file(node.srcnode().path) - except EnvironmentError, e: - if e.errno == errno.ENOENT: - return [] - else: - raise - - try: - parser = xml.parsers.expat.ParserCreate() - parser.StartElementHandler = start_element - - parser.ParseFile(infile) - except xml.parsers.expat.ExpatError, e: - print e - # Probably an XML syntax error -- don't blow up the scanner - # for that! - pass - finally: - infile.close() - - return result - -DocbookXSLImportScanner = Scanner(function = DocbookXSLImports, - skeys = [ '.xsl' ], - recursive = True, - ) diff --git a/site_scons/site_tools/docbook.py b/site_scons/site_tools/docbook.py deleted file mode 100644 index 2a3fa62a..00000000 --- a/site_scons/site_tools/docbook.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import Dir, File -import re - -def exists(): - return True - -def generate(env): - env.AddMethod(Docbook) - -def Docbook(env, target, xml, - stylesheet = None, - target_is_directory = False): - '''Build a Docbook document from its input XML file. - -If target_is_directory is True, the target output will be stored in a -directory of the given name. This is equivalent to passing a filename -ending in "/" and leaving this parameter False.''' - - if stylesheet is not None: - args = [File(stylesheet), File(xml)] - else: - args = [File(xml)] - - if target_is_directory: - target_subst = '${TARGET}/' - target_node = Dir(target) - else: - target_subst = '$TARGET' - target_node = File(target) - - result = env.Command(target_node, args, - [[env.get('XSLTPROC', 'xsltproc'), '-o', target_subst] + env.Flatten(args)]) - - return result diff --git a/site_scons/site_tools/html2text.py b/site_scons/site_tools/html2text.py deleted file mode 100644 index 542e6d22..00000000 --- a/site_scons/site_tools/html2text.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -def exists(): - return True - -def generate(env): - env.AddMethod(Html2Text) - -# TODO: support multiple html2text commands, not just elinks. -def Html2Text(env, target, source): - '''Convert an HTML file to a text file using elinks.''' - return env.Command(target, source, - 'elinks -dump -no-references -no-numbering $SOURCE > $TARGET') diff --git a/site_scons/site_tools/msgfmt.py b/site_scons/site_tools/msgfmt.py deleted file mode 100644 index a8f7a4b2..00000000 --- a/site_scons/site_tools/msgfmt.py +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import Builder, Move -import msgmerge - -def exists(): - return True - -def generate(env): - env.Append(BUILDERS = { 'Msgfmt' : MsgfmtBuilder }) - -# TODO: could add rules for building .mo (is that for non-GNU -# systems?) Maybe even build either one, depending on which ones are -# available? - -# Note that we can't automatically build the .po from the .pot since -# we can't compute the .pot name from the .po name. -MsgfmtBuilder = Builder( - action = [[ - '$MSGFMT', '-c', '--statistics', - '-o', '${TARGET}.new', - '$SOURCE' - ], - Move('${TARGET}', '${TARGET}.new')], - suffix = '.gmo', - source_suffix = '.po') diff --git a/site_scons/site_tools/msgmerge.py b/site_scons/site_tools/msgmerge.py deleted file mode 100644 index d03a16a7..00000000 --- a/site_scons/site_tools/msgmerge.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import Builder - -def exists(): - return True - -def generate(env): - env.Append(BUILDERS = { 'Msgmerge' : MsgmergeBuilder }) - -MsgmergeBuilder = Builder( - action = [[ - '$MSGMERGE', '--previous', '--update', - '$TARGET', '$SOURCE', - ]], - suffix = '.po', - ) diff --git a/site_scons/site_tools/pkg_config.py b/site_scons/site_tools/pkg_config.py deleted file mode 100644 index ad25daa6..00000000 --- a/site_scons/site_tools/pkg_config.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -import subprocess - -def exists(): - return True - -def generate(env): - env.AddMethod(GetPkgConfigFlags) - -def GetPkgConfigFlags(env, *pkgs): - """Return the cflags and libs for the given packages, -or None if one of the packages can't be found.""" - pkg_config = env.get('PKG_CONFIG', 'pkg-config') - - pipe = subprocess.Popen([pkg_config, - '--cflags', - '--libs'] + list(pkgs), - stdout = subprocess.PIPE) - - output = pipe.stdout.read() - pipe.wait() - - if pipe.returncode == 0: - return output - else: - return None - diff --git a/site_scons/site_tools/po4a.py b/site_scons/site_tools/po4a.py deleted file mode 100644 index ee6ae5c7..00000000 --- a/site_scons/site_tools/po4a.py +++ /dev/null @@ -1,243 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import File - -import re -import os.path - -def exists(): - return True - -def generate(env): - env.AddMethod(Po4A) - env.AddMethod(Po4AConfiguration) - -# Expression matching blank lines. -blank_line_re = re.compile(r'^\s*$') -# Expression matching lines that start a configuration entry. The -# rest of the line isn't matched and should be matched by argument_re -# (below). -entry_start_re = re.compile(r'^\s*\[\s*(?:([a-zA-Z0-9_\-]+)\s*:)?\s*([a-zA-Z0-9_\-]+)\]') -# Expression matching an entire argument to a entry, including any -# double quotes. -# -# NOTE: Currently quote escaping isn't handled. To add it, you'd need -# to modify this expression to recognize escaped quotes, then modify -# the quote stripping to remove the escape but not the quote. SInce -# this is not a general solution, it's OK. -# -# Note the optional EOL with optional preceding backslash. -# -# Also note that backslashes aren't allowed anywhere except at EOL. -# Again, this is a simplification that works because aptitude's po4a -# configuration file doesn't need this. -argument_re = re.compile(r'\s*((?:[^\s\\"]|"[^"]*")+)\s*(\\?$)?') - -def find_file(path, fn): - '''Look for a file in a path.''' - for d in path: - d_path = os.path.join(str(path), str(fn)) - if os.path.isfile(d_path): - return d_path - - # Arbitrarily return the first option if none exist. This happens - # to be exactly right, since we'll normaly have only one option - # (implementing the general case is just future-proofing) - return os.path.join(str(path[0]), str(fn)) - -def path_function(env, dot, targets, sources): - '''path_function used to produce a path for the scanner. - -Always produces a path containing just the directory containing -the SConscript file.''' - return (dot,) - -class ConfigEntry: - '''Represents one entry in the po4a config file.;''' - def __init__(self, category = None, name = None): - if name is None: - raise Exception('Missing entry name argument.') - self.category = category - self.name = name - self.args = [] - - def add_arg(self, arg): - self.args.append(arg) - - def __repr__(self): - if self.category is None: - return '[%s] %s' % (self.name, ' '.join(self.args)) - else: - return '[%s:%s] %s' % (self.category, self.name, ' '.join(self.args)) - -def parse_po4a_config_entries(f): - '''Parse a file object and extract all po4a.cfg-style entries -from it. - -Entries have the syntax: - -[CLASS: ENTRY-NAME] ARG1 ... - -where CLASS: is optional. Argument lists can contain quoted strings, -and newlines can be backslash-escaped to continue a single entry.''' - - entries = [] - - # Note that the current entry might be a "live", i.e., a direct - # reference to the most recently parsed entry. This happens - # when the last line ended with a trailing backspace. - current_entry = None - for line in f: - if blank_line_re.match(line): - # Cancel out the current entry so we don't append to the - # last line. - current_entry = None - continue - - # Trailing newlines mess up pattern matching since the regexp - # EOL doesn't match actual newlines. - line = line.rstrip('\n') - - entry_start = entry_start_re.match(line) - if entry_start: - if current_entry is not None: - raise Exception('po4a configuration file syntax error: entries are run together.') - else: - current_entry = ConfigEntry(category = entry_start.group(1), - name = entry_start.group(2)) - entries.append(current_entry) - start_args_index = entry_start.end() - else: - if current_entry is None: - raise Exception('po4a configuration file syntax error: saw a non-entry line, but I have no current entry: %s' % `line`) - start_args_index = 0 - - saw_end = False - saw_continuation = False - for arg_match in argument_re.finditer(line[start_args_index:]): - arg_text = arg_match.group(1) - current_entry.add_arg(arg_text) - if arg_match.group(2) is not None: - saw_end = True - if arg_match.group(2) == '\\': - saw_continuation = True - - if not saw_continuation: - current_entry = None - - if not saw_end: - raise Exception('Syntax error in po4a configuration file: not all of the line could be parsed as entry arguments: %s' % `line`) - - return entries - -# Function to get lists of sources and targets declared in a po4a.cfg -# file. -# -# Note: this is hand-crafted to meet the current needs of aptitude. -# It will need to be adjusted should we start using new configuration -# options. The reason this is useful is that it means that -# translators don't have to modify a second piece of information about -# the dependencies of the po files. -# -# Note: the configuration file format of po4a is undocumented! This -# scanner was written based on aptitude's po4a configuration and is -# unlikely to generalize very well. -def get_po4a_targets(env, source): - extra_sources = [] - outputs = [] - entries = parse_po4a_config_entries(file(source.abspath)) - # Current behavior is to heuristically guess what's a source and - # what's an output. - for entry in entries: - if entry.category is None and entry.name == 'po4a_paths': - for arg in entry.args: - parts = arg.split(':', 1) - outputs.append(parts[-1]) - elif entry.category == 'type' and entry.name == 'docbook': - # Each entry might or might not have a entry prefix - # (like "de:" or "opt:"). If it has a entry prefix and - # the prefix is "opt:", assume it's an option and - # ignore it; otherwise, assume the part after the - # prefix is a file name. - for arg in entry.args: - parts = arg.split(':', 1) - # The arguments can contain output files (with a - # "$LANG:" prefix), options (with an "opt:" - # prefix) and input files (no prefix). - if len(parts) == 1: - extra_sources.append(parts[0]) - elif parts[0] != 'opt': - outputs.append(parts[1]) - - return (extra_sources, outputs) - -# I use a wrapper around the builder to ensure that the various -# SideEffect calls take place as required. -def Po4AConfiguration(env, cfg_file): - print os.getcwd() - - if isinstance(cfg_file, basestring): - cfg_file = File(cfg_file) - cfg_file = cfg_file.srcnode() - - extra_sources, outputs = get_po4a_targets(env, cfg_file) - targets = [] - side_effects = [] - for entry in env.Flatten(outputs): - if entry.endswith('.pot') or entry.endswith('.po'): - # Note that we update the pofiles *in the source - # directory*, not in the build directory. This is - # deliberate: the normal workflow for translators updates - # pofiles in place. - targets.append(File(entry).srcnode()) - # The other files declared in po4a.cfg are the translated XML - # files. They are excluded from the build below (with - # --no-translations). - - result = env.Command(targets, (cfg_file, extra_sources), - 'cd ${PO4A_CFGFILE.dir.dir} && po4a --no-translations ${PO4A_CFGFILE.abspath}', - PO4A_CFGFILE = cfg_file) - - return result - -def Po4A(env, target, master, pofile, - addendum = None, - percent_translated = 75, - master_charset = 'utf-8', - format = 'docbook'): - '''Run po4a over a document to produce a translated document.''' - extra_args = [] - deps = [master, pofile] - if addendum is not None: - # This is what we should do, but the addendums were never used - # in the old system and they break the build! Disabling them - # for now. - # - #extra_args += ['-a', addendum] - #deps.append(addendum) - pass - return env.Command(target, deps, - [[ - env.get('PO4A_TRANSLATE', 'po4a-translate'), - '-k', str(percent_translated), - '-M', master_charset, - '-f', format, - '-m', master, - '-p', pofile, - '-l', '$TARGET' - ] + extra_args]) diff --git a/site_scons/site_tools/rsvg.py b/site_scons/site_tools/rsvg.py deleted file mode 100644 index a9834f9e..00000000 --- a/site_scons/site_tools/rsvg.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -def exists(): - return True - -def generate(env): - env.AddMethod(Rsvg) - -def Rsvg(env, target, source): - return env.Command(target, source, - [ [ env.get('RSVG_CONVERT', 'rsvg-convert'), - # TODO: support more output formats? - # Autoguess from the target suffix? - # Autogenerate the output file name? - '-f', 'png', - '-o', target, - source ] ]) diff --git a/site_scons/site_tools/test.py b/site_scons/site_tools/test.py deleted file mode 100644 index c39efbed..00000000 --- a/site_scons/site_tools/test.py +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import File - -def exists(): - return True - -def generate(env): - env.AddMethod(Test) - - -def Test(env, target, *args, **kwargs): - '''Compile the given test and run it as part of the "test" target. -Returns the Node for the alias.''' - - if 'test_target' in kwargs: - test_target = kwargs['test_target'] - del kwargs['test_target'] - else: - test_target = 'test' - - program = env.Program(target, *args, **kwargs) - stampfile = File('%s.stamp' % target) - program_stamp = env.Command(stampfile, - [program], - [ program[0].abspath, - ['touch', stampfile.abspath] ]) - return env.Alias(test_target, program_stamp) - - diff --git a/site_scons/site_tools/variant_builds.py b/site_scons/site_tools/variant_builds.py deleted file mode 100644 index 8effc4ab..00000000 --- a/site_scons/site_tools/variant_builds.py +++ /dev/null @@ -1,360 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - - -'''Support for easily creating a matrix of build variants and building -some or all of them.''' - -# TODO: need an interface to disable support for a class of variants -# (selected the same way the variants to build are selected); be sure -# to check whether all variants have been hidden and emit an error in -# that case, probably from AllVariantEnvs. -# -# Use case here: I would rather only check for GTK+ once, in the -# configure step, and then disable the GTK+ variant if it isn't -# available. Removing it from the list of variants passed to -# DefineVariants is not ideal, since then it won't show up in help -# etc. - -import operator - -from SCons.Script import AddOption, GetOption - -def exists(env): - return True - -def generate(env): - # NB: export VariantAxis and Variant because the user can't import - # this file directly. - env.AddMethod(VariantAxis) - env.AddMethod(Variant) - env.AddMethod(DefineVariants) - env.AddMethod(AllVariantEnvs) - env.AddMethod(GetVariantName) - env.AddMethod(IsVariantActive) - -class VariantAxis: - '''Represents a single axis of choice for a variant build. - -For instance, VariantAxis("debug", "optimized") sets up a variant axis -that lets the user pick from either debug builds or optimized builds. -If another axes lets them choose between "lemon" and "orange", -they\'ll end up with "debug-lemon", "debug-orange", "optimized-lemon", -and "optimized-orange" builds. - -The given help text will be printed just above the list of options.''' - def __init__(self, env, helptext, *options): - self.options = list(options) - self.helptext = helptext - - def __str__(self): - return str(self.options) - - def __repr__(self): - return 'VariantAxis(%s)' % repr(self.options) - -class Variant: - '''Represents a single value in a variant axis.''' - def __init__(self, env, name, helptext = None, - flags = '', - vars = {}, - initf = lambda *args: None, - build_dir = None): - '''Create a new variant. - -The given flags are passed to MergeFlags. Variables specified in vars -are updated using Replace. initf is then invoked on the environment -for its side-effects, if any (none by default).''' - if name == 'all': - raise Exception('The name "all" is reserved for internal use.') - elif '-' in name: - raise Exception('Variant names cannot contain "-".') - - self.name = name - self.helptext = helptext - self.flags = flags - self.vars = vars - self.initf = initf - - def Prepare(self, env): - env.Replace(**self.vars) - env.MergeFlags(env.subst(self.flags)) - if '-pg' in self.flags.split() and '-pg' not in env['LINKFLAGS']: - env.Append( LINKFLAGS = [ '-pg' ] ) - self.initf(env) - - def __hash__(self): - return hash(self.name) - - def __eq__(self, other): - return self.name == other.name - - def __str__(self): - return self.name - - def __repr__(self): - return 'Variant(%s)' % repr(self.name) - -class VariantChoice: - '''Represents an assignment of options to all variants.''' - - def __init__(self, selections): - '''Create a variant choice by selecting the given options. -"selections" is a list in which the first entry is the option selected -along the first axis, the second entry is the option selected along the -second axis, and so on.''' - # NB: use a tuple because its hash and comparison semantics - # are what we want. - self.selections = tuple(selections) - - def BuildEnv(self, env): - '''Produce a build environment specialized for this collection -of variant selections.''' - - specialized = env.Clone(VARIANT = str(self)) - del specialized['VARIANTS'] - for v in self.selections: - v.Prepare(specialized) - - return specialized - - def __str__(self): - '''Compute the string that is used to represent this choice.''' - return '-'.join([x.name for x in self.selections]) - - def __repr__(self): - return 'VariantChoice(%s)' % repr(str(self)) - - def __contains__(self, option): - '''Returns true if the given option is selected by this choice.''' - return option in self.selections - - def __eq__(self, other): - return self.selections == other.selections - - def __hash__(self): - return hash(self.selections) - -def AllVariants(axes): - '''Compute a set of all the variants of the given list of axes.''' - all_variants = [[]] - for axis in axes: - all_variants = [variant + [option] - for option in axis.options - for variant in all_variants] - - all_variants = set(map(VariantChoice, all_variants)) - - return all_variants - -def GetOptions(axes): - options = {} - axis_number = 0 - for axis in axes: - for option in axis.options: - if option.name in options: - raise Exception('Duplicate variant option \"%s\" (occurs in axis %s and again in axis %s).' - % (option, options[option][0], axis_number)) - - options[option.name] = (axis_number, option) - - axis_number += 1 - - return options - -def GetAxisChoices(entry, options): - '''Parse a variant selector entry (something like debug-lemon) and -return a dictionary mapping axis numbers to the options chosen on each -axis. options maps option names to pairs (axis_number, option).''' - components = [x.strip() for x in entry.split('-')] - axis_choices = { } - for component in components: - if component not in options: - raise Exception('Invalid build variant "%s"' % component) - - (axis_number, v) = options[component] - if axis_number in axis_choices and axis_choices[axis_number] != v: - raise Exception('Conflicting build variants \"%s\" and \"%s\" in variant selector \"%s\".' - % (axis_choices[axis_number].name, - component, - entry)) - - axis_choices[axis_number] = v - - return axis_choices - -def ParseVariants(axes, variants): - '''Parse a variant selection option. options is a dictionary -mapping axis option names onto pairs (axis_number, variant) where -variant is the Variant object representing the chosen option. axes -is a list of VariantAxis objects. - -Returns a set of VariantChoices representing the variants that match -the given configuration string. If the string is None, returns an -empty set.''' - - if variants is None: - return set() - - # Lame, lazy way of doing this: build a list of the Cartesian - # product of all the lists first. Each entry in this list is a - # list containing a single option from each variant axis. - # - # Lame because it would be better (more scalable) to generate - # these lazily. But for now I expect to have 2-3 axes with - # perhaps 5 entries on an axis, so it would be a waste of time to - # do this better. - # - # Also lame because it's a hideously inefficient algorithm. - all_variants = AllVariants(axes) - options = GetOptions(axes) - - chosen_variants = set() - - entries = [x.strip() for x in variants.split(',')] - for entry in entries: - if entry == 'all': # Magic! - chosen_variants = chosen_variants.union(all_variants) - else: - axis_choices = GetAxisChoices(entry, options) - - # Now, put each variant matching the given axis choices - # into chosen_variants. - for v in all_variants: - matches = True - for axis_number, selection in axis_choices.iteritems(): - if v.selections[axis_number] != selection: - matches = False - break - - if matches: - chosen_variants.add(v) - - return chosen_variants - -def DefineVariants(env, axes, default, disabledf = None): - '''Define the available variants and configure the build for the -ones the user chose. - -Variants are defined on one or more orthogonal axes. Each axis -provides one or more options, and the user can choose from these -options independently. For instance, the first axis might provide -"debug" and "optimized", while the second one provides "lemon" and -"orange". The build directories are named after the axis values in -order, so you get things like "debug-lemon". - -Option names must be unique across all axes; this allows the user to -specify them in any order ("debug,lemon" or "lemon,debug" always mean -the same thing). They should not contain hyphens, to avoid -conflicting with the naming scheme for build directories. - -A command-line variable "VARIANTS=foo" and an option "--variants=foo" -are created, with the variable overriding the option if both are -specified. The argument to this command is a comma-separated list of -"variant selectors" describing which variants to build; all the -variants produced by each selector are built. Variant selectors are -hyphen-separated lists of one or more option names, e.g.: -"lemon-debug" or "optimized-orange"; variants that match the selector -on the axes implied by its options are chosen by that selector. - -disabledf is a function which takes an environment and returns a -string identifying the variants to disable (in the same form as the -argument to --variants). An interface meant to be distributed would -also support defining a static value for this. - -Once variants have been chosen, the caller should use ForEachVariant() -to select the active variants.''' - - if hasattr(env, 'variant_axes'): - raise Exception('Build file error: DefineVariants() was invoked twice.') - - # Generate help text. - helplines = [] - helplines.append('Build variants (set with VARIANTs= or --variants=):') - for axis in axes: - helplines.append(' %s:' % axis.helptext) - for option in axis.options: - line = ' %s' % option.name - if option.helptext is not None: - line += ': %s' % option.helptext - helplines.append(line) - helplines.append('') - - helplines.append('Default variant(s): %s' % default) - - env.Help('\n'.join(helplines)) - - AddOption('--variants', - dest = 'variants', - nargs = 1, - type = 'string', - action = 'store', - metavar = 'VARIANTS', - help = 'build variants', - default = default) - if 'VARIANTS' not in env: - env['VARIANTS'] = GetOption('variants') - - # Save the variant definitions for later use. - env.variant_axes = axes - env.disabled_variants_f = disabledf - -def AllVariantEnvs(env): - '''Create and the environment variants for the given environment. - -Returns one environment for each build variant, specialized for that variant.''' - - if 'VARIANTS' not in env or env['VARIANTS'] is None or not hasattr(env, 'variant_axes'): - raise Exception('No variants defined -- call DefineVariants first.') - - axes = env.variant_axes - active_variants_string = env['VARIANTS'] - disabled_variants_string = env.disabled_variants_f(env) - - active_variants = ParseVariants(axes, active_variants_string) - disabled_variants = ParseVariants(axes, disabled_variants_string) - - for v in active_variants & disabled_variants: - print '*** The variant %s is disabled.' % v - - return [v.BuildEnv(env) for v in active_variants - disabled_variants] - -def GetVariantName(env): - '''If env is a variant directory, return its variant name.''' - - if 'VARIANT' not in env: - raise Exception('Not a variant environment') - - return env['VARIANT'] - -def IsVariantActive(env, variant_pattern): - '''Return true if the given environment is specialized for a build -variant matching the given variant_pattern.''' - - if 'VARIANT' not in env: - return False - - # This is why we need to preserve variant_axes in specialized - # environments -- so we can parse tests like this. - axes = env.variant_axes - active_variant = env['VARIANT'] - active_variants = ParseVariants(axes, active_variant) - if len(active_variants) > 1: - raise Exception('Exactly one variant should be active at a time.') - selected_variants = ParseVariants(axes, variant_pattern) - - return active_variants.issubset(selected_variants) diff --git a/site_scons/site_tools/xgettext.py b/site_scons/site_tools/xgettext.py deleted file mode 100644 index 4450d7de..00000000 --- a/site_scons/site_tools/xgettext.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -from SCons.Script import AddOption, Builder, GetOption, Move - -def exists(): - return True - -def generate(env): - env.Append(BUILDERS = { 'Xgettext' : XgettextBuilder }) - -# A more general solution would pass a lot of this stuff as parameters -# or environment variables. In aptitude, a lot of these arguments are -# always the same, so I can get away with hardcoding them (but -# eventually they should be lifted out to be more hygenic). Also, the -# environment variables here are fairly specific to aptitude's build -# ($PACKAGE and $XGETTEXT). -XgettextBuilder = Builder(action = [['$XGETTEXT', - '--default-domain=$PACKAGE', - '--add-comments=TRANSLATORS:', - '--keyword=_', - '--keyword=N_', - '--keyword=P_', - '--keyword=W_', - '--sort-output', - '--add-comments=ForTranslators:', - '--copyright-holder=Daniel Burrows <dburrows@debian.org>', - '--msgid-bugs-address=aptitude@packages.debian.org', - '-o', '${TARGET}.new', - '$SOURCES'], - Move('$TARGET', '${TARGET}.new')], - suffix = '.pot') diff --git a/site_scons/site_tools/xml-external-entity-scanner.py b/site_scons/site_tools/xml-external-entity-scanner.py deleted file mode 100644 index b12944a4..00000000 --- a/site_scons/site_tools/xml-external-entity-scanner.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (C) 2010 Daniel Burrows -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, -# MA 02111-1307, USA. - -import errno -import xml.parsers.expat -from SCons.Script import File, Scanner - -def exists(): - return True - -def generate(env): - env.Append(SCANNERS = XMLExternalEntitiesScanner) - -def XMLExternalEntities(node, env, path): - - result = [] - - class Finished: - pass - - def entity_decl(entityName, - is_parameter_entity, - value, - base, - systemId, - publicId, - notationName): - if value is None: - result.append(systemId) - - def start_element(name, attrs): - raise Finished() - - try: - infile = file(node.srcnode().path) - except EnvironmentError, e: - if e.errno == errno.ENOENT: - return [] - else: - raise - - try: - parser = xml.parsers.expat.ParserCreate() - parser.StartElementHandler = start_element - parser.EntityDeclHandler = entity_decl - - parser.ParseFile(infile) - except Finished: - pass - except xml.parsers.expat.ExpatError, e: - print e - # Probably an XML syntax error -- don't blow up the scanner - # for that! - pass - finally: - infile.close() - - return result - -XMLExternalEntitiesScanner = Scanner(function = XMLExternalEntities, - skeys = [ '.xml' ], - recursive = True, - ) diff --git a/src/SConscript b/src/SConscript deleted file mode 100644 index fff20276..00000000 --- a/src/SConscript +++ /dev/null @@ -1,142 +0,0 @@ -from aptitude_build import NonHeaders - -Import('programs_env') - - -toplevel_srcs = map(File, [ - 'apt_config_treeitems.cc', - 'apt_config_treeitems.h', - 'apt_config_widgets.cc', - 'apt_config_widgets.h', - 'apt_info_tree.cc', - 'apt_info_tree.h', - 'apt_options.cc', - 'apt_options.h', - 'apt_undo_tree.cc', - 'apt_undo_tree.h', - 'aptitude.h', - 'broken_indicator.cc', - 'broken_indicator.h', - 'defaults.cc', - 'defaults.h', - 'dep_item.cc', - 'dep_item.h', - 'desc_render.cc', - 'desc_render.h', - 'download_item.cc', - 'download_item.h', - 'download_list.cc', - 'download_list.h', - 'download_thread.cc', - 'download_thread.h', - 'edit_pkg_hier.cc', - 'edit_pkg_hier.h', - 'load_config.cc', - 'load_config.h', - 'load_grouppolicy.cc', - 'load_grouppolicy.h', - 'load_pkgview.cc', - 'load_pkgview.h', - 'load_sortpolicy.cc', - 'load_sortpolicy.h', - 'loggers.cc', - 'loggers.h', - 'main.cc', - 'menu_redirect.cc', - 'menu_redirect.h', - 'menu_text_layout.cc', - 'menu_text_layout.h', - 'menu_tree.cc', - 'menu_tree.h', - 'pkg_columnizer.cc', - 'pkg_columnizer.h', - 'pkg_grouppolicy.cc', - 'pkg_grouppolicy.h', - 'pkg_info_screen.cc', - 'pkg_info_screen.h', - 'pkg_item.cc', - 'pkg_item.h', - 'pkg_item_with_subtree.h', - 'pkg_node.cc', - 'pkg_node.h', - 'pkg_sortpolicy.cc', - 'pkg_sortpolicy.h', - 'pkg_subtree.cc', - 'pkg_subtree.h', - 'pkg_tree.cc', - 'pkg_tree.h', - 'pkg_ver_item.cc', - 'pkg_ver_item.h', - 'pkg_view.cc', - 'pkg_view.h', - 'progress.cc', - 'progress.h', - 'reason_fragment.cc', - 'reason_fragment.h', - 'safe_slot_event.h', - 'solution_dialog.cc', - 'solution_dialog.h', - 'solution_fragment.cc', - 'solution_fragment.h', - 'solution_item.cc', - 'solution_item.h', - 'solution_screen.cc', - 'solution_screen.h', - 'trust.cc', - 'trust.h', - 'ui.cc', - 'ui.h', - 'ui_download_manager.cc', - 'ui_download_manager.h', - 'view_changelog.cc', - 'view_changelog.h', - ]) - -sub_srcs = SConscript(dirs = [ - 'cmdline', - 'generic', - 'mine', - ]) - -# Note: always load the GTK+ sources (for dist, etc) even if we aren't -# building that variant. -gtk_srcs = SConscript(dirs = [ - 'gtk' - ]) - -# All the aptitude sources, including things that might not be built -# in all variants: -all_aptitude_srcs = Flatten((toplevel_srcs, gtk_srcs, sub_srcs)) - -# Distribute the build files. -programs_env.Dist('SConscript', 'Makefile.am') - -# Note: always distribute all the source, even if it's not being -# built. -programs_env.Dist(all_aptitude_srcs) - -if programs_env.IsVariantActive('gtk'): - aptitude_srcs = all_aptitude_srcs -else: - aptitude_srcs = Flatten([toplevel_srcs, sub_srcs]) - -aptitude = programs_env.Program(target = 'aptitude', source = NonHeaders(aptitude_srcs)) -# Note that this will cause a build failure if you try to install with -# several variants active. This is as it should be! If you want to -# install aptitude, you need to pick a particular variant to install. -programs_env.Install(aptitude) - -if programs_env.IsVariantActive('gtk'): - # Force the .glade file to be copied to the build directory. Note - # the use of Requires to ensure that the glade is available for - # aptitude, without forcing aptitude to be relinked because it - # changed. - aptitude_glade = programs_env.Command('gtk/aptitude.glade', - '#/src/gtk/aptitude.glade', - Copy('$TARGET', '$SOURCE')) - programs_env.Install(programs_env['BINDIR'], 'gtk/aptitude.glade') - programs_env.Requires(aptitude, aptitude_glade) - -programs_env.Alias('programs', aptitude) - -Return('aptitude', 'all_aptitude_srcs') diff --git a/src/cmdline/SConscript b/src/cmdline/SConscript deleted file mode 100644 index b87f9f79..00000000 --- a/src/cmdline/SConscript +++ /dev/null @@ -1,75 +0,0 @@ -Import('programs_env') - -src_filenames = [ - 'cmdline_action.cc', - 'cmdline_action.h', - 'cmdline_changelog.cc', - 'cmdline_changelog.h', - 'cmdline_check_resolver.cc', - 'cmdline_check_resolver.h', - 'cmdline_clean.cc', - 'cmdline_clean.h', - 'cmdline_common.h', - 'cmdline_do_action.cc', - 'cmdline_do_action.h', - 'cmdline_download.cc', - 'cmdline_download.h', - 'cmdline_dump_resolver.cc', - 'cmdline_dump_resolver.h', - 'cmdline_extract_cache_subset.cc', - 'cmdline_extract_cache_subset.h', - 'cmdline_forget_new.cc', - 'cmdline_forget_new.h', - 'cmdline_main_loop.cc', - 'cmdline_main_loop.h', - 'cmdline_moo.cc', - 'cmdline_moo.h', - 'cmdline_progress.cc', - 'cmdline_progress.h', - 'cmdline_progress_display.cc', - 'cmdline_progress_display.h', - 'cmdline_prompt.cc', - 'cmdline_prompt.h', - 'cmdline_resolver.cc', - 'cmdline_resolver.h', - 'cmdline_search.cc', - 'cmdline_search.h', - 'cmdline_search_progress.cc', - 'cmdline_search_progress.h', - 'cmdline_show.cc', - 'cmdline_show.h', - 'cmdline_show_broken.cc', - 'cmdline_show_broken.h', - 'cmdline_simulate.cc', - 'cmdline_simulate.h', - 'cmdline_spinner.cc', - 'cmdline_spinner.h', - 'cmdline_update.cc', - 'cmdline_update.h', - 'cmdline_user_tag.cc', - 'cmdline_user_tag.h', - 'cmdline_util.cc', - 'cmdline_util.h', - 'cmdline_versions.cc', - 'cmdline_versions.h', - 'cmdline_why.cc', - 'cmdline_why.h', - 'terminal.cc', - 'terminal.h', - 'text_progress.cc', - 'text_progress.h', - 'transient_message.cc', - 'transient_message.h', - ] - -local_srcs = map(File, src_filenames) - -sub_srcs = SConscript(dirs = [ - 'mocks' - ]) - -srcs = (local_srcs, sub_srcs) - -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/src/cmdline/mocks/SConscript b/src/cmdline/mocks/SConscript deleted file mode 100644 index ae8662ef..00000000 --- a/src/cmdline/mocks/SConscript +++ /dev/null @@ -1,21 +0,0 @@ -Import('programs_env') - -# No sources because then scons tries to link them into the program! -srcs = map(File, [ - ]) - -programs_env.Dist( - 'cmdline_progress_display.h', - 'cmdline_progress_throttle.h', - 'download_status_display.cc', - 'download_status_display.h', - 'teletype.cc', - 'teletype.h', - 'terminal.cc', - 'terminal.h', - 'transient_message.h', - ) - -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/src/generic/SConscript b/src/generic/SConscript deleted file mode 100644 index e434e8fa..00000000 --- a/src/generic/SConscript +++ /dev/null @@ -1,12 +0,0 @@ -Import('programs_env') -programs_env.Dist('Makefile.am', 'SConscript') - -sub_srcs = SConscript(dirs = [ - 'apt', - 'controllers', - 'problemresolver', - 'util', - 'views', - ]) - -Return('sub_srcs') diff --git a/src/generic/apt/SConscript b/src/generic/apt/SConscript deleted file mode 100644 index 19ba5d23..00000000 --- a/src/generic/apt/SConscript +++ /dev/null @@ -1,88 +0,0 @@ -Import('programs_env') - -toplevel_srcs = map(File, [ - 'apt.cc', - 'apt.h', - 'apt_undo_group.cc', - 'apt_undo_group.h', - 'aptcache.cc', - 'aptcache.h', - 'aptitude_resolver.cc', - 'aptitude_resolver.h', - 'aptitude_resolver_cost_settings.cc', - 'aptitude_resolver_cost_settings.h', - 'aptitude_resolver_cost_syntax.cc', - 'aptitude_resolver_cost_syntax.h', - 'aptitude_resolver_cost_types.cc', - 'aptitude_resolver_cost_types.h', - 'aptitude_resolver_universe.cc', - 'aptitude_resolver_universe.h', - 'aptitudepolicy.cc', - 'aptitudepolicy.h', - 'changelog_parse.cc', - 'changelog_parse.h', - 'config_signal.cc', - 'config_signal.h', - 'desc_parse.cc', - 'desc_parse.h', - 'download_install_manager.cc', - 'download_install_manager.h', - 'download_manager.cc', - 'download_manager.h', - 'download_queue.cc', - 'download_queue.h', - 'download_signal_log.cc', - 'download_signal_log.h', - 'download_update_manager.cc', - 'download_update_manager.h', - 'dump_packages.cc', - 'dump_packages.h', - 'globals.cc', - 'infer_reason.cc', - 'infer_reason.h', - 'log.cc', - 'log.h', - 'parse_dpkg_status.cc', - 'parse_dpkg_status.h', - 'pkg_acqfile.cc', - 'pkg_acqfile.h', - 'pkg_changelog.cc', - 'pkg_changelog.h', - 'pkg_hier.cc', - 'pkg_hier.h', - 'resolver_manager.cc', - 'resolver_manager.h', - 'rev_dep_iterator.h', - 'screenshot.cc', - 'screenshot.h', - 'tags.cc', - 'tags.h', - 'tasks.cc', - 'tasks.h', - ]) - -sub_srcs = SConscript(dirs = [ - 'history', - 'matching', - ]) - -srcs = (toplevel_srcs, sub_srcs) - -pkg_hier_dump = programs_env.Program(target = 'pkg_hier_dump', - source = [ - 'pkg_hier.cc', - 'pkg_hier_dump.cc', - ]) - -# This won't be distributed otherwise since it's not part of aptitude -# proper: -programs_env.Dist('pkg_hier_dump.cc') -programs_env.Alias('programs', pkg_hier_dump) - -# Data to distribute: -programs_env.Dist('README.hier') - -# Distribute the build files: -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/src/generic/apt/history/SConscript b/src/generic/apt/history/SConscript deleted file mode 100644 index 33b07248..00000000 --- a/src/generic/apt/history/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -Import('programs_env') -programs_env.Dist('Makefile.am', 'SConscript') - -srcs = map(File, [ - 'history_entry.cc', - 'history_entry.h', - ]) - -Return('srcs') diff --git a/src/generic/apt/matching/SConscript b/src/generic/apt/matching/SConscript deleted file mode 100644 index ccfcb460..00000000 --- a/src/generic/apt/matching/SConscript +++ /dev/null @@ -1,18 +0,0 @@ -Import('programs_env') - -srcs = map(File, [ - 'compare_patterns.cc', - 'compare_patterns.h', - 'match.cc', - 'match.h', - 'parse.cc', - 'parse.h', - 'pattern.cc', - 'pattern.h', - 'serialize.cc', - 'serialize.h', - ]) - -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/src/generic/controllers/SConscript b/src/generic/controllers/SConscript deleted file mode 100644 index a428eab3..00000000 --- a/src/generic/controllers/SConscript +++ /dev/null @@ -1,10 +0,0 @@ -Import('programs_env') - -srcs = map(File, [ - 'search_input.cc', - 'search_input.h', - ]) - -programs_env.Dist('Makefile.am', 'README', 'SConscript') - -Return('srcs') diff --git a/src/generic/problemresolver/SConscript b/src/generic/problemresolver/SConscript deleted file mode 100644 index 110471af..00000000 --- a/src/generic/problemresolver/SConscript +++ /dev/null @@ -1,48 +0,0 @@ -from aptitude_build import NonHeaders - -srcs = map(File, [ - 'choice.h', - 'choice_indexed_map.h', - 'choice_set.h', - 'cost.cc', - 'cost.h', - 'cost_limits.cc', - 'cost_limits.h', - 'dummy_universe.cc', - 'dummy_universe.h', - 'dump_universe.h', - 'exceptions.h', - 'incremental_expression.cc', - 'incremental_expression.h', - 'problemresolver.h', - 'promotion_set.h', - 'resolver_undo.h', - 'sanity_check_universe.h', - 'search_graph.h', - 'solution.h', - ]) - -test_extra_deps = [ - '../util/logging.o', - '../util/refcounted_base.o', - ] - -Import('programs_env') - -test = programs_env.Program(target = 'test', - source = [ - 'test.cc', - NonHeaders(srcs), - test_extra_deps, - ]) - - -# This won't be distributed otherwise since it's not part of aptitude: -programs_env.Dist('test.cc') -programs_env.Alias('programs', test) - -# Data to distribute: -programs_env.Dist('model.tex', 'test1.txt', 'test3.txt', 'test4.txt') -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/src/generic/util/SConscript b/src/generic/util/SConscript deleted file mode 100644 index 0615eac0..00000000 --- a/src/generic/util/SConscript +++ /dev/null @@ -1,49 +0,0 @@ -Import('programs_env') - -srcs = map(File, [ - 'compare3.h', - 'dense_setset.h', - 'dirent_safe.h', - 'dynamic_list.h', - 'dynamic_list_collection.h', - 'dynamic_list_impl.h', - 'dynamic_set.h', - 'dynamic_set_transform.h', - 'dynamic_set_union.h', - 'enumerator.h', - 'enumerator_transform.h', - 'file_cache.cc', - 'file_cache.h', - 'immlist.h', - 'immset.h', - 'job_queue_thread.h', - 'logging.cc', - 'logging.h', - 'maybe.h', - 'mut_fun.h', - 'parsers.h', - 'post_thunk.h', - 'progress_info.cc', - 'progress_info.h', - 'refcounted_base.cc', - 'refcounted_base.h', - 'refcounted_wrapper.h', - 'safe_slot.h', - 'setset.h', - 'sqlite.cc', - 'sqlite.h', - 'temp.cc', - 'temp.h', - 'throttle.cc', - 'throttle.h', - 'undo.cc', - 'undo.h', - 'util.cc', - 'util.h', - ]) - -programs_env.Dist('Makefile.am', 'SConscript') - -SConscript(dirs = [ 'mocks' ]) - -Return('srcs') diff --git a/src/generic/util/mocks/SConscript b/src/generic/util/mocks/SConscript deleted file mode 100644 index fffd9451..00000000 --- a/src/generic/util/mocks/SConscript +++ /dev/null @@ -1,3 +0,0 @@ -Import('programs_env') - -programs_env.Dist('mock_util.h', 'throttle.h') diff --git a/src/generic/views/SConscript b/src/generic/views/SConscript deleted file mode 100644 index 8c5a3a7b..00000000 --- a/src/generic/views/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -Import('programs_env') - -srcs = map(File, [ - 'download_progress.cc', - 'download_progress.h', - 'progress.cc', - 'progress.h', - 'search_input.cc', - 'search_input.h' - ]) - -programs_env.Dist('Makefile.am', 'README', 'SConscript') - -SConscript(dirs = [ 'mocks' ]) - -Return('srcs') diff --git a/src/generic/views/mocks/SConscript b/src/generic/views/mocks/SConscript deleted file mode 100644 index 17e7869d..00000000 --- a/src/generic/views/mocks/SConscript +++ /dev/null @@ -1,6 +0,0 @@ -Import('programs_env') - -programs_env.Dist( - 'download_progress.cc', - 'download_progress.h', - 'progress.h') diff --git a/src/gtk/SConscript b/src/gtk/SConscript deleted file mode 100644 index 23e456e6..00000000 --- a/src/gtk/SConscript +++ /dev/null @@ -1,76 +0,0 @@ -Import('programs_env') - -toplevel_srcs = map(File, [ - 'areas.cc', - 'areas.h', - 'changelog.cc', - 'changelog.h', - 'constants.h', - 'dashboardtab.cc', - 'dashboardtab.h', - 'dependency_chains_tab.cc', - 'dependency_chains_tab.h', - 'download.cc', - 'download.h', - 'dpkg_terminal.cc', - 'dpkg_terminal.h', - 'entitysummary.cc', - 'entitysummary.h', - 'entityview.cc', - 'entityview.h', - 'errortab.cc', - 'errortab.h', - 'filesview.cc', - 'filesview.h', - 'globals.cc', - 'globals.h', - 'gui.cc', - 'gui.h', - 'hyperlink.cc', - 'hyperlink.h', - 'info.cc', - 'info.h', - 'init.cc', - 'init.h', - 'mainwindow.cc', - 'mainwindow.h', - 'notify.cc', - 'notify.h', - 'packageinformation.cc', - 'packageinformation.h', - 'packagestab.cc', - 'packagestab.h', - 'pkgview.cc', - 'pkgview.h', - 'post_event.cc', - 'post_event.h', - 'previewtab.cc', - 'previewtab.h', - 'progress.cc', - 'progress.h', - 'resolver.cc', - 'resolver.h', - 'screenshot.cc', - 'screenshot.h', - 'screenshot_cache.cc', - 'screenshot_cache.h', - 'tab.cc', - 'tab.h', - 'treeview_cell_tooltips.cc', - 'treeview_cell_tooltips.h', - ]) - -sub_srcs = SConscript(dirs = [ - 'toplevel', - 'util', - 'view-impls', - ]) - -srcs = (toplevel_srcs, sub_srcs) - -# Distribute the build files. -programs_env.Dist('Makefile.am', 'SConscript') - -programs_env.Dist('aptitude.glade') - -Return('srcs') diff --git a/src/gtk/toplevel/SConscript b/src/gtk/toplevel/SConscript deleted file mode 100644 index e9f8b514..00000000 --- a/src/gtk/toplevel/SConscript +++ /dev/null @@ -1,17 +0,0 @@ -Import('programs_env') - -toplevel_srcs = map(File, [ - 'model.cc', - 'model.h', - 'sidebar.h', - 'tabs_notebook.cc', - 'tabs_notebook.h', - 'view.h' - ]) - -srcs = toplevel_srcs - -# Distribute the build files. -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/src/gtk/util/SConscript b/src/gtk/util/SConscript deleted file mode 100644 index 37c27e8a..00000000 --- a/src/gtk/util/SConscript +++ /dev/null @@ -1,9 +0,0 @@ -Import('programs_env') - -srcs = map(File, [ - 'property.h', - ]) - -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/src/gtk/view-impls/SConscript b/src/gtk/view-impls/SConscript deleted file mode 100644 index 17412c23..00000000 --- a/src/gtk/view-impls/SConscript +++ /dev/null @@ -1,10 +0,0 @@ -Import('programs_env') - -srcs = map(File, [ - 'search_input_entry.cc', - 'search_input_entry.h', - ]) - -programs_env.Dist('Makefile.am', 'README', 'SConscript') - -Return('srcs') diff --git a/src/mine/SConscript b/src/mine/SConscript deleted file mode 100644 index f0a38fc5..00000000 --- a/src/mine/SConscript +++ /dev/null @@ -1,16 +0,0 @@ -Import('programs_env') - -srcs = map(File, [ - 'cmine.cc', - 'cmine.h', - 'board.cc', - 'board.h', - ]) - -helptexts = Glob('mine-help-??.txt') + Glob('mine-help-??_??.txt') - -programs_env.Dist(helptexts) - -programs_env.Dist('Makefile.am', 'SConscript') - -Return('srcs') diff --git a/tests/SConscript b/tests/SConscript deleted file mode 100644 index 1f75e0d4..00000000 --- a/tests/SConscript +++ /dev/null @@ -1,158 +0,0 @@ -from aptitude_build import CString -from aptitude_build import ShellEscape -import os.path - -Import('base_env') -Import('cppunit_tests_env') -Import('boost_tests_env') -Import('gtest_tests_env') -base_env.Dist('Makefile.am', 'SConscript') - -cppunit_test_sources = [ - 'cppunit_test_main.cc', - 'test_choice.cc', - 'test_choice_set.cc', - 'test_config_pusher.cc', - 'test_dense_setset.cc', - 'test_incremental_expression.cc', - 'test_matching.cc', - 'test_misc.cc', - 'test_parsers.cc', - 'test_promotion_set.cc', - 'test_resolver.cc', - 'test_resolver_costs.cc', - 'test_resolver_hints.cc', - 'test_setset.cc', - 'test_tags.cc', - 'test_temp.cc', - 'test_wtree.cc', - ] - -cppunit_test_extra_deps = [ - '../src/generic/apt/apt.o', - '../src/generic/apt/aptcache.o', - '../src/generic/apt/aptitude_resolver.o', - '../src/generic/apt/aptitude_resolver_cost_settings.o', - '../src/generic/apt/aptitude_resolver_cost_syntax.o', - '../src/generic/apt/aptitude_resolver_cost_types.o', - '../src/generic/apt/aptitude_resolver_universe.o', - '../src/generic/apt/aptitudepolicy.o', - '../src/generic/apt/config_signal.o', - '../src/generic/apt/download_queue.o', - '../src/generic/apt/dump_packages.o', - '../src/generic/apt/globals.o', - '../src/generic/apt/matching/compare_patterns.o', - '../src/generic/apt/matching/match.o', - '../src/generic/apt/matching/parse.o', - '../src/generic/apt/matching/pattern.o', - '../src/generic/apt/matching/serialize.o', - '../src/generic/apt/pkg_hier.o', - '../src/generic/apt/resolver_manager.o', - '../src/generic/apt/tags.o', - '../src/generic/apt/tasks.o', - '../src/generic/problemresolver/cost.o', - '../src/generic/problemresolver/cost_limits.o', - '../src/generic/problemresolver/dummy_universe.o', - '../src/generic/problemresolver/incremental_expression.o', - '../src/generic/util/file_cache.o', - '../src/generic/util/logging.o', - '../src/generic/util/refcounted_base.o', - '../src/generic/util/sqlite.o', - '../src/generic/util/temp.o', - '../src/generic/util/undo.o', - '../src/generic/util/util.o', - '../src/loggers.o', - ] - -boost_test_sources = [ - 'boost_test_main.cc', - 'test_dynamic_list.cc', - 'test_dynamic_set.cc', - 'test_enumerator.cc', - 'test_file_cache.cc', - 'test_search_input_controller.cc', - 'test_sqlite.cc' - ] - -boost_test_extra_deps = [ - '../src/generic/apt/globals.o', - '../src/generic/apt/matching/compare_patterns.o', - '../src/generic/apt/matching/parse.o', - '../src/generic/apt/matching/pattern.o', - '../src/generic/controllers/search_input.o', - '../src/generic/util/file_cache.o', - '../src/generic/util/logging.o', - '../src/generic/util/refcounted_base.o', - '../src/generic/util/sqlite.o', - '../src/generic/util/temp.o', - '../src/generic/util/util.o', - '../src/generic/views/search_input.o', - '../src/loggers.o', - ] - -gtest_test_sources = [ - 'gtest_test_main.cc', - 'test_cmdline_download_progress_display.cc', - 'test_cmdline_download_status_display.cc', - 'test_cmdline_progress_display.cc', - 'test_cmdline_search_progress.cc', - 'test_logging.cc', - 'test_teletype_mock.cc', - 'test_terminal_mock.cc', - 'test_transient_message.o', - ] - -gtest_test_extra_deps = [ - '../src/cmdline/cmdline_download_progress_display.o', - '../src/cmdline/cmdline_progress_display.o', - '../src/cmdline/cmdline_search_progress.o', - '../src/cmdline/mocks/teletype.o', - '../src/cmdline/mocks/terminal.o', - '../src/cmdline/terminal.o', - '../src/cmdline/transient_message.o', - '../src/generic/apt/globals.o', - '../src/generic/util/logging.o', - '../src/generic/util/progress_info.o', - '../src/generic/util/throttle.o', - '../src/generic/util/util.o', - '../src/generic/views/download_progress.o', - '../src/generic/views/mocks/download_progress.o', - '../src/generic/views/progress.o', - '../src/loggers.o', - ] - -test_data_files = [ - 'file_caches/ver2_cache.db', - 'file_caches/ver3_cache.db', - ] - -boost_tests_env.Dist(boost_test_sources, - cppunit_test_sources, - gtest_test_sources, - test_data_files) - -cppunit_test = cppunit_tests_env.Test('cppunit_test', - (cppunit_test_sources, - cppunit_test_extra_deps)) - -# The file cache test uses this to find its input data. It must be -# the path of the parent of the file_caches directory, relative to the -# path of the test executable. Since those are the same directory, -# "." is correct. -boost_tests_env.Append(CPPDEFINES = ('SRCDIR', ShellEscape(CString('.')))) - -boost_test = boost_tests_env.Test('boost_test', - (boost_test_sources, - boost_test_extra_deps)) - -gtest_test = gtest_tests_env.Test('gtest_test', - (gtest_test_sources, - gtest_test_extra_deps)) - -# Ensure that the test file caches are copied to the build directory. -for test_input in test_data_files: - test_file = boost_tests_env.Command(test_input, - os.path.join('#', 'tests', test_input), - Copy('$TARGET', '$SOURCE')) - boost_tests_env.Requires(boost_test, test_file) - |