Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Python 3 Support #26

Open
tymartin-novu opened this issue Jan 2, 2020 · 3 comments
Open

Python 3 Support #26

tymartin-novu opened this issue Jan 2, 2020 · 3 comments

Comments

@tymartin-novu
Copy link

With Python 2.7 being sunset (https://www.python.org/psf/press-release/pr20191220/), it would be great to see this lambda function updated to support Python 3.

@haidangwa
Copy link

@tymartin-novu I appreciate your contribution and I've used your forked version in my own code. I ran into an issue recently when I tried to update to the python 3.8 runtime in AWS lambda functions. Do you think you could update the code to work under python 3.8?

This is what I found in the python 3.5 documentation:

Deprecated since version 3.5, will be removed in version 3.7.

https://docs.python.org/3.5/library/platform.html

16.14.5. Unix Platforms
platform.dist(distname='', version='', id='', supported_dists=('SuSE', 'debian', 'redhat', 'mandrake', ...))
This is another name for linux_distribution().

Deprecated since version 3.5, will be removed in version 3.7.

platform.linux_distribution(distname='', version='', id='', supported_dists=('SuSE', 'debian', 'redhat', 'mandrake', ...), full_distribution_name=1)
Tries to determine the name of the Linux OS distribution name.

supported_dists may be given to define the set of Linux distributions to look for. It defaults to a list of currently supported > Linux distributions identified by their release file name.

If full_distribution_name is true (default), the full distribution read from the OS is returned. Otherwise the short name taken from supported_dists is used.

Returns a tuple (distname,version,id) which defaults to the args given as parameters. id is the item in parentheses after the version number. It is usually the version codename.

Deprecated since version 3.5, will be removed in version 3.7.

@nclemons78
Copy link

Yeah, I can't get this to run under 3.8 or 3.9 because of the platform.linux_distribution issue. I tried working around it by converting it to use distro, but wasn't able to get pip to successfully vendor it out to the folder I build the Lambda ZIP file from.

Is anyone looking at this?

@nelmos
Copy link

nelmos commented Sep 2, 2022

On my side, i added this dirt in chef/rsa.py :

replace

else:
    # Patch for Amazon Linux
    import platform
    plat_name = platform.linux_distribution(supported_dists=['system'])[0]
    if 'Amazon' in plat_name:
        _eay = CDLL('libcrypto.so.10')
    else:
        _eay = CDLL('libcrypto.so')

with :

else:
    # Patch for Amazon Linux
    import platform
    p = platform.platform()
    if 'amzn2' in p:
        _eay = CDLL('libcrypto.so.10')
    else:
        _eay = CDLL('libcrypto.so')

It's ugly but it makes my code work on Lambda + python3.10 ... so "What else ?" ^^

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants