From bec5b85a0b79e3c7118fd0471a9056cca1f0cc87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Fri, 29 Mar 2024 11:05:17 +0100 Subject: [PATCH] build: distribute variant templates content (#88848) --- setup.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/setup.py b/setup.py index 2b739b84..2b1493ad 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ #! /usr/bin/env python +import functools import glob import os import subprocess @@ -41,6 +42,27 @@ class eo_sdist(sdist): if os.path.exists('VERSION'): os.remove('VERSION') + def local_findall(self, dir=os.curdir): + # override default file search to allow for duplicates (as some themes have + # multiple variants that are just symlinks) + files = [ + os.path.join(base, file) for base, dirs, files in os.walk(dir, followlinks=True) for file in files + ] + if dir == os.curdir: + make_rel = functools.partial(os.path.relpath, start=dir) + files = map(make_rel, files) + self.filelist.allfiles = list(filter(os.path.isfile, files)) + + def get_file_list(self): + self.filelist.findall = self.local_findall + super().get_file_list() + + def copy_file(self, *args, **kwargs): + # do not allow hardlinking as hardlinks would get inserted as is in + # the tarball, and would not extract properly. + kwargs.pop('link', None) + super().copy_file(*args, **kwargs) + def get_version(): '''Use the VERSION, if absent generates a version with git describe, if not