-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_zip_release.py
More file actions
executable file
·28 lines (24 loc) · 925 Bytes
/
create_zip_release.py
File metadata and controls
executable file
·28 lines (24 loc) · 925 Bytes
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
#!/usr/bin/env python3
#script to create a ZIP release file
import subprocess
import tempfile
import shutil
import os
# config
COMPOSER = "composer.phar"
REPO_URL = "https://github.com/e-dschungel/php_version_test.git"
ZIP_FILE_NAME = "php_version_test.zip"
EXCLUDE_PATTERN = ["*.git/*", "create_zip_release.py", "*.gitignore", "mypear.xml", "check_codingstyle.sh", "phpdoc.dist.xml"]
# create ZIP
cwd = os.getcwd()
with tempfile.TemporaryDirectory() as tempdir:
os.chdir(tempdir)
subprocess.call(["git", "clone", REPO_URL, tempdir])
subprocess.call([COMPOSER, "install", "--no-dev"])
subprocess.call(["zip", "-r", ZIP_FILE_NAME, ".",
"-x"] + EXCLUDE_PATTERN)
abs_zip_path = os.path.join(cwd,ZIP_FILE_NAME)
if os.path.isfile(abs_zip_path):
os.remove(abs_zip_path)
shutil.move(ZIP_FILE_NAME, abs_zip_path)
print("Created ZIP release file {}".format(ZIP_FILE_NAME))