File tree Expand file tree Collapse file tree 6 files changed +15
-39
lines changed Expand file tree Collapse file tree 6 files changed +15
-39
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import importlib .metadata as _metadata
34import sys
45import typing
5-
6- if sys .version_info < (3 , 8 ):
7- import importlib_metadata as _metadata
8- from importlib_metadata import PathDistribution , version
9- else :
10- import importlib .metadata as _metadata
11- from importlib .metadata import PathDistribution , version
12-
6+ from importlib .metadata import PathDistribution , version
137
148if typing .TYPE_CHECKING :
159 if sys .version_info < (3 , 8 ):
Original file line number Diff line number Diff line change 22
33import sys
44import typing
5-
6- if sys .version_info < (3 , 8 ):
7- from typing_extensions import (
8- Literal ,
9- Protocol ,
10- )
11- else :
12- from typing import Literal , Protocol
5+ from typing import Literal , Protocol
136
147if sys .version_info < (3 , 9 ):
158 from typing_extensions import Annotated , get_args , get_origin
Original file line number Diff line number Diff line change @@ -44,10 +44,7 @@ def __repr__(self) -> str:
4444 )
4545
4646
47- if sys .version_info < (3 , 8 ):
48- opts : Any = {}
49- else :
50- opts : Any = {"stacklevel" : 2 }
47+ opts : Any = {"stacklevel" : 2 }
5148
5249
5350class ScikitBuildLogger :
Original file line number Diff line number Diff line change 88import subprocess
99import sys
1010import sysconfig
11+ from importlib import metadata
1112from pathlib import Path
13+ from typing import Literal , overload
1214
1315import virtualenv as _virtualenv
1416
15- if sys .version_info < (3 , 8 ):
16- import importlib_metadata as metadata
17- from typing_extensions import Literal , overload
18- else :
19- from importlib import metadata
20- from typing import Literal , overload
21-
2217if sys .version_info < (3 , 11 ):
2318 import tomli as tomllib
2419else :
Original file line number Diff line number Diff line change @@ -23,10 +23,9 @@ def test_ep(isolated):
2323 contents = Path (script ).read_text ()
2424 assert contents .startswith (f"#!{ pysys } " )
2525
26- if sys .version_info >= (3 , 8 ):
27- assert (
28- isolated .execute (
29- "from importlib import metadata; print(metadata.version('custom_modules'), end='')"
30- )
31- == "2.3.4"
26+ assert (
27+ isolated .execute (
28+ "from importlib import metadata; print(metadata.version('custom_modules'), end='')"
3229 )
30+ == "2.3.4"
31+ )
Original file line number Diff line number Diff line change 33import importlib
44import shutil
55import subprocess
6- import sys
76import types
87import zipfile
98from pathlib import Path
@@ -238,11 +237,10 @@ def test_pep517_wheel(virtualenv):
238237 assert wheel == dist / out
239238
240239 virtualenv .install (wheel )
241- if sys .version_info >= (3 , 8 ):
242- license = virtualenv .execute (
243- "from importlib.metadata import metadata; print(metadata('dynamic')['License'])"
244- )
245- assert license == "MIT License"
240+ license = virtualenv .execute (
241+ "from importlib.metadata import metadata; print(metadata('dynamic')['License'])"
242+ )
243+ assert license == "MIT License"
246244
247245 with zipfile .ZipFile (wheel ) as zf :
248246 file_paths = {Path (n ) for n in zf .namelist ()}
You can’t perform that action at this time.
0 commit comments