From c07c9d40de57d1607e414d81d77abbe9354c7714 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 20 Jan 2020 20:31:48 +0100 Subject: [PATCH 1/5] Moved test Signed-off-by: Dimitris Zlatanidis --- tests/test_utils.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index fce14d11..17aa5352 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,10 +1,6 @@ from slpkg.utils import Utils -def test_units(): - assert ["Kb", "Kb"], ["100", "100"] == units(['100', ['100']]) - - def test_dimensional_list(): lists = [[1, 2, 3, 4, 5]] utils = Utils() @@ -14,4 +10,4 @@ def test_dimensional_list(): def test_remove_dbs(): lists = [1, 2, 3, 3, 4, 5, 2, 1] utils = Utils() - assert [1, 2, 3, 4, 5] == utils.remove_dbs(lists) \ No newline at end of file + assert [1, 2, 3, 4, 5] == utils.remove_dbs(lists) From 6439ef4814d3c3344632d81bc390dfabd17d5ccc Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Mon, 20 Jan 2020 20:43:50 +0100 Subject: [PATCH 2/5] Updated for f string Signed-off-by: Dimitris Zlatanidis --- slpkg/checksum.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/slpkg/checksum.py b/slpkg/checksum.py index ea82edad..5f021662 100644 --- a/slpkg/checksum.py +++ b/slpkg/checksum.py @@ -30,25 +30,24 @@ from slpkg.__metadata__ import MetaData as _meta_ def check_md5(pkg_md5, src_file): """MD5 Checksum """ + red = _meta_.color["RED"] + green = _meta_.color["GREEN"] + endc = _meta_.color["ENDC"] if _meta_.checkmd5 in ["on", "ON"]: print() md5s = md5(src_file) if pkg_md5 != md5s: Msg().template(78) - print("| MD5SUM check for {0} [ {1}FAILED{2} ]".format( - src_file.split("/")[-1], _meta_.color["RED"], - _meta_.color["ENDC"])) + print(f"| MD5SUM check for {src_file.split('/')[-1]} [ {red}FAILED{endc} ]") Msg().template(78) - print("| Expected: {0}".format(pkg_md5)) - print("| Found: {0}".format(md5s)) + print(f"| Expected: {pkg_md5}") + print(f"| Found: {md5s}") Msg().template(78) print() if not Msg().answer() in ["y", "Y"]: raise SystemExit() else: Msg().template(78) - print("| MD5SUM check for {0} [ {1}PASSED{2} ]".format( - src_file.split("/")[-1], _meta_.color["GREEN"], - _meta_.color["ENDC"])) + print(f"| MD5SUM check for {src_file.split('/')[-1]} [ {green}PASSED{endc} ]") Msg().template(78) print() # new line after pass checksum From 4c4298277eca5e48c39f35262f694b01e37602a2 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 21 Jan 2020 21:56:19 +0100 Subject: [PATCH 3/5] Remove tests Signed-off-by: Dimitris Zlatanidis --- slpkg/sizes.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/slpkg/sizes.py b/slpkg/sizes.py index a5423a69..ec55678a 100644 --- a/slpkg/sizes.py +++ b/slpkg/sizes.py @@ -25,7 +25,6 @@ def units(comp_sum, uncomp_sum): """Calculate package size """ - print(comp_sum, uncomp_sum) compressed = round((sum(map(float, comp_sum)) / 1024), 2) uncompressed = round((sum(map(float, uncomp_sum)) / 1024), 2) comp_unit = uncomp_unit = "Mb" @@ -41,5 +40,4 @@ def units(comp_sum, uncomp_sum): if uncompressed < 1: uncompressed = sum(map(int, uncomp_sum)) uncomp_unit = "Kb" - print(comp_unit, uncomp_unit, compressed, uncompressed) - return [comp_unit, uncomp_unit], [compressed, uncompressed] \ No newline at end of file + return [comp_unit, uncomp_unit], [compressed, uncompressed] From 16d2daf5d88180d4f1ddee3f375c4165d828b4a0 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 26 Jan 2020 15:51:22 +0100 Subject: [PATCH 4/5] Updated Signed-off-by: Dimitris Zlatanidis --- EXAMPLES.md | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 14384460..b8181bd1 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -3,11 +3,16 @@ ##### Usage -First you need to run '`slpkg update`' to synchronize the lists of packages, also every time you add -a new repository. To add or remove repositories must edit the file '`/etc/slpkg/repositories.conf`' -or run '`slpkg repo-enable`' (python3-pythondialog required). Add custom repositories with the -command '`slpkg add-repo `' and after run '`slpkg update`' to update package -list. View list of repositories with the command `slpkg repo-list` or get repository information +Before you start to use slpkg need to run '`slpkg update`' to synchronize the lists of packages, +also every time you add a new repository. + +To add or remove repositories you have to edit the file '`/etc/slpkg/repositories.conf`' +or run '`slpkg repo-enable`' (python3-pythondialog required). + +Add custom repositories with the command '`slpkg add-repo `' and +after run '`slpkg update`' to update package list. + +View list of repositories with the command `slpkg repo-list` or get repository information with the command '`slpkg repo-info `'. Update slpkg itself simply run '`slpkg update slpkg`', and slpkg check from GitLab repository if the @@ -16,7 +21,7 @@ new version is available. Checking packages health with the command '`slpkg health`' and slpkg check if the files missing from the package file list. -Print the dependencies status with the command '`slpkg deps-status`' or draw image map dependencies +View the dependencies status with the command '`slpkg deps-status`' or draw image map dependencies with the additional option '`--graph=[image]`'. Manage '`.new`' configuration files with the command '`slpkg new-config`', like remove, overwrite, @@ -43,7 +48,7 @@ Use '`--checklist`' option to help you to choose easy the packages. For advanced option '`--skip`' give them more power (see manpage). The most famous command is '`slpkg -s `', this command downloads, build and -installs packages with the resolve all the dependencies or switch off resolve with the option +installs packages and resolve all the dependencies or switch off resolve with the option '`--resolve-off`'. Also the additional option '`--case-ins`' help you find the packages with case insensitive. Two new arguments, help you to rebuild '`--rebuild`' or reinstall '`--reinstall`' packages. The last one argument '`--patches`' help you to switch in the '`patches/`' directory, only for the slack @@ -54,26 +59,26 @@ package dependency tree and also shows to you which ones are installed on your s Check if the packages used from other packages with the option '`--check-deps`' or draw image map dependencies with the additional option '`--graph=[image]`'. -Get information description of a package with the command '`slpkg -p `' and +Get information description of a package with the command '`slpkg -p `' and change the color of the text with the additional flag '`--color=[]`'. View a SBo package page on your terminal with command `slpkg -n ` and then manage multiple choices such read, download, build, install etc. -If you want to find a package of all the repositories, that command will solve your hands +If you want to find a package of all the repositories, this command will solve your hands '`slpkg -F `', it will search in all the enable repositories and will print all the packages that match the description that you enter. -If you want to see if any packages are installed on your system enter the command +If you want to see if any packages are installed on your system enter the command '`slpkg -f `'. The option '`--third-party`' help you to view only the third-party packages The next three commands '`slpkg --installpkg, --upgradepkg, --removepkg `' install, upgrade, -remove packages from your system events. Notable mention you must give in the command +remove packages from your system events. Notable mention you must give in the command '`slpkg --removepkg `' which you can remove the packages with all dependencies together after editing configuration file '`/etc/slpkg/slpkg.conf`' (default is disable) or add additional option '`--deps`'. Also you can check if the packages they are used as dependency with additional -option '`--check-deps`'. Option '`--tag`' allow to remove packages with by TAG. Optional you can use +option '`--check-deps`'. Option '`--tag`' allow to remove packages by TAG. Optional you can use the dialog utility with the additional option '`--checklist`' (require python3-pythondialog). Rmove third-party packages with the option '`--third-party`'. From 4fdc931c4f07287f3c5772975d18106a1ee7533e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sun, 26 Jan 2020 15:55:13 +0100 Subject: [PATCH 5/5] Added examples file Signed-off-by: Dimitris Zlatanidis --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b431290e..825b7957 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,8 @@ What makes slpkg to distinguish it from the other tools; The user friendliness i target as well as easy to understand and use, also use colors to highlight packages and display warning messages, etc. +[EXAMPLES.md](https://gitlab.com/dslackw/slpkg/blob/master/EXAMPLES.md) Explore some examples. + #### Asciicast: