Hans-Christoph Steiner
994488ad47
rename metadata.write_metadata() to match metadata.parse_*_metadata()
...
This changes the function name to include the format of the metadata file,
and also changes the order of the args to match the parse_*_metadata()
functions.
2016-03-23 17:16:28 +01:00
Hans-Christoph Steiner
9abb80b3b7
support .fdroid.* metadata file in source root of app being built
...
This allows app makers to include a .fdroid.(json|xml|yaml|txt) metadata
file in the root of the git repo of their app, then they can build it using
`fdroid build`. This is useful for developers who want to maintain the
fdroid build recipe themselves, and run the fdroid build process for their
own builds.
2016-03-23 17:16:27 +01:00
Daniel Martí
a023a235a2
metadata: always open metadata files in UTF-8
...
For some reason, Python uses whatever encoding the system is using via a
locale. Since CI uses an ascii locale, stuff breaks. I can't find a way
to make all of fdroidserver ignore the locale and just use UTF-8, so for
now force it where it's bothering CI.
2016-03-11 13:27:01 +00:00
Daniel Martí
d98b4d1b83
metadata: slightly speed up post_metadata_parse
...
Iterating over all the fields and checking which are modified is slower
than just iterating over the modified ones.
2016-03-11 13:27:01 +00:00
Daniel Martí
7f6276889e
metadata: Sorting builds twice is not necessary
2016-03-11 13:27:00 +00:00
Daniel Martí
d4f806d757
Undo utf-8 text wrap workaround
...
This was added to fix unicode support in Python2. No longer needed in
Python3.
2016-03-11 13:27:00 +00:00
Daniel Martí
4e28fa78fc
Fix python headers in some source files
...
These were missing the python2 header, so they went under my radar when
doing the switch go python3.
2016-03-11 13:27:00 +00:00
Daniel Martí
f1f5836a66
Remove code that worked around python2 unicode
2016-03-10 16:43:37 +00:00
Daniel Martí
832b1224b9
Replace basestring with str
2016-03-10 16:43:37 +00:00
Daniel Martí
75419c1f04
Replace iteritems() with items()
2016-03-10 16:43:37 +00:00
Daniel Martí
ca5ee87b16
Switch to io.StringIO
2016-03-10 16:43:37 +00:00
Daniel Martí
e3591cb7b8
Fix imports in Python 3
...
Since common and metadata import each other, we must import via
"fdroidserver.*".
2016-03-10 16:43:37 +00:00
Hans-Christoph Steiner
e0312897c7
make "Current Version Code" default to most recent APK
...
closes #36 https://gitlab.com/fdroid/fdroidserver/issues/36
2016-02-17 10:40:07 +01:00
Daniel Martí
9800ed1a1a
output= is now a glob path and can do gradle
2016-02-15 12:02:45 +00:00
Daniel Martí
0cf2539c89
metadata: fix text wrapping on unicode characters
...
We were passing the utf-8 encoded string to textwrap, which took the
bytes as characters. Hence multi-byte unicode characters (in utf-8)
would count as multiple columns, which is clearly wrong.
2016-01-10 17:54:38 +01:00
Daniel Martí
e8eda55d9d
metadata: Always use regex to verify values
...
Lists can be made into regexes very easily. Major code simplification.
Also no need to construct sets to avoid iterating over lists.
2016-01-04 13:44:00 +01:00
Daniel Martí
7ff833b948
Remove redundant AntiFeatures bool check
2016-01-04 13:26:48 +01:00
Dominik George
7f3434ea50
Add Author Name and Author Email fields. ( Closes : #90 )
2016-01-03 23:00:03 +01:00
NeroBurner
5ca182a20d
except named exception handling
2015-12-29 20:09:27 +01:00
Daniel Martí
967472408b
Add NonFreeAssets anti-feature
2015-12-29 12:39:48 +01:00
Daniel Martí
adff5615f5
Fix issues spotted by older pyflakes
2015-12-16 16:42:50 +01:00
Daniel Martí
013315bf10
Open metadata files in only one place
...
Also get rid of the useless get_default_app_info func.
2015-12-07 20:31:23 +01:00
Daniel Martí
5541cb83ac
checkupdates: fix --auto build copy
...
Also, remove origlines which hasn't been used in some time.
2015-12-07 12:39:04 +01:00
Daniel Martí
3101ad6c39
Set all list defaults to an actual list
...
Iterating over the defaults will crash otherwise. Update pickle files.
2015-12-04 00:08:42 +01:00
Daniel Martí
cb8d93e443
Fix tests by not checking private attributes
...
All attrs starting with '_' (e.g. _foo or __bar) are used internally, so
not very relevant for the metadata test anyway.
2015-12-03 19:31:20 +01:00
Daniel Martí
2711f1c868
Also skip unmodified fields in the regex checks
...
Now it's close to 1s.
2015-12-03 17:02:24 +01:00
Daniel Martí
ea99add3da
Keep track of what attrs were modified in apps/builds
...
This allows us to run checks and fix types only on those that were
really modified. On our fdroiddata repo, with 2k apps with many unset
fields and flags, this reduces readmeta runtime from ~1.3s to ~1.1s.
2015-12-03 16:46:21 +01:00
Daniel Martí
8c2e1fedfc
Actually check that bools are valid
...
The metadata check was omitting booleans and lists, as it was only
taking strings. Fix this.
2015-12-03 16:35:46 +01:00
Daniel Martí
7b575e3fdd
Remove need for rstrip() of txt description
2015-12-03 16:19:33 +01:00
Daniel Martí
a9bb5f9713
metadata: write strings directly to txt file
2015-12-03 14:00:47 +01:00
Daniel Martí
28566f6e57
Rename metafieldtype to fieldtype
...
For consistency with flagtype. Also less redundant.
2015-12-03 13:53:49 +01:00
Daniel Martí
2c095df947
Use dicts for field/flag types
2015-12-03 13:52:53 +01:00
Daniel Martí
cd4e43c3c2
Some more readability/performance tweaks
...
* Use set() instead of dict()
* No 'if foo: True else: False'
* Don't check for invalid fields twice
2015-12-03 13:02:54 +01:00
Daniel Martí
b1a9180d12
Use constants for field/flag types
...
Avoids typos, such as one I just found which was 'strsng' isntead of
'string'. The static analyzer can catch those if they are constants.
Comparing ints is also faster than strings, which adds up in readmeta.
2015-12-03 12:55:19 +01:00
Daniel Martí
992406de0e
Avoid conflicting func/var names
2015-12-03 12:41:50 +01:00
Daniel Martí
1b43d8e33c
Make text formatting faster via StringIO
...
Avoid concatenating strings over and over. Also, the wiki formatting
wasn't necessary at all since it was just joining lines.
2015-12-03 12:02:47 +01:00
Daniel Martí
088929711c
Represent multiline fields as str, not list
...
Only keep lists in metadata files in the json format, since they don't
support multiline strings that are readable.
This makes the internal code easier, and a bit faster.
2015-12-03 11:36:15 +01:00
Daniel Martí
c8cc054c8b
Fix tests
2015-12-03 11:16:27 +01:00
Daniel Martí
97c991c4b6
Some more txt parsing tweaks after profiling
2015-12-03 11:06:27 +01:00
Daniel Martí
490da2da22
Remove duplicate build_flags check
...
It's already checked in set_flag
2015-12-03 10:59:48 +01:00
Daniel Martí
1987ee7f54
Remove gradle=main
...
It was only supported in txt metadata, and was unused in fdroiddata
anyway.
2015-12-03 10:56:59 +01:00
Daniel Martí
5e0bc7f2c3
Properly close all metadata files once read
2015-12-03 10:51:27 +01:00
Daniel Martí
96f1fc5355
Never use exit/log in metadata
2015-12-02 22:59:58 +01:00
Daniel Martí
b9ac6fb69a
Speed up metadata reading
...
Total time for `fdroid readmeta` went down from ~1.6s to ~1.4s on my
machine.
2015-12-02 22:38:40 +01:00
Daniel Martí
528e45d22b
Simplify post_metadata_parse usage
2015-12-02 22:29:31 +01:00
Daniel Martí
c975531d87
metadata: properly store nums as strs and bools as bools
2015-12-02 20:49:42 +01:00
Daniel Martí
71a5eac494
Pre-compile more regexes
2015-12-02 20:40:30 +01:00
Daniel Martí
a566ee4475
Fix default update= on ant builds
2015-12-02 20:16:25 +01:00
Daniel Martí
bf8518ee8f
Rework build into a class
...
This simplifies usage, goes from
build['flag']
to
build.flag
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.
While at it, unify "build", "thisbuild", "info", "thisinfo", etc into
just "build".
2015-12-02 20:03:11 +01:00
Daniel Martí
6e87a8c45a
Add documentation to new App class
2015-11-28 17:19:59 +01:00