Commit graph

71 commits

Author SHA1 Message Date
Hans-Christoph Steiner
97d5933a05 change config.py to config.yml everywhere it is needed 2021-01-29 13:24:17 +01:00
Hans-Christoph Steiner
ff90c0246e fix PEP8 W605 invalid escape sequence
Python 3.7 will get a lot stricter with escape sequences.  They must be
valid.

* https://lintlyci.github.io/Flake8Rules/rules/W605.html
* https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
2018-05-29 13:51:47 +02:00
Hans-Christoph Steiner
e6d5260c3c fix PEP8: W504 line break after binary operator 2018-05-29 12:31:56 +02:00
Hans-Christoph Steiner
278d67d960 implement gettext localization
This allows all the text to be localized via Weblate.  This is a quick
overview of all the strings, but there are certainly some that were left
out.

closes #342
2017-09-15 11:39:00 +02:00
Daniel Martí
82b1d7ad14 all: make newer pycodestyle happy
Apparently the "two empty lines" rule is now stricter.
2016-11-15 20:55:06 +00:00
Hans-Christoph Steiner
d522988d8c make metadata exceptions optional based on CLI flag
In many cases, there are times where metadata errors need to be ignored, or
at least not stop the command from running.  For example, there will
inevitably be new metadata fields added, in which case a packaged version
of fdroidserver will throw errors on each one.  This adds a standard -W
flag to customize the response: ignore, default, or error.

* by default, the errors are still errors
* `fdroid readmeta -W` will just print errors
* `fdroid readmeta -Wignore` will not even print errors

https://gitlab.com/fdroid/fdroidserver/issues/150
2016-09-12 12:55:48 +02:00
Daniel Martí
b73cc8e0b3 Replace itervalues() with values() 2016-03-10 16:43:37 +00:00
Daniel Martí
920ae4692f Port all imports to python3 2016-03-10 16:43:37 +00:00
Daniel Martí
99edd64372 Switch all headers to python3 2016-03-10 16:43:36 +00:00
Daniel Martí
fff658ba19 stats: use a stable sort that doesn't randomize
Since we only sorted by count, ignoring the string, it meant that items
with the same count might be arranged in different manners. Hence the
`stats` behaviour was not predictable at all. Now it sorts first by
count, then by string.
2016-01-11 02:43:06 +01:00
Daniel Martí
02c59a327b stats: fix a few dict accesses left over 2015-12-07 12:33:24 +01:00
Daniel Martí
ab614ab442 Rework app into a class
This simplifies usage, goes from

	app['Foo']
to
	app.Foo

Also makes static analyzers able to detect invalid attributes as the set
is now limited in the class definition.

As a bonus, setting of the default field values is now done in the
constructor, not separately and manually.
2015-11-28 17:11:05 +01:00
Daniel Martí
41370a12b0 Deduplicate statsdir 2015-09-14 18:13:03 -07:00
Daniel Martí
5cb47203b3 Replace some hard-coded paths with os.path.join 2015-09-14 18:12:15 -07:00
Daniel Martí
576da1d048 all: deduplicate -v/-q setup 2015-09-11 23:42:50 -07:00
nero-tux
d23ecf1b35 replace deprecated optparse with argparse
following guidelines from:
https://docs.python.org/2/library/argparse.html#upgrading-optparse-code
except, still using option = parse.parse_args() instead of args = ...

- using the following script in folder fdroidserver:
	for i in *.py; do
		sed -i -e 's/optparse/argparse/' \
			-e 's/OptionParser/ArgumentParser/' \
			-e 's/OptionError/ArgumentError/' \
			-e 's/add_option/add_argument/' \
			-e 's/(options, args) = parser/options = parser/' \
			-e 's/options, args = parser/options = parser/' \
			-e 's/Usage: %prog/%(prog)s/' $i;
	done
- use ArgumentParser argument to replace (option, args) = parser.parse()
  call
- use parser.error(msg) instead of raise ArgumentException as suggested
  in https://docs.python.org/2/library/argparse.html#exiting-methods
- in fdroid catch ArgumentError instead of OptionError
2015-09-06 10:34:50 +02:00
Hans-Christoph Steiner
2831b3e93f convert internal representation of AntiFeatures to list
The AntiFeatures metadata is a comma-separated list of tags, like
Categories, so it should also be stored internally as a list.  This makes
parsing XML and JSON easier.

The test cases' .pickle files look like they change a lot, but they really
don't, its only the change of default AntiFeatures value from None to []
2015-09-01 11:39:51 +02:00
Daniel Martí
6fe8d96e85 Simplify some file logic with "with" 2015-08-28 18:37:23 -07:00
Daniel Martí
2894786ec9 stats: better exit message 2015-08-28 18:29:28 -07:00
Daniel Martí
ca483069c0 Order counter stats by value, not key 2015-04-23 16:42:22 +02:00
Daniel Martí
e7ac90b6b8 stats: Don't confuse app with appid 2015-04-20 18:26:23 +02:00
Daniel Martí
3c2f84fb15 stats: sort counter outputs 2015-04-20 18:25:40 +02:00
Daniel Martí
41539d6a1b Add stats/disabled_apps.txt (closes #87) 2015-04-20 18:20:24 +02:00
Daniel Martí
14f654fabc Apply some autopep8-python2 suggestions 2014-12-31 16:44:06 +01:00
Ciaran Gultnieks
b454ea3c6f Make stats retrieval more configurable 2014-09-02 18:53:36 +01:00
Ciaran Gultnieks
b43f7bea1a Add ability to filter asshattery from stats 2014-08-22 21:18:55 +01:00
Daniel Martí
94c29f9c37 Map apps in memory from appid to appinfo
Instead of storing them in a list and doing linear searches by appinfo['id']
2014-08-16 12:46:02 +02:00
Daniel Martí
eb81375630 stats: simpler repo type logic 2014-08-16 11:42:51 +02:00
Daniel Martí
52a0773d71 stats: don't include disabled apps 2014-07-23 19:55:45 +02:00
Daniel Martí
49208b257d Always run read_srclibs as part of read_metadata 2014-06-30 14:39:52 +02:00
Ciaran Gultnieks
3cb4a80efb Fix stats update bug 2014-06-30 12:03:45 +01:00
Ciaran Gultnieks
277d95f57d Fix several read_metadata-related issues
Various calls with the wrong parameters, and also an unused parameter on
the function itself.
2014-05-20 17:48:45 +01:00
Hans-Christoph Steiner
0e00b36db5 fix PEP8 E124/E125/126/127/128 indentation issues
* E124 closing bracket does not match visual indentation
* E125 continuation line does not distinguish itself from next logical line
* E126 continuation line over-indented for hanging indent
* E127 continuation line over-indented for visual indent
* E128 continuation line under-indented for visual indent
2014-05-06 14:36:33 -04:00
Ciaran Gultnieks
bd34fc2530 Remove the rest of the PEP8 errors from stats.py 2014-04-30 20:53:34 +01:00
Ciaran Gultnieks
5849b43e02 Remove strange semicolons 2014-04-30 11:46:28 +01:00
Ciaran Gultnieks
2a5c8a4aa2 Cache aggregate stats to save time 2014-04-29 15:33:34 +01:00
Ciaran Gultnieks
a8cf0fa724 Fix stats (broken in f3db000) 2014-02-23 22:34:27 +00:00
Ciaran Gultnieks
5cd47137dd Improved some logging levels for stats 2014-02-22 10:05:07 +00:00
Ciaran Gultnieks
37dda9414c Add --quiet option, restricting output to warnings/errors 2014-02-22 09:46:24 +00:00
Daniel Martí
3483bad392 Make app['Categories'] a list, get unique categories via a set 2014-02-19 10:27:38 +01:00
Daniel Martí
be7c6aceec Do the rest of the stats with counters too 2014-02-19 10:03:42 +01:00
Daniel Martí
f3db0003e7 Use Counter objects when processing logs
This should somewhat speed things up, and makes the code simpler
2014-02-19 09:59:44 +01:00
Daniel Martí
86aa3d1530 Fix Tags <pattern> stats 2014-02-11 08:47:47 +01:00
Ciaran Gultnieks
b8e48f32f7 Partly revert c7f2cbd to make stats work again 2014-02-04 07:34:55 +00:00
Daniel Martí
1b743e8b74 More logging 2014-01-27 21:49:29 +01:00
Daniel Martí
c7f2cbd85b Last missing bit of Popen 2014-01-27 21:48:22 +01:00
Ciaran Gultnieks
80b29453a5 Fix new downloads-per-version stats 2014-01-23 23:31:03 +00:00
Florian Schmaus
fd28c0dca5 stats.py: Create downloads stats for app and version 2014-01-08 16:56:33 +01:00
Ciaran Gultnieks
d1ad5bd74e Some minor stats improvements 2013-12-28 10:36:05 +00:00
Ciaran Gultnieks
4cd263d598 Fix latestapps stats, broken in 59cde15ad1 2013-12-28 10:36:05 +00:00