From f51b12090451712d88252129fa686dcd3f67bafd Mon Sep 17 00:00:00 2001 From: Egor Korovin Date: Fri, 19 Aug 2022 17:10:45 +0700 Subject: [PATCH] workaroud to skip validation on Windows platform --- setup.py | 2 +- yappa/packaging/common.py | 5 ++++- yappa/packaging/direct.py | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 39ebc44..483bd95 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="yappa", - version="0.4.27", + version="0.4.28", url="https://github.com/turokg/yappa", description="Easy serverless deploy of python web applications", long_description_content_type="text/markdown", diff --git a/yappa/packaging/common.py b/yappa/packaging/common.py index 21d27fd..d9ccd66 100644 --- a/yappa/packaging/common.py +++ b/yappa/packaging/common.py @@ -3,10 +3,13 @@ from click import ClickException REQUIRED_PACKAGES = ("httpx", "PyYAML") -ENCODING = "cp1252" if any(platform.win32_ver()) else "utf-8" +ENCODING = "utf-8" +IS_WINDOWS = any(platform.win32_ver()) def validate_requirements_file(requirements_filename): + if IS_WINDOWS: + return try: with open(requirements_filename, encoding=ENCODING) as f: requirements = f.read() diff --git a/yappa/packaging/direct.py b/yappa/packaging/direct.py index 5291324..7861172 100644 --- a/yappa/packaging/direct.py +++ b/yappa/packaging/direct.py @@ -8,7 +8,8 @@ from click import ClickException from yappa.handlers.common import DEFAULT_CONFIG_FILENAME -from yappa.packaging.common import validate_requirements_file, ENCODING +from yappa.packaging.common import validate_requirements_file, ENCODING, \ + IS_WINDOWS from yappa.settings import ( DEFAULT_IGNORED_FILES, DEFAULT_PACKAGE_DIR, @@ -30,6 +31,8 @@ def clear_requirements(requirements_file): """ removes Yappa package from requirements """ + if IS_WINDOWS: + return buffer = [] with open(requirements_file, "r", encoding=ENCODING) as f: for line in f.readlines():