Skip to content

Commit

Permalink
fix: change to datetime.now(tz=UTC)
Browse files Browse the repository at this point in the history
Signed-off-by: Frost Ming <[email protected]>
  • Loading branch information
frostming committed Mar 6, 2024
1 parent 4f20cfd commit 74f7a61
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pdm/backend/hooks/version/scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
module to get version from tag of SCM repository.
Adapted from setuptools-scm. Currently only support git and hg.
"""

from __future__ import annotations

import os
Expand All @@ -11,7 +12,7 @@
import subprocess
import warnings
from dataclasses import dataclass
from datetime import datetime
from datetime import datetime, timezone
from pathlib import Path
from typing import TYPE_CHECKING, Callable, Iterable, NamedTuple

Expand Down Expand Up @@ -323,7 +324,7 @@ def format_version(version: SCMVersion) -> str:
clean_format = "+{node}"
dirty_format = "+{node}.d{time:%Y%m%d}"
fmt = dirty_format if version.dirty else clean_format
local_version = fmt.format(node=version.node, time=datetime.utcnow())
local_version = fmt.format(node=version.node, time=datetime.now(tz=timezone.utc))
return main_version + local_version


Expand Down

0 comments on commit 74f7a61

Please sign in to comment.