-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathhelper.py
More file actions
41 lines (35 loc) · 1.13 KB
/
helper.py
File metadata and controls
41 lines (35 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import os
import tempfile
import shutil
from pathlib import Path
def create_archive(zip_name='glue_blog'):
root_dir = Path(os.path.dirname(os.path.abspath(__file__))).absolute()
# Add additional ignore files/directories within the ignore argument
with tempfile.TemporaryDirectory() as tmpdir:
shutil.copytree(
root_dir,
os.path.join(tmpdir, 'glue_blog'),
ignore=shutil.ignore_patterns(
'__pycache__',
'cdk.out',
'.git',
'.DS_Store',
'.venv',
'node_modules',
'logs',
'.pytest_cache',
'.tox',
'htmlcov',
'.coverage',
'coverage.xml',
'junitxml.xml'
)
)
shutil.make_archive(
os.path.join('cdk.out/', zip_name),
'zip',
os.path.join(tmpdir, 'glue_blog')
)
return os.path.join('cdk.out/', zip_name+".zip")