Skip to content

Conversation

@ljoy913
Copy link
Contributor

@ljoy913 ljoy913 commented Mar 14, 2025

When installing on Windows with pip install git+https://github.com/IdentityPython/pyMDOC-CBOR.git the mdoc, mso, and tests folders are missing from the installation leading to mdoc failures. This PR fixes the issue by updating the sub-packages detection in the setup.py file.

  • Updated sub-package detection in setup.py
  • Replaced deprecated utcnow calls causing warnings when running tests
  • Added __init__.py files to mdoc sub-package to aid detection

pytest --pyargs pymdoccbor.tests passes all tests without warnings

:rtype: Sign1Message
"""
utcnow = datetime.datetime.utcnow()
utcnow = datetime.datetime.now(datetime.UTC)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
utcnow = datetime.datetime.now(datetime.UTC)
utcnow = datetime.datetime.now(timezone.utc)

X509_COMMON_NAME = os.getenv('X509_COMMON_NAME', u"mysite.com")

X509_NOT_VALID_BEFORE = os.getenv('X509_NOT_VALID_BEFORE', datetime.datetime.utcnow())
X509_NOT_VALID_BEFORE = os.getenv('X509_NOT_VALID_BEFORE', datetime.datetime.now(datetime.UTC))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
X509_NOT_VALID_BEFORE = os.getenv('X509_NOT_VALID_BEFORE', datetime.datetime.now(datetime.UTC))
X509_NOT_VALID_BEFORE = os.getenv('X509_NOT_VALID_BEFORE', datetime.datetime.now(timezone.utc))

X509_NOT_VALID_AFTER = os.getenv(
'X509_NOT_VALID_AFTER',
datetime.datetime.utcnow() + datetime.timedelta(
datetime.datetime.now(datetime.UTC) + datetime.timedelta(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
datetime.datetime.now(datetime.UTC) + datetime.timedelta(
datetime.datetime.now(timezone.utc) + datetime.timedelta(

Copy link
Contributor

@PascalDR PascalDR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better if we use timezone to retrieve the UTC class.

@peppelinux peppelinux merged commit 9fbf822 into IdentityPython:main Mar 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants