Skip to content

Commit

Permalink
ecoutils py37+ prep
Browse files Browse the repository at this point in the history
  • Loading branch information
mahmoud committed Mar 25, 2024
1 parent fec02fa commit 0112de1
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions boltons/ecoutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
Some basic variations that are common among development machines:
* **Executable runtime**: CPython, PyPy, Jython, etc., plus build date and compiler
* **Language version**: 2.4, 2.5, 2.6, 2.7... 3.4, 3.5, 3.6
* **Language version**: 2.7 through 3.12
* **Host operating system**: Windows, OS X, Ubuntu, Debian, CentOS, RHEL, etc.
* **Features**: 64-bit, IPv6, Unicode character support (UCS-2/UCS-4)
* **Built-in library support**: OpenSSL, threading, SQLite, zlib
Expand Down Expand Up @@ -73,13 +73,18 @@
Compatibility
-------------
So far ecoutils has has been tested on Python 2.4, 2.5, 2.6, 2.7, 3.4,
3.5, and PyPy. Various versions have been tested on Ubuntu, Debian,
So far ecoutils has has been tested on Python 3.7+ and PyPy3.
Various versions have been tested on Ubuntu, Debian,
RHEL, OS X, FreeBSD, and Windows 7.
.. note:: Boltons typically only support back to Python 2.6, but due
to its nature, ecoutils extends backwards compatibility to Python
2.4 and 2.5.
.. note::
``boltons.ecoutils`` historically supported back to Python 2.4, but in 2024,
due to increasing testing burden, ecoutils support tracks the same
versions of Python as the rest of the boltons package.
For older Pythons, see `this version`_ from boltons 23.0.0.
.. _this version: https://github.com/mahmoud/boltons/blob/4b1d728f31a8378b193be9c966c853be0a57527d/boltons/ecoutils.py
Profile generation
------------------
Expand Down Expand Up @@ -158,7 +163,7 @@
import datetime
import platform

ECO_VERSION = '1.0.1' # see version history below
ECO_VERSION = '1.1.0' # see version history below


try:
Expand Down Expand Up @@ -249,7 +254,14 @@
RLIMIT_FDS_SOFT, RLIMIT_FDS_HARD = 0, 0


START_TIME_INFO = {'time_utc': str(datetime.datetime.utcnow()),
def _get_utc_now():
try:
return datetime.datetime.utcnow()
except Exception:
return datetime.datetime.now(datetime.UTC)


START_TIME_INFO = {'time_utc': str(_get_utc_now()),
'time_utc_offset': -time.timezone / 3600.0}


Expand Down Expand Up @@ -318,7 +330,8 @@ def get_profile(**kwargs):
'machine': uname[4],
'processor': uname[5]}
try:
linux_dist = platform.linux_distribution()
# TODO: removed in 3.7, replaced with freedesktop_os_release in 3.10
linux_dist = platform.linux_distribution()
except Exception:
linux_dist = ('', '', '')
ret['linux_dist_name'] = linux_dist[0]
Expand Down Expand Up @@ -466,6 +479,7 @@ def _args2cmd(args, sep=' '):
The version is ECO_VERSION module-level constant, and _eco_version key
in the dictionary returned from ecoutils.get_profile().
1.1.0 - (boltons version 24.0.0+) Drop Python <=3.6 compat
1.0.1 - (boltons version 16.3.2+) Remove uuid dependency and add HAVE_URANDOM
1.0.0 - (boltons version 16.3.0-16.3.1) Initial release
Expand Down

0 comments on commit 0112de1

Please sign in to comment.