build: distribute variant templates content (#88848)
gitea/publik-base-theme/pipeline/head This commit looks good Details

This commit is contained in:
Frédéric Péters 2024-03-29 11:05:17 +01:00
parent 1e44f1e6e4
commit bec5b85a0b
1 changed files with 22 additions and 0 deletions

View File

@ -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