summaryrefslogtreecommitdiff
path: root/gnulib-tool.py
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2022-08-03 22:29:52 +0200
committerBruno Haible <bruno@clisp.org>2022-08-04 01:51:24 +0200
commitde028fc3637de15c3c0535e168bc5dda6a6084e6 (patch)
treece2c1cbe871a38f016fa8bec573a19e24cd37550 /gnulib-tool.py
parent1e57719d520683d08e8646fb2b778aa9d9afb294 (diff)
downloadgnulib-de028fc3637de15c3c0535e168bc5dda6a6084e6.tar.gz
gnulib-tool.py: Implement options --without-c++-tests etc.
* gnulib-tool.py (main): Accept options --without-c++-tests, --without-longrunning-tests, --without-privileged-tests, --without-unportable-tests. Improve error message for --copy-file with invalid number of arguments. Check for invalid options given in --import, --add-import, --remove-import, --update modes. Pass both sets of test categories to the GLConfig constructor. * pygnulib/GLConfig.py (GLConfig.__init__): Accept incl_test_categories and excl_test_categories instead of testflags. (checkInclTestCategory): Renamed from checkTestFlag. (enableInclTestCategory): Renamed from enableTestFlag. (disableInclTestCategory): Renamed from disableTestFlag. (getInclTestCategories): Renamed from getTestFlags. (setInclTestCategories): Renamed from setTestFlags. (resetInclTestCategories): Renamed from resetTestFlags. (setInclTestCategory, checkExclTestCategory, enableExclTestCategory, disableExclTestCategory, getExclTestCategories, setExclTestCategories, resetExclTestCategories): New methods. * pygnulib/GLModuleSystem.py (GLModuleTable.__init__): Accept two booleans as second and third constructor arguments. (transitive_closure): Correct the determination of whether to include each module, depending on the with-* and without-* options. (transitive_closure_separately): Update. * pygnulib/GLMakefileTable.py: Update. * pygnulib/GLImport.py (__init__, actioncmd, gnulib_cache, execute): Update. * pygnulib/GLTestDir.py (GLTestDir.__init__, GLTestDir.execute, GLMegaTestDir.__init__): Update.
Diffstat (limited to 'gnulib-tool.py')
-rwxr-xr-xgnulib-tool.py104
1 files changed, 79 insertions, 25 deletions
diff --git a/gnulib-tool.py b/gnulib-tool.py
index efe3b1e1d6..bf7b98a61e 100755
--- a/gnulib-tool.py
+++ b/gnulib-tool.py
@@ -262,22 +262,38 @@ def main():
action='store_true')
# c++-tests
parser.add_argument('--with-c++-tests',
- dest='cxx',
+ dest='inc_cxx_tests',
+ default=None,
+ action='store_true')
+ parser.add_argument('--without-c++-tests',
+ dest='excl_cxx_tests',
default=None,
action='store_true')
# longrunning-tests
parser.add_argument('--with-longrunning-tests',
- dest='longrunning',
+ dest='inc_longrunning_tests',
+ default=None,
+ action='store_true')
+ parser.add_argument('--without-longrunning-tests',
+ dest='excl_longrunning_tests',
default=None,
action='store_true')
# privileged-tests
parser.add_argument('--with-privileged-tests',
- dest='privileged',
+ dest='inc_privileged_tests',
+ default=None,
+ action='store_true')
+ parser.add_argument('--without-privileged-tests',
+ dest='excl_privileged_tests',
default=None,
action='store_true')
# unportable-tests
parser.add_argument('--with-unportable-tests',
- dest='unportable',
+ dest='inc_unportable_tests',
+ default=None,
+ action='store_true')
+ parser.add_argument('--without-unportable-tests',
+ dest='excl_unportable_tests',
default=None,
action='store_true')
# all-tests
@@ -491,12 +507,40 @@ def main():
mode = 'copy-file'
if len(cmdargs.non_option_arguments) < 1 or len(cmdargs.non_option_arguments) > 2:
message = '%s: *** ' % constants.APP['name']
- message += 'invalid number of arguments for --%s' % mode
- message += '\n%s: *** Stop.\n' % constants.APP['name']
+ message += 'invalid number of arguments for --%s\n' % mode
+ message += 'Try \'gnulib-tool --help\' for more information.\n'
+ message += '%s: *** Stop.\n' % constants.APP['name']
sys.stderr.write(message)
sys.exit(1)
files = list(cmdargs.non_option_arguments)
+ if ((mode in ['import', 'add-import', 'remove-import']
+ and (cmdargs.excl_cxx_tests or cmdargs.excl_longrunning_tests
+ or cmdargs.excl_privileged_tests or cmdargs.excl_unportable_tests))
+ or (mode == 'update'
+ and (cmdargs.localpath != None or cmdargs.libname != None
+ or cmdargs.sourcebase != None or cmdargs.m4base != None
+ or cmdargs.pobase != None or cmdargs.docbase != None
+ or cmdargs.testsbase != None or cmdargs.auxdir != None
+ or cmdargs.inctests != None or cmdargs.obsolete != None
+ or cmdargs.inc_cxx_tests != None
+ or cmdargs.inc_longrunning_tests != None
+ or cmdargs.inc_privileged_tests != None
+ or cmdargs.inc_unportable_tests != None
+ or cmdargs.alltests != None
+ or cmdargs.excl_cxx_tests != None
+ or cmdargs.excl_longrunning_tests != None
+ or cmdargs.excl_privileged_tests != None
+ or cmdargs.excl_unportable_tests != None
+ or cmdargs.avoids != None or cmdargs.lgpl != None
+ or cmdargs.makefile != None))):
+ message = '%s: *** ' % constants.APP['name']
+ message += 'invalid options for --%s mode\n' % mode
+ message += 'Try \'gnulib-tool --help\' for more information.\n'
+ message += '%s: *** Stop.\n' % constants.APP['name']
+ sys.stderr.write(message)
+ sys.exit(1)
+
# Determine specific settings.
destdir = cmdargs.destdir
if destdir != None:
@@ -533,21 +577,30 @@ def main():
inctests = False
elif mode in ['create-testdir', 'create-megatestdir', 'test', 'megatest']:
inctests = True
- testflags = []
+ incl_test_categories = []
if inctests:
- testflags += [constants.TESTS['tests']]
+ incl_test_categories += [constants.TESTS['tests']]
if cmdargs.obsolete:
- testflags += [constants.TESTS['obsolete']]
- if cmdargs.cxx:
- testflags += [constants.TESTS['cxx-tests']]
- if cmdargs.longrunning:
- testflags += [constants.TESTS['longrunning-tests']]
- if cmdargs.privileged:
- testflags += [constants.TESTS['privileged-tests']]
- if cmdargs.unportable:
- testflags += [constants.TESTS['unportable-tests']]
+ incl_test_categories += [constants.TESTS['obsolete']]
+ if cmdargs.inc_cxx_tests:
+ incl_test_categories += [constants.TESTS['cxx-tests']]
+ if cmdargs.inc_longrunning_tests:
+ incl_test_categories += [constants.TESTS['longrunning-tests']]
+ if cmdargs.inc_privileged_tests:
+ incl_test_categories += [constants.TESTS['privileged-tests']]
+ if cmdargs.inc_unportable_tests:
+ incl_test_categories += [constants.TESTS['unportable-tests']]
if cmdargs.alltests:
- testflags += [constants.TESTS['all-tests']]
+ incl_test_categories += [constants.TESTS['all-tests']]
+ excl_test_categories = []
+ if cmdargs.excl_cxx_tests:
+ excl_test_categories += [constants.TESTS['cxx-tests']]
+ if cmdargs.excl_longrunning_tests:
+ excl_test_categories += [constants.TESTS['longrunning-tests']]
+ if cmdargs.excl_privileged_tests:
+ excl_test_categories += [constants.TESTS['privileged-tests']]
+ if cmdargs.excl_unportable_tests:
+ excl_test_categories += [constants.TESTS['unportable-tests']]
lgpl = cmdargs.lgpl
if lgpl != None:
lgpl = lgpl[-1]
@@ -575,7 +628,8 @@ def main():
pobase=pobase,
docbase=docbase,
testsbase=testsbase,
- testflags=testflags,
+ incl_test_categories=incl_test_categories,
+ excl_test_categories=excl_test_categories,
libname=libname,
lgpl=lgpl,
makefile=makefile,
@@ -721,8 +775,8 @@ def main():
elif mode == 'create-testdir':
if not destdir:
message = '%s: *** ' % constants.APP['name']
- message += 'please specify --dir option'
- message += '\n%s: *** Stop.\n' % constants.APP['name']
+ message += 'please specify --dir option\n'
+ message += '%s: *** Stop.\n' % constants.APP['name']
sys.stderr.write(message)
sys.exit(1)
if not auxdir:
@@ -734,8 +788,8 @@ def main():
elif mode == 'create-megatestdir':
if not destdir:
message = '%s: *** ' % constants.APP['name']
- message += 'please specify --dir option'
- message += '\n%s: *** Stop.\n' % constants.APP['name']
+ message += 'please specify --dir option\n'
+ message += '%s: *** Stop.\n' % constants.APP['name']
sys.stderr.write(message)
sys.exit(1)
if not auxdir:
@@ -977,8 +1031,8 @@ def main():
else:
message = '%s: *** ' % constants.APP['name']
- message += 'no mode specified'
- message += '\n%s: *** Stop.\n' % constants.APP['name']
+ message += 'no mode specified\n'
+ message += '%s: *** Stop.\n' % constants.APP['name']
sys.stderr.write(message)
sys.exit(1)