Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0d237ae

Browse files
committed
meson: Add target for installing test files & improve install_test_files
The changes inb6a0d46 prevented installation of the test files during anormal install. However, the buildfarm intentionally tries to trun the testsagainst a "real" installation. The new install-test-files target provides thatability.Because we want to install into a normal directory, I removed the necessarymunging of the target paths from meson.build and moved it intoinstall-test-files. I also added DESTDIR support, so that installing canredirect the directory if desired. That's used for the tmp_install/installation now.I didn't like the number of arguments necessary for install_test_files, so Ichanged it to use --install target list of fileswhich makes it easier to use for further directories, if/when we need them.Discussion:https://postgr.es/m/20230308012940.edexipb3vqylcu6r@awork3.anarazel.de
1 parent87e4f24 commit0d237ae

File tree

2 files changed

+33
-24
lines changed

2 files changed

+33
-24
lines changed

‎meson.build

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,6 +2830,22 @@ generated_sources_ac += {'': ['GNUmakefile']}
28302830
testprep_targets+= test_install_libs
28312831

28322832

2833+
# command to install files used for tests, which aren't installed by default
2834+
install_test_files=files('src/tools/install_test_files')
2835+
install_test_files_args= [
2836+
install_test_files,
2837+
'--prefix', dir_prefix,
2838+
'--install', contrib_data_dir, test_install_data,
2839+
'--install', dir_lib_pkg, test_install_libs,
2840+
]
2841+
2842+
# Target installing files required for installcheck of various modules
2843+
run_target('install-test-files',
2844+
command: [python]+ install_test_files_args,
2845+
depends: testprep_targets,
2846+
)
2847+
2848+
28332849
# If there are any files in the source directory that we also generate in the
28342850
# build directory, they might get preferred over the newly generated files,
28352851
# e.g. because of a #include "file", which always will search in the current
@@ -2922,21 +2938,9 @@ test('tmp_install',
29222938
is_parallel:false,
29232939
suite: ['setup'])
29242940

2925-
# get full paths of test_install_libs to copy them
2926-
test_install_libs_fp= []
2927-
foreachlib: test_install_libs
2928-
test_install_libs_fp+= lib.full_path()
2929-
endforeach
2930-
2931-
install_test_files=files('src/tools/install_test_files')
29322941
test('install_test_files',
2933-
python,args: [
2934-
install_test_files,
2935-
'--datadir', test_install_location/ contrib_data_args['install_dir'],
2936-
'--libdir', test_install_location/ dir_lib_pkg,
2937-
'--install-data', test_install_data,
2938-
'--install-libs', test_install_libs_fp,
2939-
],
2942+
python,
2943+
args: install_test_files_args+ ['--destdir', test_install_destdir],
29402944
priority: setup_tests_priority,
29412945
is_parallel:false,
29422946
suite: ['setup'])

‎src/tools/install_test_files

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,28 @@
66
importargparse
77
importshutil
88
importos
9+
frompathlibimportPurePath
910

1011
parser=argparse.ArgumentParser()
1112

12-
parser.add_argument('--datadir',type=str)
13-
parser.add_argument('--libdir',type=str)
14-
parser.add_argument('--install-data',type=str,nargs='*')
15-
parser.add_argument('--install-libs',type=str,nargs='*')
13+
parser.add_argument('--destdir',type=str,default=os.environ.get('DESTDIR',None))
14+
parser.add_argument('--prefix',type=str)
15+
parser.add_argument('--install',type=str,nargs='+',action='append')
1616

1717
args=parser.parse_args()
1818

19+
defcopy_files(prefix:str,destdir:str,targetdir:str,src_list:list):
20+
ifnotos.path.isabs(targetdir):
21+
targetdir=os.path.join(prefix,targetdir)
1922

20-
defcopy_files(src_list:list,dest:str):
21-
os.makedirs(dest,exist_ok=True)
23+
ifdestdirisnotNone:
24+
# copy of meson's logic for joining destdir and install paths
25+
targetdir=str(PurePath(destdir,*PurePath(targetdir).parts[1:]))
2226

23-
forsrcinsrc_list:
24-
shutil.copy2(src,dest)
27+
os.makedirs(targetdir,exist_ok=True)
2528

29+
forsrcinsrc_list:
30+
shutil.copy2(src,targetdir)
2631

27-
copy_files(args.install_data,args.datadir)
28-
copy_files(args.install_libs,args.libdir)
32+
forinstallsinargs.install:
33+
copy_files(args.prefix,args.destdir,installs[0],installs[1:])

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp