Ignore system packages in pipdeptree

This commit is contained in:
Mikhail f. Shiryaev 2024-09-30 23:43:36 +02:00
parent 0308de23c0
commit ce4ddf7336
No known key found for this signature in database
GPG Key ID: 4B02ED204C7D93F4
2 changed files with 5 additions and 3 deletions

View File

@ -13,7 +13,11 @@ def build_docker_deps(image_name: str, imagedir: str) -> None:
"pip install pipdeptree 2>/dev/null 1>/dev/null && pipdeptree --freeze " "pip install pipdeptree 2>/dev/null 1>/dev/null && pipdeptree --freeze "
"--warn silence --exclude pipdeptree" "--warn silence --exclude pipdeptree"
) )
cmd = rf"""docker run --rm --entrypoint "/bin/bash" {image_name} -c "{pip_cmd} | sed '/=/!d;s/\s//g' | sort -u" > {imagedir}/requirements.txt""" # /=/!d - remove dependencies without pin
# ubuntu - ignore system packages
# \s - remove spaces
sed = r"sed '/==/!d; /==.*+ubuntu/d; s/\s//g'"
cmd = rf"""docker run --rm --entrypoint "/bin/bash" {image_name} -c "{pip_cmd} | {sed} | sort -u" > {imagedir}/requirements.txt"""
print("Running the command:", cmd) print("Running the command:", cmd)
subprocess.check_call(cmd, shell=True) subprocess.check_call(cmd, shell=True)

View File

@ -29,7 +29,6 @@ delta-spark==2.3.0
deltalake==0.16.0 deltalake==0.16.0
dict2xml==1.7.4 dict2xml==1.7.4
dicttoxml==1.7.16 dicttoxml==1.7.16
distro-info==1.1+ubuntu0.2
docker==6.1.3 docker==6.1.3
exceptiongroup==1.2.1 exceptiongroup==1.2.1
execnet==2.1.1 execnet==2.1.1
@ -82,7 +81,6 @@ pytest-reportlog==0.4.0
pytest-timeout==2.2.0 pytest-timeout==2.2.0
pytest-xdist==3.5.0 pytest-xdist==3.5.0
pytest==7.4.4 pytest==7.4.4
python-apt==2.4.0+ubuntu3
python-dateutil==2.9.0.post0 python-dateutil==2.9.0.post0
pytz==2023.3.post1 pytz==2023.3.post1
redis==5.0.1 redis==5.0.1