* gnulib-tool.sh: Accept --gnulib-dir=... option.
* pygnulib/constants.py (init_DIRS): New function.
* pygnulib/main.py (main): Accept --gnulib-dir=... option. Invoke
init_DIRS. Expect .git directory to be present in DIRS['root'], not
APP['root'].
* pygnulib/GLImport.py (GLImport.execute): Use DIRS['root'], not
APP['root'].
+2024-03-17 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Add undocumented option --gnulib-dir.
+ * gnulib-tool.sh: Accept --gnulib-dir=... option.
+ * pygnulib/constants.py (init_DIRS): New function.
+ * pygnulib/main.py (main): Accept --gnulib-dir=... option. Invoke
+ init_DIRS. Expect .git directory to be present in DIRS['root'], not
+ APP['root'].
+ * pygnulib/GLImport.py (GLImport.execute): Use DIRS['root'], not
+ APP['root'].
+
2024-03-17 Collin Funk <collin.funk1@gmail.com>
gnulib-tool.py: Follow gnulib-tool changes, part 61.
--version | --versio | --versi | --vers )
func_version
func_exit $? ;;
+ # Undocumented option. Only used for the gnulib-tool test suite.
+ --gnulib-dir=* )
+ gnulib_dir=`echo "X$1" | sed -e 's/^X--gnulib-dir=//'`
+ shift ;;
-- )
# Stop option processing
shift
self.moduletable['main'], self.moduletable, self.makefiletable,
actioncmd, for_test)
if automake_subdir:
- emit = sp.run([joinpath(APP['root'], 'build-aux/prefix-gnulib-mk'), '--from-gnulib-tool',
+ emit = sp.run([joinpath(DIRS['root'], 'build-aux/prefix-gnulib-mk'), '--from-gnulib-tool',
f'--lib-name={libname}', f'--prefix={sourcebase}/'],
input=emit, text=True, capture_output=True).stdout
with codecs.open(tmpfile, 'wb', 'UTF-8') as file:
APP['name'] = os.path.join(APP['root'], 'gnulib-tool.py')
# Set DIRS directory
-DIRS['root'] = APP['root']
DIRS['cwd'] = os.getcwd()
-DIRS['build-aux'] = os.path.join(DIRS['root'], 'build-aux')
-DIRS['config'] = os.path.join(DIRS['root'], 'config')
-DIRS['doc'] = os.path.join(DIRS['root'], 'doc')
-DIRS['lib'] = os.path.join(DIRS['root'], 'lib')
-DIRS['m4'] = os.path.join(DIRS['root'], 'm4')
-DIRS['modules'] = os.path.join(DIRS['root'], 'modules')
-DIRS['tests'] = os.path.join(DIRS['root'], 'tests')
-DIRS['git'] = os.path.join(DIRS['root'], '.git')
-DIRS['cvs'] = os.path.join(DIRS['root'], 'CVS')
+def init_DIRS(gnulib_dir):
+ DIRS['root'] = gnulib_dir
+ DIRS['build-aux'] = os.path.join(gnulib_dir, 'build-aux')
+ DIRS['config'] = os.path.join(gnulib_dir, 'config')
+ DIRS['doc'] = os.path.join(gnulib_dir, 'doc')
+ DIRS['lib'] = os.path.join(gnulib_dir, 'lib')
+ DIRS['m4'] = os.path.join(gnulib_dir, 'm4')
+ DIRS['modules'] = os.path.join(gnulib_dir, 'modules')
+ DIRS['tests'] = os.path.join(gnulib_dir, 'tests')
+ DIRS['git'] = os.path.join(gnulib_dir, '.git')
+ DIRS['cvs'] = os.path.join(gnulib_dir, 'CVS')
# Set MODES dictionary
MODES = \
dest='lcopymode',
default=None,
action='store_const', const=classes.CopyAction.Hardlink)
+ # Undocumented option. Only used for the gnulib-tool test suite.
+ parser.add_argument('--gnulib-dir',
+ dest='gnulib_dir',
+ default=None,
+ nargs=1)
# All other arguments are collected.
parser.add_argument("non_option_arguments",
nargs='*')
# occur between or after options.
cmdargs, unhandled = parser.parse_known_args()
+ # Handle --gnulib-dir and finalize DIRS.
+ gnulib_dir = cmdargs.gnulib_dir
+ if gnulib_dir != None:
+ gnulib_dir = gnulib_dir[0]
+ else:
+ gnulib_dir = APP['root']
+ constants.init_DIRS(gnulib_dir)
+
# Handle --help and --version, ignoring all other options.
if cmdargs.help != None:
print(info.usage())
# This disturbs the result of the next "gitk" invocation.
# Workaround: Let git scan the files. This can be done through
# "git update-index --refresh" or "git status" or "git diff".
- if isdir(joinpath(APP['root'], '.git')):
+ if isdir(joinpath(DIRS['root'], '.git')):
try:
sp.run(['git', 'update-index', '--refresh'],
- cwd=APP['root'], stdout=sp.DEVNULL)
+ cwd=DIRS['root'], stdout=sp.DEVNULL)
except FileNotFoundError:
# No 'git' program was found.
pass