Skip to content

Commit d92b28b

Browse files
committed
bump
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 3b76e80 commit d92b28b

File tree

1 file changed

+17
-8
lines changed
  • tests/_data/infiles/environment/with-extras

1 file changed

+17
-8
lines changed

tests/_data/infiles/environment/with-extras/init.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"""
2121

2222
from os import name as os_name
23-
from os.path import dirname, join
23+
from os.path import dirname, isdir, join
2424
from subprocess import PIPE, CompletedProcess, run # nosec:B404
2525
from sys import argv, executable, version_info
2626
from typing import Any
@@ -44,38 +44,47 @@ def pip_run(*args: str, **kwargs: Any) -> CompletedProcess:
4444
res = run(call, **kwargs, cwd=this_dir, shell=False) # nosec:B603
4545
if res.returncode != 0:
4646
raise RuntimeError('process failed')
47+
4748
return res
4849

4950

50-
def pip_install(*args: str) -> None:
51-
t = join(env_dir, 'Lib', 'site-packages') \
52-
if os_name == 'nt' \
53-
else join(env_dir, 'lib', f'python{version_info[0]}.{version_info[1]}', 'site-packages')
51+
def pip_install(*args: str, side_packages_dir: str) -> None:
52+
if side_packages_dir is None:
53+
raise RuntimeError()
5454
pip_run(
5555
'install', '--require-virtualenv', '--no-input', '--progress-bar=off', '--no-color',
5656
'--python-version=3.14', # needed for compatibility/reproducibility
5757
'--only-binary=:all:',
58-
'-t', t,
58+
'--target', side_packages_dir,
5959
'-c', constraint_file, # needed for reproducibility
6060
*args,
6161
)
6262

6363

6464
def main() -> None:
65-
EnvBuilder(
65+
eb = EnvBuilder(
6666
system_site_packages=False,
6767
symlinks=os_name != 'nt',
6868
with_pip=False,
6969
).create(env_dir)
7070

71+
try:
72+
spd = next(filter(isdir, (
73+
join(env_dir, 'lib', f'python{version_info[0]}.{version_info[1]}', 'site-packages'),
74+
join(env_dir, 'Lib', 'site-packages') # windows ?
75+
)))
76+
except StopIteration:
77+
raise RuntimeError('site-packages not found')
78+
7179
pip_install(
7280
'cyclonedx-python-lib[xml-validation,json-validation]==11.2',
7381
# additionals for reproducibility foo
7482
'importlib-resources>=1.4.0',
7583
'pkgutil-resolve-name>=1.3.10',
7684
'zipp>=3.1.0',
7785
'jsonschema-specifications>=2023.03.6',
78-
'typing_extensions>=4'
86+
'typing_extensions>=4',
87+
side_packages_dir=spd
7988
)
8089

8190

0 commit comments

Comments
 (0)