Skip to content

Commit

Permalink
workaroud to skip validation on Windows platform
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Korovin committed Aug 19, 2022
1 parent 928dbd8 commit 3d43b98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="yappa",
version="0.4.26",
version="0.4.27",
url="https://github.com/turokg/yappa",
description="Easy serverless deploy of python web applications",
long_description_content_type="text/markdown",
Expand Down
5 changes: 2 additions & 3 deletions yappa/packaging/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@
from click import ClickException

REQUIRED_PACKAGES = ("httpx", "PyYAML")
ENCODING = "cp1252" if any(platform.win32_ver()) else "utf-8"


def validate_requirements_file(requirements_filename):
if any(platform.win32_ver()):
return
try:
with open(requirements_filename, encoding="utf-8") as f:
with open(requirements_filename, encoding=ENCODING) as f:
requirements = f.read()
except FileNotFoundError:
raise ClickException(
Expand Down
6 changes: 3 additions & 3 deletions yappa/packaging/direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from click import ClickException

from yappa.handlers.common import DEFAULT_CONFIG_FILENAME
from yappa.packaging.common import validate_requirements_file
from yappa.packaging.common import validate_requirements_file, ENCODING
from yappa.settings import (
DEFAULT_IGNORED_FILES,
DEFAULT_PACKAGE_DIR,
Expand All @@ -31,11 +31,11 @@ def clear_requirements(requirements_file):
removes Yappa package from requirements
"""
buffer = []
with open(requirements_file, "r", encoding="utf-8") as f:
with open(requirements_file, "r", encoding=ENCODING) as f:
for line in f.readlines():
if "yappa" not in line:
buffer.append(line)
with open(requirements_file, "w+", encoding="utf-8") as f:
with open(requirements_file, "w+", encoding=ENCODING) as f:
f.write("".join(buffer))


Expand Down

0 comments on commit 3d43b98

Please # to comment.