Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Evert Mouw
gajim-plugins
Commits
28f01f7e
Commit
28f01f7e
authored
9 years ago
by
Yann Leboulanger
Browse files
Options
Downloads
Patches
Plain Diff
get plugins via zip files instead of file by file
parent
fd8f9f7d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugin_installer/plugin_installer.py
+15
-50
15 additions, 50 deletions
plugin_installer/plugin_installer.py
with
15 additions
and
50 deletions
plugin_installer/plugin_installer.py
+
15
−
50
View file @
28f01f7e
...
...
@@ -81,7 +81,7 @@ class PluginInstaller(GajimPlugin):
if
gajim
.
version
.
startswith
(
'
0.15
'
):
self
.
server_folder
=
'
plugins_0.15
'
elif
gajim
.
version
.
startswith
(
'
0.16.10
'
):
self
.
server_folder
=
'
plugins_
gtk3
'
self
.
server_folder
=
'
plugins_
1
'
else
:
self
.
server_folder
=
'
plugins_0.16
'
...
...
@@ -586,29 +586,7 @@ class Ftp(threading.Thread):
self
.
pulse
=
GLib
.
timeout_add
(
150
,
self
.
progressbar_pulse
)
GLib
.
idle_add
(
self
.
progressbar
.
set_text
,
_
(
'
Creating a list of files
'
))
for
remote_dir
in
self
.
remote_dirs
:
def
nlstr
(
dir_
,
subdir
=
None
):
if
subdir
:
dir_
=
dir_
+
'
/
'
+
subdir
list_
=
self
.
ftp
.
nlst
(
dir_
)
for
i
in
list_
:
name
=
i
.
split
(
'
/
'
)[
-
1
]
if
'
.
'
not
in
name
:
try
:
if
i
==
self
.
ftp
.
nlst
(
i
)[
0
]:
files
.
append
(
i
[
1
:])
del
dirs
[
i
[
1
:]]
except
Exception
as
e
:
# empty dir or file
continue
dirs
.
append
(
i
[
1
:])
subdirs
=
name
nlstr
(
dir_
,
subdirs
)
else
:
files
.
append
(
i
[
1
:])
dirs
,
files
=
[],
[]
nlstr
(
'
/%s/%s
'
%
(
self
.
plugin
.
server_folder
,
remote_dir
))
filename
=
remote_dir
+
'
.zip
'
base_dir
,
user_dir
=
gajim
.
PLUGINS_DIRS
if
not
os
.
path
.
isdir
(
user_dir
):
os
.
mkdir
(
user_dir
)
...
...
@@ -617,34 +595,21 @@ class Ftp(threading.Thread):
os
.
mkdir
(
local_dir
)
local_dir
=
os
.
path
.
split
(
user_dir
)[
0
]
#
creating dirs
for
dir_
in
dirs
:
dir_
=
dir_
.
replace
(
self
.
plugin
.
server_folder
,
'
plugins
'
)
try
:
os
.
mkdir
(
os
.
path
.
join
(
local_dir
,
dir_
)
)
except
OSError
as
e
:
if
str
(
e
).
startswith
(
'
[Errno 17]
'
):
continue
raise
#
downloading zip file
GLib
.
idle_add
(
self
.
progressbar
.
set_text
,
_
(
'
Downloading
"
%s
"'
)
%
filename
)
full_filename
=
os
.
path
.
join
(
local_dir
,
'
plugins
'
,
filename
)
self
.
buffer_
=
io
.
BytesIO
(
)
try
:
self
.
ftp
.
retrbinary
(
'
RETR %s
'
%
filename
,
self
.
handleDownload
)
except
ftplib
.
all_errors
as
e
:
print
(
str
(
e
))
# downloading files
for
filename
in
files
:
GLib
.
idle_add
(
self
.
progressbar
.
set_text
,
_
(
'
Downloading
"
%s
"'
)
%
filename
)
full_filename
=
os
.
path
.
join
(
local_dir
,
filename
.
replace
(
self
.
plugin
.
server_folder
,
'
plugins
'
))
try
:
file_
=
open
(
full_filename
,
'
wb
'
)
self
.
ftp
.
retrbinary
(
'
RETR /%s
'
%
filename
,
file_
.
write
)
file_
.
close
()
except
ftplib
.
all_errors
as
e
:
print
(
str
(
e
))
os
.
unlink
(
filename
)
with
zipfile
.
ZipFile
(
self
.
buffer_
)
as
zip_file
:
zip_file
.
extractall
(
os
.
path
.
join
(
local_dir
,
'
plugins
'
))
self
.
ftp
.
quit
()
GLib
.
idle_add
(
self
.
window
.
emit
,
'
plugin_downloaded
'
,
self
.
remote_dirs
)
GLib
.
idle_add
(
self
.
window
.
emit
,
'
plugin_downloaded
'
,
self
.
remote_dirs
)
GLib
.
source_remove
(
self
.
pulse
)
...
...
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