mirror of
https://github.com/postgres/postgres.git
synced 2025-06-20 15:22:23 +03:00
meson: Add target for installing test files & improve install_test_files
The changes in b6a0d469ca
prevented installation of the test files during a
normal install. However, the buildfarm intentionally tries to trun the tests
against a "real" installation. The new install-test-files target provides that
ability.
Because we want to install into a normal directory, I removed the necessary
munging of the target paths from meson.build and moved it into
install-test-files. I also added DESTDIR support, so that installing can
redirect 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 I
changed it to use
--install target list of files
which makes it easier to use for further directories, if/when we need them.
Discussion: https://postgr.es/m/20230308012940.edexipb3vqylcu6r@awork3.anarazel.de
This commit is contained in:
@ -6,23 +6,28 @@
|
||||
import argparse
|
||||
import shutil
|
||||
import os
|
||||
from pathlib import PurePath
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
|
||||
parser.add_argument('--datadir', type=str)
|
||||
parser.add_argument('--libdir', type=str)
|
||||
parser.add_argument('--install-data', type=str, nargs='*')
|
||||
parser.add_argument('--install-libs', type=str, nargs='*')
|
||||
parser.add_argument('--destdir', type=str, default=os.environ.get('DESTDIR', None))
|
||||
parser.add_argument('--prefix', type=str)
|
||||
parser.add_argument('--install', type=str, nargs='+', action='append')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
def copy_files(prefix: str, destdir: str, targetdir: str, src_list: list):
|
||||
if not os.path.isabs(targetdir):
|
||||
targetdir = os.path.join(prefix, targetdir)
|
||||
|
||||
def copy_files(src_list: list, dest: str):
|
||||
os.makedirs(dest, exist_ok=True)
|
||||
if destdir is not None:
|
||||
# copy of meson's logic for joining destdir and install paths
|
||||
targetdir = str(PurePath(destdir, *PurePath(targetdir).parts[1:]))
|
||||
|
||||
os.makedirs(targetdir, exist_ok=True)
|
||||
|
||||
for src in src_list:
|
||||
shutil.copy2(src, dest)
|
||||
shutil.copy2(src, targetdir)
|
||||
|
||||
|
||||
copy_files(args.install_data, args.datadir)
|
||||
copy_files(args.install_libs, args.libdir)
|
||||
for installs in args.install:
|
||||
copy_files(args.prefix, args.destdir, installs[0], installs[1:])
|
||||
|
Reference in New Issue
Block a user