mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-21 19:27:47 +01:00
Moved function to utils.py
Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
parent
ddb6ea1b7b
commit
b7af72edd2
2 changed files with 12 additions and 11 deletions
|
@ -27,6 +27,7 @@ import tarfile
|
|||
import subprocess
|
||||
|
||||
from slpkg.messages import Msg
|
||||
from slpkg.utils import Utils
|
||||
from slpkg.slack.slack_version import slack_ver
|
||||
from slpkg.__metadata__ import MetaData as _meta_
|
||||
|
||||
|
@ -53,7 +54,7 @@ class Download(object):
|
|||
dwn_count = 1
|
||||
self._directory_prefix()
|
||||
for dwn in self.url:
|
||||
self._fix_file_name(dwn.split("/")[-1])
|
||||
self.file_name = Utils().fix_file_name(dwn.split("/")[-1])
|
||||
|
||||
if dwn.startswith("file:///"):
|
||||
source_dir = dwn[7:-7].replace(slack_ver(), "")
|
||||
|
@ -81,16 +82,6 @@ class Download(object):
|
|||
self._check_if_downloaded()
|
||||
dwn_count += 1
|
||||
|
||||
def _fix_file_name(self, file_name):
|
||||
"""Get file name from url and fix passing char '+'
|
||||
"""
|
||||
if "%2b" in file_name:
|
||||
self.file_name = file_name.replace("%2b", "+", 5)
|
||||
elif "%2B" in file_name:
|
||||
self.file_name = file_name.replace("%2B", "+", 5)
|
||||
else:
|
||||
self.file_name = file_name
|
||||
|
||||
def _make_tarfile(self, output_filename, source_dir):
|
||||
"""Create .tar.gz file
|
||||
"""
|
||||
|
|
|
@ -92,6 +92,16 @@ class Utils(object):
|
|||
if line and not line.startswith("#"):
|
||||
return line
|
||||
|
||||
def fix_file_name(self, file_name):
|
||||
"""Get file name from url and fix passing char '+'
|
||||
"""
|
||||
if "%2b" in file_name:
|
||||
return file_name.replace("%2b", "+", 5)
|
||||
elif "%2B" in file_name:
|
||||
return file_name.replace("%2B", "+", 5)
|
||||
else:
|
||||
return file_name
|
||||
|
||||
def debug(self, test):
|
||||
"""Function used for print some stuff for debugging
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue