FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
SystemGuard/src/scripts/utils/missing_dependency.py at dev · codeperfectplus/SystemGuard · GitHub
codeperfectplus
/
SystemGuard
Public
Notifications
You must be signed in to change notification settings
Fork
6
Star
11
Code
Issues
0
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
SystemGuard
/
src
/
scripts
/
utils
/
missing_dependency.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
29 lines (22 loc) · 873 Bytes
Breadcrumbs
SystemGuard
/
src
/
scripts
/
utils
/
missing_dependency.py
Copy path
File metadata and controls
executable file
·
29 lines (22 loc) · 873 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# check_requirements.py
import
pkg_resources
import
sys
def
get_installed_packages
():
return
{
pkg
.
key
for
pkg
in
pkg_resources
.
working_set
}
def
read_requirements
(
file_path
):
with
open
(
file_path
,
'r'
)
as
f
:
return
{
line
.
strip
().
split
(
'=='
)[
0
].
lower
()
for
line
in
f
if
line
.
strip
()
and
not
line
.
startswith
(
'#'
)}
def
main
(
requirements_file
):
installed_packages
=
get_installed_packages
()
required_packages
=
read_requirements
(
requirements_file
)
missing_packages
=
required_packages
-
installed_packages
if
missing_packages
:
print
(
'
\n
'
.
join
(
missing_packages
))
else
:
print
(
'All packages are installed.'
)
if
__name__
==
"__main__"
:
if
len
(
sys
.
argv
)
!=
2
:
print
(
"Usage: python check_requirements.py <requirements_file>"
)
sys
.
exit
(
1
)
requirements_file
=
sys
.
argv
[
1
]
main
(
requirements_file
)
Back
|
FazBrowse Home
|
New Git URL