Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mesonium
gajim
Commits
cacc141d
Commit
cacc141d
authored
2 years ago
by
Philipp Hörist
Browse files
Options
Downloads
Patches
Plain Diff
refactor: Make depcheck more readable
parent
03ce16a5
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pyrightconfig.json
+1
-0
1 addition, 0 deletions
pyrightconfig.json
win/misc/depcheck.py
+21
-16
21 additions, 16 deletions
win/misc/depcheck.py
with
22 additions
and
16 deletions
pyrightconfig.json
+
1
−
0
View file @
cacc141d
...
...
@@ -10,6 +10,7 @@
".git"
],
"include"
:
[
"win/*"
,
".ci/*"
,
"gajim/gajim.py"
,
"gajim/common/application.py"
,
...
...
This diff is collapsed.
Click to expand it.
win/misc/depcheck.py
+
21
−
16
View file @
cacc141d
# -*- coding: utf-8 -*-
# Copyright 2016 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
...
...
@@ -8,7 +7,6 @@
"""
Deletes unneeded DLLs and checks DLL dependencies.
Execute with the build python, will figure out the rest.
"""
import
subprocess
...
...
@@ -69,10 +67,10 @@ def find_lib(root: str, name: str) -> Optional[str]:
return
name
def
get_things_to_delete
(
root
:
str
)
->
list
[
Optional
[
str
]
]
:
def
get_things_to_delete
(
root
:
str
)
->
list
[
str
]:
all_libs
:
set
[
str
]
=
set
()
needed
:
set
[
str
]
=
set
()
for
base
,
dirs
,
files
in
os
.
walk
(
root
):
for
base
,
_
,
files
in
os
.
walk
(
root
):
for
f
in
files
:
path
=
os
.
path
.
join
(
base
,
f
)
if
os
.
path
.
splitext
(
path
)[
-
1
].
lower
()
in
EXTENSIONS
:
...
...
@@ -80,29 +78,36 @@ def get_things_to_delete(root: str) -> list[Optional[str]]:
for
lib
in
get_dependencies
(
path
):
all_libs
.
add
(
lib
)
needed
.
add
(
lib
)
if
not
find_lib
(
root
,
lib
):
if
find_lib
(
root
,
lib
)
is
None
:
print
(
"
MISSING:
"
,
path
,
lib
)
for
lib
in
get_required_by_typelibs
():
needed
.
add
(
lib
)
if
not
find_lib
(
root
,
lib
):
print
(
"
MISSING:
"
,
path
,
lib
)
if
find_lib
(
root
,
lib
)
is
None
:
print
(
"
MISSING:
"
,
lib
)
# get rid of things not in the search path,
# maybe loaded through other means?
not_needed
=
filter
(
lambda
l
:
find_lib
(
root
,
l
)
and
\
os
.
path
.
splitext
(
l
)[
-
1
].
lower
()
!=
"
.exe
"
,
all_libs
-
needed
)
result
:
list
[
str
]
=
[]
libs
=
all_libs
-
needed
for
lib
in
libs
:
_
,
ext
=
os
.
path
.
splitext
(
lib
)
if
ext
==
"
.exe
"
:
continue
return
[
find_lib
(
root
,
l
)
for
l
in
not_needed
]
name
=
find_lib
(
root
,
lib
)
if
name
is
None
:
continue
result
.
append
(
name
)
return
result
def
main
()
->
None
:
libs
=
get_things_to_delete
(
sys
.
prefix
)
while
libs
:
for
l
in
libs
:
print
(
"
DELETE:
"
,
l
)
os
.
unlink
(
l
)
for
l
ib
in
libs
:
print
(
"
DELETE:
"
,
l
ib
)
os
.
unlink
(
l
ib
)
libs
=
get_things_to_delete
(
sys
.
prefix
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment