Skip to content

Commit

Permalink
Support multiplatform and overriide copy_tree to filter problematic f…
Browse files Browse the repository at this point in the history
…olders
  • Loading branch information
v1v committed May 29, 2020
1 parent b66aa23 commit 660ddd1
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .ci/scripts/pre_archive_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,31 @@
import distutils
from distutils import dir_util

# Support filtering in the distutils.dir_util.copy_tree
ORIG_COPY_TREE = distutils.dir_util.copy_tree


def my_copy_tree(src, *args, **kwargs):
'''function my_copy_tree
Override distutils.dir_util.copy_tree to filter the system-tests
'''
if src.endswith('system-tests'):
return []
return ORIG_COPY_TREE(src, *args, **kwargs)


distutils.dir_util.copy_tree = my_copy_tree

if __name__ == "__main__":

if not os.path.exists('build'):
os.makedirs('build')

# Top level folders to be excluded
EXCLUDE = set(['.ci', '.git', '.github', 'vendor', 'dev-tools', 'system-tests'])
EXCLUDE = set(['.ci', '.git', '.github', 'vendor', 'dev-tools'])
for root, dirs, files in os.walk('.'):
dirs[:] = [d for d in dirs if d not in EXCLUDE]
if root.endswith(('build')) and not root.startswith(('./build')):
dest = os.path.join('build', root.replace('./', ''))
dest = os.path.join('build', root.replace(".{}".format(os.sep), ''))
print("Copy {} into {}".format(root, dest))
distutils.dir_util.copy_tree(root, dest, preserve_symlinks=1)

0 comments on commit 660ddd1

Please sign in to comment.