Conversation
…%s' option and getting the date in a more robust way
src/OpenSSL/crypto.py
Outdated
| :param datetime vfy_time: The verification time to set on this store. | ||
| :return: ``None`` if the verification time was successfully set. | ||
| """ | ||
| import calendar |
There was a problem hiding this comment.
imports should go at teh top of the file
setup.py
Outdated
| "\n\n`Full changelog " + | ||
| "<{uri}en/stable/changelog.html>`_.\n\n" | ||
| ).format(uri=URI) | ||
| LONG = 'nothing relevant' |
There was a problem hiding this comment.
Not intended for the PR (I'll remove it as soon as possible).
The error occurs while installing PyOpenSSL in Windows machines (I tried in 3 different machines). The command that fails is:
python setup.py --installWith the output:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\USER\pyopenssl\setup.py", line 54, in <module>
"\n\n`Full changelog " +
AttributeError: 'NoneType' object has no attribute 'group'
Co-Authored-By: Alex Gaynor <alex.gaynor@gmail.com>
|
There are python2.7 failures. But those are happening before tests are started, in setup.py |
|
the flake8 issue is real, the failing test is related to cryptography dropping openssl 1.0.1. we'll have to solve that outside of this PR. |
|
Good, thank you for the info |
|
Since this was originally done the CI has been changed significantly and we black'd the codebase. If you could rebase this we can get it merged though! |
|
It fails with the following error (https://travis-ci.com/github/pyca/pyopenssl/jobs/401351492): I don't understand what does it mean and how to fix it. |
|
All the python files int his repo are formatted with black. That error is saying that one of these files is not correctly formatted. |
|
Now is solved the problem with formatting |
|
Unfortunately, from __future__ import print_function
from calendar import timegm
from datetime import datetime
from os import putenv
from dateutil import tz
TZ = "CET" # it's UTC + 2 at the tested time below
putenv("TZ", TZ)
tzs = [
("UTC", tz.gettz("UTC")),
("Naive (local zone is {})".format(TZ), None),
("EEST", tz.gettz("EET")), # It will be UTC + 3 hours at the tested time
]
dates = [(name, datetime(2020, 8, 1, 11, 0, 0, tzinfo=tzinfo)) for name, tzinfo in tzs]
for name, date in dates:
print("{}: {!r}".format(name, date))
try:
print(" python3 timestamp() : {}".format(int(date.timestamp())))
except AttributeError:
pass
print(" timestamp with timetuple : {} ({!r})".format(timegm(date.timetuple()), date.timetuple()))
print(" timestamp with utctimetuple: {} ({!r})".format(timegm(date.utctimetuple()), date.utctimetuple()))
print(" timestamp with old strftime: {}".format(date.strftime("%s")))
print()Result: So while the old Using |
…ime() pyca#907 fixed the issue with set_time() not working on Windows. It also changed set_time()'s behavior in an incompatible way: instead of treating vfy_time always being in local time (regardless if it had a time zone attached or not), it now treats vfy_time as a time in UTC. This patch improves on that by taking the time zone into account, and also documents the incompatible change. Note that it is not always possible to convert a timestamp in an arbitrary time zone into UTC unambiguously, due to repeated or skipped local times around DST changes. The best is to use a timezone-aware vfy_time using the UTC time zone.
…ime() pyca#907 fixed the issue with set_time() not working on Windows. It also changed set_time()'s behavior in an incompatible way: instead of treating vfy_time always being in local time (regardless if it had a time zone attached or not), it now treats vfy_time as a time in UTC. This patch improves on that by taking the time zone into account, and also documents the incompatible change. Note that it is not always possible to convert a timestamp in an arbitrary time zone into UTC unambiguously, due to repeated or skipped local times around DST changes. The best is to use a timezone-aware vfy_time using the UTC time zone.
Fixing issue #798, thanks to @reaperhulk; removing undocumented '%s' option to convert the date to an
intand getting the date in a more robust way.Closes #798