Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gajim-plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
56
Issues
56
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gajim
gajim-plugins
Commits
28f01f7e
Commit
28f01f7e
authored
Mar 06, 2016
by
Yann Leboulanger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get plugins via zip files instead of file by file
parent
fd8f9f7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
50 deletions
+15
-50
plugin_installer/plugin_installer.py
plugin_installer/plugin_installer.py
+15
-50
No files found.
plugin_installer/plugin_installer.py
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment