mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-10 20:01:54 +01:00
Merge branch 'develop'
This commit is contained in:
commit
4c08b370fd
9 changed files with 47 additions and 27 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
3.7.3 - 11/12/2019
|
||||||
|
FIxed:
|
||||||
|
- Bugfix: Slackware-current from Alien Bob 20191130 #119
|
||||||
|
- Improving call class methods for reposiory updating
|
||||||
|
- Replace requests dependency with urllib3
|
||||||
|
- Code style to python3 compatibility
|
||||||
|
|
||||||
3.7.2 - 06/12/2019
|
3.7.2 - 06/12/2019
|
||||||
Fixed:
|
Fixed:
|
||||||
- Bugfix handle requests raise ConnectionError
|
- Bugfix handle requests raise ConnectionError
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# slpkg 3.7.2
|
# slpkg 3.7.3
|
||||||
|
|
||||||
Slpkg is a powerful software package manager that installs, updates, and removes packages on
|
Slpkg is a powerful software package manager that installs, updates, and removes packages on
|
||||||
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and
|
[Slackware](http://www.slackware.com/) based systems. It automatically computes dependencies and
|
||||||
|
@ -16,7 +16,7 @@ display warning messages, etc.
|
||||||
|
|
||||||
#### Asciicast:
|
#### Asciicast:
|
||||||
|
|
||||||
[<img src="https://asciinema.org/a/3uFNAOX8o16AmKKJDIvdezPBa" width="250"/>](https://asciinema.org/a/3uFNAOX8o16AmKKJDIvdezPBa)
|
[<img src="https://asciinema.org/a/3uFNAOX8o16AmKKJDIvdezPBa" width="250">](https://asciinema.org/a/3uFNAOX8o16AmKKJDIvdezPBa)
|
||||||
|
|
||||||
|
|
||||||
##### Copyright
|
##### Copyright
|
||||||
|
|
|
@ -11,4 +11,4 @@
|
||||||
# perl 5 language and graph-easy >= 0.75 (drawing dependencies ascii diagram)
|
# perl 5 language and graph-easy >= 0.75 (drawing dependencies ascii diagram)
|
||||||
# python3-pythondialog >= 3.5.0 (Python interface to the UNIX dialog utility)
|
# python3-pythondialog >= 3.5.0 (Python interface to the UNIX dialog utility)
|
||||||
|
|
||||||
python-requests >= 2.22.0
|
urllib3 >= 1.25.7
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -37,7 +37,7 @@ except ImportError:
|
||||||
docs_requires = []
|
docs_requires = []
|
||||||
tests_requires = []
|
tests_requires = []
|
||||||
install_requires = [
|
install_requires = [
|
||||||
"requests>=2.22.0"
|
"urllib3>=1.25.7"
|
||||||
]
|
]
|
||||||
optional_requires = [
|
optional_requires = [
|
||||||
"pythondialog>=3.5.0",
|
"pythondialog>=3.5.0",
|
||||||
|
|
|
@ -78,7 +78,7 @@ class MetaData:
|
||||||
|
|
||||||
__all__ = "slpkg"
|
__all__ = "slpkg"
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version_info__ = (3, 7, 2)
|
__version_info__ = (3, 7, 3)
|
||||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import requests
|
import urllib3
|
||||||
|
|
||||||
|
|
||||||
class FileSize:
|
class FileSize:
|
||||||
|
@ -31,15 +31,15 @@ class FileSize:
|
||||||
"""
|
"""
|
||||||
def __init__(self, registry):
|
def __init__(self, registry):
|
||||||
self.registry = registry
|
self.registry = registry
|
||||||
|
self.http = urllib3.PoolManager()
|
||||||
|
|
||||||
def server(self):
|
def server(self):
|
||||||
"""Returns the size of remote files
|
"""Returns the size of remote files
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
r = requests.head(self.registry)
|
r = self.http.request("GET", self.registry)
|
||||||
return int(r.headers["Content-Length"])
|
return int(r.headers["Content-Length"])
|
||||||
except (requests.exceptions.Timeout,
|
except urllib3.exceptions.NewConnectionError:
|
||||||
requests.exceptions.ConnectionError):
|
|
||||||
return " "
|
return " "
|
||||||
|
|
||||||
def local(self):
|
def local(self):
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
from slpkg.utils import Utils
|
||||||
from slpkg.repositories import Repo
|
from slpkg.repositories import Repo
|
||||||
from slpkg.file_size import FileSize
|
from slpkg.file_size import FileSize
|
||||||
from slpkg.downloader import Download
|
from slpkg.downloader import Download
|
||||||
|
@ -701,10 +702,13 @@ class Initialization:
|
||||||
def merge(self, path, outfile, infiles):
|
def merge(self, path, outfile, infiles):
|
||||||
"""Merge files
|
"""Merge files
|
||||||
"""
|
"""
|
||||||
with open(path + outfile, 'w') as out_f:
|
code = "utf-8"
|
||||||
for i in infiles:
|
with open(path + outfile, 'w', encoding=code) as out_f:
|
||||||
if os.path.isfile("{0}{1}".format(path, i)):
|
for f in infiles:
|
||||||
with open(path + i, "r") as in_f:
|
if os.path.isfile("{0}{1}".format(path, f)):
|
||||||
|
# checking the encoding before read the file
|
||||||
|
code = Utils.check_encoding(path, f)
|
||||||
|
with open(path + f, "r", encoding=code) as in_f:
|
||||||
for line in in_f:
|
for line in in_f:
|
||||||
out_f.write(line)
|
out_f.write(line)
|
||||||
|
|
||||||
|
@ -748,10 +752,10 @@ class Initialization:
|
||||||
Update().repository(only)
|
Update().repository(only)
|
||||||
|
|
||||||
|
|
||||||
class Update(object):
|
class Update:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._init = "Initialization(False)"
|
self.initialization = globals()['Initialization'](False)
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
self.done = "{0}Done{1}\n".format(self.meta.color["GREY"],
|
self.done = "{0}Done{1}\n".format(self.meta.color["GREY"],
|
||||||
self.meta.color["ENDC"])
|
self.meta.color["ENDC"])
|
||||||
|
@ -770,14 +774,13 @@ class Update(object):
|
||||||
if check_for_local_repos(repo) is True:
|
if check_for_local_repos(repo) is True:
|
||||||
continue
|
continue
|
||||||
print("{0}Check repository [{1}{2}{3}] ... "
|
print("{0}Check repository [{1}{2}{3}] ... "
|
||||||
"{4}".format(
|
"{4}".format(self.meta.color["GREY"],
|
||||||
self.meta.color["GREY"],
|
self.meta.color["CYAN"], repo,
|
||||||
self.meta.color["CYAN"], repo,
|
self.meta.color["GREY"],
|
||||||
self.meta.color["GREY"],
|
self.meta.color["ENDC"]), end="", flush=True)
|
||||||
self.meta.color["ENDC"]), end="")
|
|
||||||
print(end="", flush=True)
|
|
||||||
if repo in default:
|
if repo in default:
|
||||||
exec("{0}.{1}()".format(self._init, repo))
|
update = getattr(self.initialization, repo)
|
||||||
|
update()
|
||||||
print(self.done, end="")
|
print(self.done, end="")
|
||||||
elif repo in enabled:
|
elif repo in enabled:
|
||||||
Initialization(False).custom(repo)
|
Initialization(False).custom(repo)
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
import requests
|
import urllib3
|
||||||
|
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
|
@ -33,15 +33,15 @@ class URL:
|
||||||
def __init__(self, link):
|
def __init__(self, link):
|
||||||
self.link = link
|
self.link = link
|
||||||
self.meta = _meta_
|
self.meta = _meta_
|
||||||
|
self.http = urllib3.PoolManager()
|
||||||
|
|
||||||
def reading(self):
|
def reading(self):
|
||||||
"""Open url and read
|
"""Open url and read
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
f = requests.get(self.link)
|
f = self.http.request('GET', self.link)
|
||||||
return f.text
|
return f.data.decode("utf-8")
|
||||||
except (requests.exceptions.Timeout,
|
except urllib3.exceptions.NewConnectionError:
|
||||||
requests.exceptions.ConnectionError):
|
|
||||||
print("\n{0}Can't read the file '{1}'{2}".format(
|
print("\n{0}Can't read the file '{1}'{2}".format(
|
||||||
self.meta.color["RED"], self.link.split("/")[-1],
|
self.meta.color["RED"], self.link.split("/")[-1],
|
||||||
self.meta.color["ENDC"]))
|
self.meta.color["ENDC"]))
|
||||||
|
|
|
@ -102,6 +102,16 @@ class Utils:
|
||||||
else:
|
else:
|
||||||
return file_name
|
return file_name
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check_encoding(path, f):
|
||||||
|
"""Checking the file encoding default is utf-8
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
with open(path + f, "r") as ftest:
|
||||||
|
ftest.read()
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
return "ISO-8859-1"
|
||||||
|
|
||||||
def debug(self, test):
|
def debug(self, test):
|
||||||
"""Function used for print some stuff for debugging
|
"""Function used for print some stuff for debugging
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue