kislyuk / aegea

Amazon Web Services Operator Interface
Apache License 2.0
68 stars 17 forks source link

Use distro package if available in ssm.py for Python 3.8 compatibility #56

Closed lvreynoso closed 3 years ago

lvreynoso commented 3 years ago

Python 3.8 removed the platform.linux_distribution() method used in ssm.py, causing an error when trying to use aegea on Linux. This PR adds the recommended replacement module distro and uses it to check if the user is running Ubuntu, falling back to the old behavior if distro was not successfully imported.

kislyuk commented 3 years ago

Hi @lvreynoso, thanks for pointing this out. Instead of introducing an external dependency (which would need to be added in setup.py), I'd prefer to simplify this to use something like if "ubuntu" in subprocess.run(["uname", "-a"], capture_output=True).stdout.decode(): ....

lvreynoso commented 3 years ago

Good point, I didn't realize that distro was not a builtin module. I updated the PR to just change the platform... check with your recommended subprocess check.