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