Skip to content

Commit 4499dfe

Browse files
committed
Add verbose to the python make archive
1 parent 512014e commit 4499dfe

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

cmake/yup_python.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function (yup_prepare_python_stdlib target_name python_tools_path output_variabl
4848
COMMAND
4949
"${Python_EXECUTABLE}" "${python_tools_path}/ArchivePythonStdlib.py"
5050
-l "${Python_LIBRARY_DIRS}" -o "${CMAKE_CURRENT_BINARY_DIR}" -M "${Python_VERSION_MAJOR}" -m "${Python_VERSION_MINOR}"
51-
-x "\"${ignored_library_patterns}\""
51+
-x "\"${ignored_library_patterns}\"" -v
5252
COMMAND_ECHO STDOUT
5353
COMMAND_ERROR_IS_FATAL ANY)
5454

python/tools/ArchivePythonStdlib.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def file_hash(file):
1616
return h.hexdigest()
1717

1818

19-
def make_archive(file, directory):
19+
def make_archive(file, directory, verbose=False):
2020
archived_files = []
2121
for dirname, _, files in os.walk(directory):
2222
for filename in files:
@@ -34,6 +34,9 @@ def make_archive(file, directory):
3434
with open(path, "rb") as fp:
3535
zf.writestr(zip_info, fp.read(), compress_type=zipfile.ZIP_DEFLATED, compresslevel=9)
3636

37+
if verbose:
38+
print(f"Added to zip: {archive_path}")
39+
3740

3841
if __name__ == "__main__":
3942
print(f"starting python standard lib archiving tool...")
@@ -44,6 +47,7 @@ def make_archive(file, directory):
4447
parser.add_argument("-M", "--version-major", type=int, help="Major version number (integer).")
4548
parser.add_argument("-m", "--version-minor", type=int, help="Minor version number (integer).")
4649
parser.add_argument("-x", "--exclude-patterns", type=str, default=None, help="Excluded patterns (semicolon separated list).")
50+
parser.add_argument("-v", "--verbose", action="store_true", help="Enable verbose output.")
4751

4852
args = parser.parse_args()
4953

@@ -93,7 +97,7 @@ def make_archive(file, directory):
9397

9498
print(f"making archive {temp_archive} to {final_archive}...")
9599
if os.path.exists(final_archive):
96-
make_archive(temp_archive, final_location)
100+
make_archive(temp_archive, final_location, verbose=args.verbose)
97101
if file_hash(temp_archive) != file_hash(final_archive):
98102
shutil.copy(temp_archive, final_archive)
99103
else:

0 commit comments

Comments
 (0)