Skip to content

Commit c220389

Browse files
committed
Move 'deps' to the compat module as well.
1 parent 2df0e73 commit c220389

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

twine/cli.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414
import argparse
1515
import logging.config
16-
import sys
1716
from typing import Any, List, Tuple
1817

1918
import rich
@@ -23,6 +22,7 @@
2322

2423
import twine
2524

25+
from .compat import py39
2626
from .compat.py39 import importlib
2727

2828
args = argparse.Namespace()
@@ -72,15 +72,13 @@ def configure_output() -> None:
7272

7373

7474
def list_dependencies_and_versions() -> List[Tuple[str, str]]:
75-
deps = [
75+
deps = (
7676
"keyring",
7777
"pkginfo",
7878
"requests",
7979
"requests-toolbelt",
8080
"urllib3",
81-
]
82-
if sys.version_info < (3, 10):
83-
deps.append("importlib-metadata")
81+
) + py39.deps
8482
return [(dep, importlib.metadata.version(dep)) for dep in deps]
8583

8684

twine/compat/py39.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22

33
if sys.version_info >= (3, 10):
44
import importlib.metadata
5+
6+
deps = ()
57
else:
68

79
class importlib:
810
import importlib_metadata as metadata # noqa: F401
911

12+
deps = ("importlib_metadata",)
13+
1014

11-
__all__ = ['importlib']
15+
__all__ = ["importlib", "deps"]

0 commit comments

Comments
 (0)