Skip to content

Commit

Permalink
release: Release for 1.3.0
Browse files Browse the repository at this point in the history
1.3.0 Release PR
  • Loading branch information
mndeveci authored Feb 25, 2021
2 parents 270e1da + 2ad17ff commit e9ccfd1
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ for:

# setup go
- rmdir c:\go /s /q
- "choco install golang"
- "choco install golang --version 1.15.7"
- "choco install bzr"
- "choco install dep"
- setx PATH "C:\go\bin;C:\gopath\bin;C:\Program Files (x86)\Bazaar\;C:\Program Files\Mercurial;%PATH%;"
Expand Down
2 changes: 1 addition & 1 deletion aws_lambda_builders/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
AWS Lambda Builder Library
"""
__version__ = "1.2.0"
__version__ = "1.3.0"
RPC_PROTOCOL_VERSION = "0.3"
2 changes: 1 addition & 1 deletion aws_lambda_builders/workflows/python_pip/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
def pip_import_string(python_exe):
os_utils = OSUtils()
cmd = [python_exe, "-c", "import pip; print(pip.__version__)"]
p = os_utils.popen(cmd, stdout=os_utils.pipe, stderr=os_utils.pipe)
p = os_utils.popen(cmd, stdout=os_utils.pipe, stderr=os_utils.pipe, env=os_utils.original_environ())
stdout, stderr = p.communicate()
if not p.returncode == 0:
raise MissingPipError(python_path=python_exe)
Expand Down
6 changes: 4 additions & 2 deletions aws_lambda_builders/workflows/python_pip/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,9 @@ def _generate_egg_info(self, package_dir):
cmd = [sys.executable, "-c", script, "--no-user-cfg", "egg_info", "--egg-base", "egg-info"]
egg_info_dir = self._osutils.joinpath(package_dir, "egg-info")
self._osutils.makedirs(egg_info_dir)
p = subprocess.Popen(cmd, cwd=package_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(
cmd, cwd=package_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=self._osutils.original_environ()
)
p.communicate()
info_contents = self._osutils.get_directory_contents(egg_info_dir)
pkg_info_path = self._osutils.joinpath(egg_info_dir, info_contents[0], "PKG-INFO")
Expand Down Expand Up @@ -535,7 +537,7 @@ def __init__(self, osutils=None, python_exe=None, import_string=None):

def main(self, args, env_vars=None, shim=None):
if env_vars is None:
env_vars = self._osutils.environ()
env_vars = self._osutils.original_environ()
if shim is None:
shim = ""
run_pip = ("import sys; %s; sys.exit(main(%s))") % (self._import_string, args)
Expand Down
17 changes: 17 additions & 0 deletions aws_lambda_builders/workflows/python_pip/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,29 @@
import shutil
import tarfile
import subprocess
import sys


class OSUtils(object):
def environ(self):
return os.environ

def original_environ(self):
# https://pyinstaller.readthedocs.io/en/stable/runtime-information.html#ld-library-path-libpath-considerations
env = dict(os.environ)
# Check whether running as a PyInstaller binary
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
lp_key = "LD_LIBRARY_PATH"
original_lp = env.get(lp_key + "_ORIG")
if original_lp is not None:
env[lp_key] = original_lp
else:
# This happens when LD_LIBRARY_PATH was not set.
# Remove the env var as a last resort:
env.pop(lp_key, None)

return env

def file_exists(self, filename):
return os.path.isfile(filename)

Expand Down
5 changes: 4 additions & 1 deletion aws_lambda_builders/workflows/python_pip/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import subprocess

from aws_lambda_builders.exceptions import MisMatchRuntimeError
from .utils import OSUtils

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -39,7 +40,9 @@ def validate(self, runtime_path):

cmd = self._validate_python_cmd(runtime_path)

p = subprocess.Popen(cmd, cwd=os.getcwd(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
p = subprocess.Popen(
cmd, cwd=os.getcwd(), stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=OSUtils().original_environ()
)
p.communicate()
if p.returncode != 0:
raise MisMatchRuntimeError(language=self.language, required_runtime=self.runtime, runtime_path=runtime_path)
Expand Down
2 changes: 2 additions & 0 deletions aws_lambda_builders/workflows/python_pip/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class PythonPipWorkflow(BaseWorkflow):
".aws-sam",
".chalice",
".git",
".gitignore",
# Compiled files
"*.pyc",
"__pycache__",
Expand Down Expand Up @@ -51,6 +52,7 @@ class PythonPipWorkflow(BaseWorkflow):
"venv.bak",
"env.bak",
"ENV",
"env",
# Editors
# TODO: Move the commonly ignored files to base class
".vscode",
Expand Down

0 comments on commit e9ccfd1

Please sign in to comment.