From 83d8e52e1423c529ddc0860517784457ac0a28e3 Mon Sep 17 00:00:00 2001 From: Jeff Hollan <105808548+sfc-gh-jhollan@users.noreply.github.com> Date: Mon, 24 Apr 2023 12:08:41 -0700 Subject: [PATCH] Bug fix package (#117) --- src/snowcli/__about__.py | 2 +- src/snowcli/utils.py | 42 +++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/snowcli/__about__.py b/src/snowcli/__about__.py index 10ead8e6d9..6ff6dd19b9 100644 --- a/src/snowcli/__about__.py +++ b/src/snowcli/__about__.py @@ -1,3 +1,3 @@ from __future__ import annotations -VERSION = "0.2.7" +VERSION = "0.2.8" diff --git a/src/snowcli/utils.py b/src/snowcli/utils.py index 05a3f8d7cb..ebd6d975e7 100644 --- a/src/snowcli/utils.py +++ b/src/snowcli/utils.py @@ -423,16 +423,17 @@ def recursiveZipPackagesDir(pack_dir: str, dest_zip: str) -> bool: ): zipf.write(os.path.relpath(file)) - for dir_path in os.getenv("SNOWCLI_INCLUDE_PATHS", "").split(":"): - directory = pathlib.Path(dir_path) - if directory.is_dir(): - for file in pathlib.Path(directory).glob("**/*"): - if ( - not str(file).startswith(".") - and not file.match("*.pyc") - and not file.match("*__pycache__*") - ): - zipf.write(file, arcname=os.path.relpath(file, directory)) + if os.getenv("SNOWCLI_INCLUDE_PATHS") is not None: + for dir_path in os.getenv("SNOWCLI_INCLUDE_PATHS", "").split(":"): + directory = pathlib.Path(dir_path) + if directory.is_dir(): + for file in pathlib.Path(directory).glob("**/*"): + if ( + not str(file).startswith(".") + and not file.match("*.pyc") + and not file.match("*__pycache__*") + ): + zipf.write(file, arcname=os.path.relpath(file, directory)) # close the zip file object zipf.close() @@ -445,16 +446,17 @@ def standardZipDir(dest_zip: str) -> bool: if not file.match(".*"): zipf.write(os.path.relpath(file)) - for dir_path in os.getenv("SNOWCLI_INCLUDE_PATHS", "").split(":"): - directory = pathlib.Path(dir_path) - if directory.is_dir(): - for file in pathlib.Path(directory).glob("**/*"): - if ( - not str(file).startswith(".") - and not file.match("*.pyc") - and not file.match("*__pycache__*") - ): - zipf.write(file, arcname=os.path.relpath(file, directory)) + if os.getenv("SNOWCLI_INCLUDE_PATHS") is not None: + for dir_path in os.getenv("SNOWCLI_INCLUDE_PATHS", "").split(":"): + directory = pathlib.Path(dir_path) + if directory.is_dir(): + for file in pathlib.Path(directory).glob("**/*"): + if ( + not str(file).startswith(".") + and not file.match("*.pyc") + and not file.match("*__pycache__*") + ): + zipf.write(file, arcname=os.path.relpath(file, directory)) # close the zip file object zipf.close()