Skip to content

Commit dc87bc1

Browse files
committed
Add deprecation warning for Python 2.7 and 3.6
1 parent 8507c32 commit dc87bc1

File tree

7 files changed

+21
-18
lines changed

7 files changed

+21
-18
lines changed

docs/common_issues/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ Common issues
33

44
.. toctree::
55
:maxdepth: 1
6-
:caption: Common issues
7-
:name: common-issues
86

97
all_dirty
108
wrong_tag

docs/options/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Config options
55

66
.. toctree::
77
:maxdepth: 1
8-
:caption: Config options
9-
:name: opts
108

119
enabled
1210
starting_version

docs/schemas/callback/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,5 @@ Callback-based release
55

66
.. toctree::
77
:maxdepth: 1
8-
:caption: Callback-based
9-
:name: callback
108

119
version_callback

docs/schemas/file/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ File-based release
55

66
.. toctree::
77
:maxdepth: 1
8-
:caption: File-based
9-
:name: file
108

119
version_file
1210
dev_release_file

docs/schemas/tag/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Tag-based release
55

66
.. toctree::
77
:maxdepth: 1
8-
:caption: Tag-based
9-
:name: tag
108

119
tag_release
1210
post_release

docs/substitutions/index.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ Template substitutions
55

66
.. toctree::
77
:maxdepth: 1
8-
:caption: Template substitutions
9-
:name: template-substitutions
108

119
tag
1210
ccount

setuptools_git_versioning.py

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import os
55
import re
66
import subprocess
7+
import sys
8+
import warnings
79
from datetime import datetime
810
from distutils.errors import DistutilsSetupError
911
from typing import Any, Callable, List, Optional, Union
@@ -132,10 +134,12 @@ def read_toml(file_name): # type: (str) -> dict
132134
# TODO: remove along with version_config
133135
def parse_config(dist, attr, value): # type: (Distribution, Any, Any) -> None
134136
if attr == "version_config" and value is not None:
135-
log.warning(
137+
warnings.warn(
136138
"`version_config` option is deprecated "
137-
"since setuptools-git-versioning 1.8.0.\n"
138-
"Please rename it to `setuptools_git_versioning`"
139+
"since setuptools-git-versioning v1.8.0 "
140+
"and will be dropped in v2.0.\n"
141+
"Please rename it to `setuptools_git_versioning`",
142+
category=DeprecationWarning,
139143
)
140144

141145
if getattr(dist, "setuptools_git_versioning", None) is not None:
@@ -150,10 +154,12 @@ def infer_version(dist): # type: (Distribution) -> None
150154
value = getattr(dist, "setuptools_git_versioning", None) or getattr(dist, "version_config", None)
151155

152156
if isinstance(value, bool):
153-
log.warning(
157+
warnings.warn(
154158
"Passing boolean value to `version_config`/`setuptools_git_versioning` option is deprecated "
155-
"since setuptools-git-versioning 1.8.0.\n"
156-
"Please change value to `{'enabled': False/True}`"
159+
"since setuptools-git-versioning 1.8.0"
160+
"and will be dropped in v2.0.\n"
161+
"Please change value to `{'enabled': False/True}`",
162+
category=DeprecationWarning,
157163
)
158164
value = {"enabled": value}
159165

@@ -307,6 +313,15 @@ def version_from_git(
307313
):
308314
# type: (...) -> str
309315

316+
if sys.version_info < (3, 7):
317+
warnings.warn(
318+
"Python 2.7 and 3.6 support is deprecated "
319+
"since setuptools-git-versioning v1.8.0 "
320+
"and will be dropped in v2.0.\n"
321+
"Please upgrade your Python version to 3.7+",
322+
category=DeprecationWarning,
323+
)
324+
310325
# Check if PKG-INFO file exists and Version is present in it
311326
if os.path.exists("PKG-INFO"):
312327
with open("PKG-INFO") as f:

0 commit comments

Comments
 (0)