Commit Graph

15 Commits

Author SHA1 Message Date
Oliver Stöneberg b472b4e65d
some Python cleanups based on PyCharm inspections (#2999)
* some Python cleanups based on PyCharm inspections

* test-helloworld.py: adjusted assert in test_addon_relative_path()
2021-01-31 14:27:11 +01:00
Rikard Falkeborn ba33c7f6cd daca2: Improve package sorting using natsort (#2505)
* daca2: Improve package sorting using natsort

This switches the external dependency from semver to natsort, and
improves comparison of packages where one or more of the packages do not
use semantic versioning (major.minor.patch).

This also makes daca2-download and daca2-getpackages work with python 3.
In theory, they should work with python 2 as well, but I have not tested
it.

* Make daca2 scripts executable

* Update hashbangs to python3

* Update usage description

To avoid specifying python version in the usage description, just
show how to execute the scripts and leave the rest to the shebangs.

* No need to specify python version in start_donate_cpu_server_test_local.sh

Leave it to the hashbang instead.
2020-01-26 18:39:37 +01:00
Sebastian 7c7b0e55ed
daca2-getpackages.py: Fix #9508: Add support for xz compressed archives (#2493)
Using .tar.xz packages adds about 4500 additional packages that can be
tested and changes many existing packages where a more recent version
can be used now that is only available as .tar.xz file.

Related ticket: https://trac.cppcheck.net/ticket/9508

donate-cpu.py: Require at least Python 3.4
xz support was added with 3.3.
2020-01-17 12:23:07 +01:00
Sebastian 53623ddf6f
daca2-getpackages.py: Fix semver sorting and getting latest package (#2490)
There were two issues:
1. The version was not correctly extracted out of the filename. When
extracting a sub-string in Python one has to specify start index and
end index instead of start index and length.
2. The function `semver.cmp()` does nothing useful. Instead the function
`semver.compare()` must be called when two version should be compared.
See https://github.com/python-semver/python-semver/issues/117#issuecomment-479188221

Because `semver.compare()` now really compares the versions it is
possible that an exception is thrown if a version is not in the semver
version format. In such cases the sorting is aborted and the last
filename in the array is returned. This is often but not always already
the latest version from what I have seen.
2020-01-16 20:02:56 +01:00
Bo Rydberg e6d692d960 Fix daca2 using latest version of package (#2393)
* Add semver import for sorting ls-lR list

* Fix using latest release version of package

* Import semver with pip in travis file
2019-11-24 13:05:21 +01:00
Daniel Marjamäki 908cd39572 daca2-packages: improved filter for versions 2019-11-03 08:13:06 +01:00
Daniel Marjamäki dbbea54b74 daca2-getpackages: if a package has many versions then only scan latest 2019-11-03 08:05:06 +01:00
Daniel Marjamäki 575fa35ce2 daca@home: Use ftp server in germany instead of sweden, that is closer for most/all active clients 2019-10-26 17:47:42 +02:00
Daniel Marjamäki dc7cf10962 daca2-getpackages: update instructions 2019-10-19 18:49:58 +02:00
Daniel Marjamäki 8231912af9 daca2-getpackages: more protection when it goes wrong 2019-03-27 06:41:35 +01:00
Daniel Marjamäki 8f7eae2948 daca2-getpackages: terminate with an exit code if download fails 2019-03-27 06:33:08 +01:00
Daniel Marjamäki 35bbe5617a Revert "Add semver import for sorting ls-lR list (#1735)"
This reverts commit e61343f213.
2019-03-12 06:25:11 +01:00
Bo Rydberg e61343f213 Add semver import for sorting ls-lR list (#1735) 2019-03-12 06:14:31 +01:00
Sebastian 4e90922e5b Donate CPU: Also use and accept .tar.bz2 package files. (#1707)
In my tests there were about 1500 additional packages
available as bz2 on the server.
For some packages a newer version is now used if it is
only available as .tar.bz2 archive.
The donate-cpu.py client is tested to work with .tar.bz2
files under Python 2.7.15 and 3.6.8.
2019-02-28 08:40:07 +01:00
Daniel Marjamäki 8e43851ad1 Add daca2-getpackages.py 2019-01-03 11:42:32 +01:00